Hi Ben, The fact that there are no entries between 0.8 and 0.9 is simply a binning artefact. Increase your number of bins from 10 to 100. The values given to TMath::KolmogorovProv are discrete due to the difference between consecutive bins (small integers). Thus introduces an asymmetry in favour of high z values. Rene Brun On Thu, 24 Jul 2003, Ben Kilminster wrote: > Hi fellow Rooters, > > The KS probability is supposed to be a value which is uniformly > distributed between zero and one if you are comparing two distributions > which come from the same parent distribution. > > In the following root macro that I run, I see that it is not flat, it is > peaked strongly at one, and that there is a big hole where the probability > is not filled. > > Does anyone have any idea what is wrong ? > > Cheers, > Ben > > (I am using root v3_05_04d KCC_4_0 Linux+2.4) > > > { > TCanvas *c1 = new TCanvas("c1","plots",600,700); > c1->Divide(2,2); > // Make a gaussian distribution > TH1F *HGaussMain = new TH1F("HGaussMain","Gaussian pseudoexperiment > ",100,0,10); > for (i = 0; i < 10000; i++) { > HGaussMain->Fill(gRandom->Gaus(5,1.0)); > } > // Draw the parent distribution > TCanvas *c1 = new TCanvas("c1","plots",600,700); > c1->Divide(2,2); > c1->cd(1); > HGaussMain->Draw(); > > // Now loop through choosing 100 event > // daughter distributions from the parent distribution > // comparing them with KS statistic > > TH1F *HGauss1 = new TH1F("HGauss1","Random Gaussian > pseudoexperiment",100,0,10); > TH1F *HGauss2 = new TH1F("HGauss2","Random Gaussian > pseudoexperiment",100,0,10); > TH1F *HKSValues = new TH1F("HKSValues","KS values",10,0,1.0); > > for (int j = 0; j < 1000; j++) { > HGauss1->Reset(); > HGauss2->Reset(); > for (int i = 0; i < 100; i++) { > HGauss1->Fill(HGaussMain->GetRandom()); > HGauss2->Fill(HGaussMain->GetRandom()); > } > double KS_agree = HGauss1->KolmogorovTest(HGauss2); > HKSValues->Fill(KS_agree); > } > > c1->cd(2); > HGauss1->Draw(); // typical daughter distribution > c1->cd(3); > HGauss2->Draw(); // another typical daughter distribution > c1->cd(4); > HKSValues->Draw(); // This is not flat > > } > >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET