Different chi2 values from apparently the same fit

Hello,

I have to fit a TGraphErrors with a 2nd polynominal function. I got different chi2 values depending on which function I used, either “pol2” or an equivalent TF1 function (“inclusive” is the pointer to the TGraphErrors):

root [1] inclusive->Fit(“pol2”,"","",0,12)


Minimizer is Linear
Chi2 = 443.973
NDf = 68
p0 = 1.82139 +/- 0.452234
p1 = 209.084 +/- 0.166504
p2 = 0.775206 +/- 0.015763
(class TFitResultPtr)388087728
root [2] inclusive->GetFunction(“pol2”)->GetChisquare()
(const Double_t)4.43972833953122631e+02
root [3] inclusive->GetFunction(“pol2”)->GetNDF()
(const Int_t)68
root [4] TF1 quad(“quad”,"[0]+[1]*x+[2]xx") root [5] inclusive->Fit(&quad,"","",0,12)
FCN=256.604 FROM MIGRAD STATUS=CONVERGED 119 CALLS 120 TOTAL
EDM=5.45661e-12 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 1.6 per cent
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 1.88907e+00 6.14419e-01 -5.63590e-04 5.75247e-06
2 p1 2.09063e+02 2.22679e-01 9.19823e-05 7.06696e-05
3 p2 7.76842e-01 2.09049e-02 -3.49074e-06 7.86289e-04
(class TFitResultPtr)359870512
root [7] quad.GetChisquare()
(const Double_t)2.56604196601923150e+02
root [8] quad.GetNDF()
(const Int_t)68

is this expected? Could it be that in one case the errors on the x coordinate are not taken into account and in the other case they are?

                                              Thanks and ciao

                                                   Andrea

p.s. the attached file contains the TGraphErrors
root_puzzle.root (9.14 KB)

Ciao Andrea,

I think you are using an old version of ROOT. With the latest one, you should get the same result.
In your case, when fitting with the “pol2” function automatically was switched on (by mistake) also the option “EX0”, i.e. neglect the errors in x. You can also see that when the errors in x are not considered, the fit is linear and Minuit is not used in that case.

Lorenzo