Hi, Perhaps there is something I'm not understanding about KS tests, but when I do a Kolmogorov Test on 2-D histograms I get results which seem *too* compatible. Here is an example. In test2Hists.C, I compare two 2-d histograms and get a KS probability of about 0.13. In test1Hists.C, I project the same 2-D histograms onto the X axis, and do a comparison to get a KS probability of 0.005. The 1-D KS value seems reasonable, but the 2-D KS value seems really inflated. root [0] .X test1dHists.C 1D KS agreement (no N option) is 0.00553137 1D KS agreement (with N option) is 0.0141395 root [1] .X test2dHists.C 2D KS agreement (no N option) is 0.129321 2D KS agreement (with N option) is 0.186625 // file test1dHists.C { TH1F *h1 = new TH1F("h1","test",10,3,8); TH1F *h12 = new TH1F("h12","test2",10,3,8); h1->Fill(3);h1->Fill(3); h1->Fill(4);h1->Fill(4);h1->Fill(4);h1->Fill(4); h1->Fill(5);h1->Fill(5);h1->Fill(5);h1->Fill(5);h1->Fill(5); h1->Fill(6);h1->Fill(6);h1->Fill(6);h1->Fill(6); h1->Fill(7);h1->Fill(7); h12->Fill(5.5);h12->Fill(5.5);h12->Fill(5.5);h12->Fill(5.5); h12->Fill(5.5);h12->Fill(5.5);h12->Fill(5.5);h12->Fill(5.5); h12->Fill(5.5);h12->Fill(5.5);h12->Fill(5.5);h12->Fill(5.5); TCanvas *c1 = new TCanvas("c1","1-D ",600,800); c1->Divide(1,2); c1->cd(1); h1->Draw(); c1->cd(2); h12->Draw(); c1->Update(); double KS = h1->KolmogorovTest(h12); cout << " 1D KS agreement (no N option) is " << KS << endl; double KS = h1->KolmogorovTest(h12,"N"); cout << " 1D KS agreement (with N option) is " << KS << endl; } // file test2dHists.C { TH2F *h = new TH2F("h","test",10,3,8,10,0,6); TH2F *h2 = new TH2F("h2","test2",10,3,8,10,0,6); h->Fill(3,4);h->Fill(3,3); h->Fill(5,1);h->Fill(5,2);h->Fill(5,1);h->Fill(5,2);h->Fill(5,1); h->Fill(4,2);h->Fill(4,1);h->Fill(4,2);h->Fill(4,3); h->Fill(6,3);h->Fill(6,2);h->Fill(6,1);h->Fill(6,3); h->Fill(7,4);h->Fill(7,4); h2->Fill(5.5,4.0);h2->Fill(5.5,4.0);h2->Fill(5.5,4.0);h2->Fill(5.5,4.0); h2->Fill(5.5,4.0);h2->Fill(5.5,4.0);h2->Fill(5.5,4.0);h2->Fill(5.5,4.0); h2->Fill(5.5,4.0);h2->Fill(5.5,4.0);h2->Fill(5.5,4.0);h2->Fill(5.5,4.0); TCanvas *c2 = new TCanvas("c2","2-D ",600,800); c2->Divide(1,2); c2->cd(1); h->Draw("box"); c2->cd(2); h2->Draw("box"); double KS = h->KolmogorovTest(h2); cout << " 2D KS agreement (no N option) is " << KS << endl; double KS = h->KolmogorovTest(h2,"N"); cout << " 2D KS agreement (with N option) is " << KS << endl; } Cheers, Ben
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:40 MET