Re: chi2/NDF from max. likelihood include bins with 0 counts.

From: Lorenzo Moneta <Lorenzo.Moneta_at_cern.ch>
Date: Mon, 20 Dec 2010 15:28:56 +0100


Hello Wei,

 What you observe is expected. IN case of likelihood fit we can use the empty bins, which have valuable information, without biasing the fit. The Poisson mean is in this case the expected function value in the bin.

If you want to do a Poisson likelihood fit excluding the empty bin, you need to use directly the Fitter class (a similar example is the tutorials/fit/exampleFit3D.C ). There is no such option in TH1:::Fit since it is not recommended.

  Best Regards

 Lorenzo
On Dec 18, 2010, at 4:46 PM, Wei Xie wrote:

> A related question. When doing the Likelihood fit, how the uncertainty of the 0-counts bin is calculated. Does it assume it's a Poisson with a mean from the interpolation of neighboring bins?
> 
> Thanks
> --Wei
> 
> On 12/17/2010 7:14 PM, Wei Xie wrote:

>> When calculating the chi2/NDF, empty bin is taken into account in the max.likelihood method. Least-chi2 option don't have this problem. The following macro demonstrate this. I tried this in ROOT 5.22. 5.27. They shows the same results. Is this because I didn't use it properly or this is a bug? If this is not a bug, how to do the max. likelihood fit without taking into account the empty bins?
>>
>> Thanks
>> --Wei
>>
>> {
>> h = new TH1F("h", "", 100, -10, 10);
>> for(int i = 0; i<1000; i++) {
>> float a = gRandom->Gaus(0, 1);
>> h->Fill(a);
>> }
>>
>> h->Sumw2();
>>
>> h->Scale(0.5);
>>
>> TH1F *h0 = (TH1F*)h->Clone();
>> h0->SetName("h0");
>> TH1F *h1 = (TH1F*)h->Clone();
>> h1->SetName("h1");
>> TH1F *h2 = (TH1F*)h->Clone();
>> h2->SetName("h2");
>>
>> c1 = new TCanvas("c1", "", 900, 900);
>> c1->Divide(2, 2);
>>
>> gStyle->SetOptFit(1);
>>
>> c1->cd(1);
>> h->Fit("gaus", "L", "", -3, 3);
>> c1->cd(2);
>> h0->Fit("gaus", "L", "", -10, 10);
>>
>> c1->cd(3);
>> h1->Fit("gaus", "", "", -3, 3);
>> c1->cd(4);
>> h2->Fit("gaus", "", "", -10, 10);
>> }
>>
> 
> 
> -- 
> Dept. of Physics, Purdue Univ.
> 525 Northwestern Ave., West Lafayette, IN 47907
> Tel: 765-494-8743, Fax: 765-494-0706
> 
Received on Mon Dec 20 2010 - 15:29:03 CET

This archive was generated by hypermail 2.2.0 : Tue Dec 21 2010 - 17:50:02 CET