Hi Alexander,
I tried your small program and I obtain the following result of 0.3 as
expected using ROOT from CVS of one week ago on RH7.2 :
root [0] TH1F* h1=new TH1F("h1","test",10,1,10)
root [1] h1->SetBinContent(3,1)
root [2] h1->SetBinContent(7,2)
root [3] h1->Fit("pol0","W")
FCN=4.1 FROM MIGRAD STATUS=CONVERGED 11 CALLS 12 TOTAL
EDM=1.0137e-24 STRATEGY= 1 ERROR MATRIX
ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 3.00000e-01 3.16228e-01 -0.00000e+00 6.36774e-12
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
(Int_t)0
Nicolas
Alexander Dietz wrote:
>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
>
>
>
>
--
:-------------------------------:
: Nicolas de SEREVILLE :
: C.S.N.S.M. :
: Batiment 104 :
: 91405 ORSAY Campus :
: Tel : (+ 33) (0)1 69 15 52 29 :
: Fax : (+ 33) (0)1 69 15 50 08 :
:-------------------------------:
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:18 MET