Which is the error got by TFitResultPtr::ParError(int i)?

Hello everybody,

I would like to ask you,

when one does a fit by using a TFitResultPtr object, in default mode (minimizing chi2),
which is the error got by using the function
ParError? standard error? residual error?

I have calculated the same fit in mathematica and have got the same parameters’ values.
But the Mathematica standard errors are three orders of magnitude greater than the ones calculated by ROOT.
The same comment go for the covariance matrix…

Would anyone help me?

Hi,

The errors are the standard errors on the estimated parameters using a normal approximation, thus they are deduced directly from the inverse of the second derivative matrix at the minimum point (covariance matrix).
A possible reason of the difference is that in Mathematica the errors are maybe corrected by using the minimum least square value, while in ROOT this is not done by default

Best Regards

Lorenzo

Thanks Lorenzo,

I am confused. In the line 1204 of the file
$ROOTSYS/hist/hist/src/TGraph.cxx
says:
1204 // 3) The standard chi2 (least square) method without error in the coordinates (x) can
1205 // be forced by using option “EX0”
In the lines above I understand that chi2 fit option implies least square. However in the same document
I did find
1211 // 5) When fitting a TGraph (i.e. no errors associated with each point),
1212 // a correction is applied to the errors on the parameters with the following
1213 // formula:
1214 // errorp *= sqrt(chisquare/(ndf-1))

and I have confirmed that my errors are normalized by using the function
TFitResultPtr::NormalizedErrors() and throws true.

I am attaching the ROOT output in forum.txt, and the Mathematica prompts in Pantallazo (2).png.

So I’ve tried the unnormalization procedure and the results of ROOT and Mathematica don’t coincide.
But I guess that the chisquare is the chisquare of the parameter and not the global chisquare…
Do you know which file I can read in order to know what is ROOT doing?
I did read
HFitImpl.cxx
TH1.cxx
TGraphErrors.cxx
and I couldn’t find anything.

On the other hand, I also would like to ask if
Do you know how to retrieve the coefficient of determination R^2 in ROOT?

Thanks again!



forum.txt (10.1 KB)

Hi,

If you are fitting a TGraph (i.e. without errors) the errors are normalized, otherwise not. The chi2 value is the
weighted (by the inverse of the error square) square sum of the residuals.
I don’t understand the output of Mathematica, what did you run there ?

The implementation of the fitting is in HFItImpl.cxx for setting the options and driving the Fitter class and in
math/mathcore/src/FitUtil.cxx you find the implementation of the Chi2 evaluation function.

Lorenzo