Re: [ROOT] Kolmogorow test on weighted histos

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Dec 22 2000 - 16:05:49 MET


Hi Andy,

What you obtain seems to be correct. To answer your points, I need to discuss
with Fred James who coded the original version of the algorithm.
Any statistician who could help meanwhile ?

Rene Brun


Andy Salnikov wrote:
> 
> Hi all,
> 
> it seems that kolmogorov test does not work for me on weighted histograms.
> Here is the macro:
> 
> {
> gROOT->Reset() ;
> 
> TH1* h1 = new TH1F("h1","Gauss",200,-5,5);
> TH1* h2 = new TH1F("h2","Gauss",200,-5,5);
> TH1* h3 = new TH1F("h3","Gauss",200,-5,5);
> TH1* h4 = new TH1F("h4","Gauss",200,-5,5);
> 
> int j ;
> double xs1, xs2 ;
> 
> h1->Reset() ;
> h2->Reset() ;
> 
> for ( j=0; j<10000; ++j ) {
>   xs1   = gRandom->Gaus(0,1);
>   xs2   = gRandom->Gaus(0,1);
>   h1->Fill(xs1);
>   h2->Fill(xs2);
> }
> 
> for ( j = 1 ; j<= 200; ++j ) {
>   h3->SetBinContent( j, h1->GetBinContent( j ) / 100 ) ;
>   h3->SetBinError( j, h1->GetBinError( j ) / 100 ) ;
> 
>   h4->SetBinContent( j, h2->GetBinContent( j ) / 100 ) ;
>   h4->SetBinError( j, h2->GetBinError( j ) / 100 ) ;
> }
> 
> h1->KolmogorovTest(h2,"D") ;
> h3->KolmogorovTest(h4,"D") ;
> 
> }
> 
> And here its output:
> 
>  Kolmo Prob  h1 = h1, sum1=10000
>  Kolmo Prob  h2 = h2, sum2=10000
>  Kolmo Probabil = 0.366721, Max Dist = 0.013
>  Kolmo Prob  h1 = h3, sum1=100
>  Kolmo Prob  h2 = h4, sum2=100
>  Kolmo Probabil = 1, Max Dist = 0.013
> 
> I'd expect that probabilities be equal for h1/h2 and h3/h4. What gives?
> 
> This was obtained in 2.25/03.
> 
> Also probably related question. Should the probability from KolmogorovTest
> have flat distibution? When I try call it many times for the above gaussian
> histograms I observe an exess for prob close to 1.
> 
>   Cheers,
>   Andy.



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:40 MET