[ROOT] Question on fitting with chi-squared

From: Alexander Dietz (adietz@mickey.mpi-hd.mpg.de)
Date: Fri Nov 15 2002 - 09:52:19 MET


Hello Rooters,

as I know the chi-square method, used to estimate parameters, goes like
this:


chisquare=sum_{i=1}^N (x_i - y_i)^2/e_i


with x_i being the value from a spectrum and y_i being the theoretical
function depending on one or more parameters.
To get the best-fitting values for the parameters this function must be
minimized.
Suppose to fit a constant y with fit-option 'w' (setting all errors to 1).
Then the chisquare-value should be calculated like this:


chisquare=sum_{i=1}^N (x_i - y)^2


It is simple to calculate y for which this value is minimal:

y=( sum_{i=1}^n x_i ) /n

so y is simple the mean value of the data in the spectrum.

I checked this with the following program:


  TH1F* h1=new TH1F("h1","test",10,1,10);
  h1->SetBinContent(3,1);
  h1->SetBinContent(7,2);
  h1->Fit("pol0","W");

but what I get is a best-value of 1.5 instead of 0.3!
It seems that ROOT ignores every channel with zero-content.

Is ROOT ignoring channels with zero-contente and why?
What can I do that ROOT gives the correct value?

Cheers

	Alexander Dietz



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:18 MET