Dear root and statistics experts,
I tried to analyze the code behind the function GetConfidenceIntervals in TFitter.cxx .

I fitted data in TGraphErrors with a function like [0]+[1]Log10(X) and I’d like to get the associated confidence intervals for a 0.95 cl. So I used the function GetConfidenceIntervals and I got the result.
OK…my question (probably trivial!) is the following: why in the code of the file TFitter.cxx the result is multiplied (and not divided?!) by a factor TMath::Sqrt(f->GetChisquare())?

Thank you very much


The formula is correct, see for example … derivation


I don’t want to state the the formula is incorrect but I’m only trying to figure out why it is needed a factor TMath::Sqrt(f->GetChisquare)…
My point is the following: in the Brandt’s statistics book, using the mean least square method, I guess to get a c.i. = TMath::Sqrt© * tStudentQauntile / TMath::Sqrt(ndof) where “c” is the error propagation from the parameters of the fit taking into account the cov value…

Introducing a factor TMath::Sqrt(f->GetChisquare) is due to the fact that I’m minimizing using a ChiSquare function (which takes into account uncertainties associated with my experimental value)? if so, where can I find a reference for this procedure? I couldn’t be able to find out explicitely the TMath::Sqrt(f->GetChisquare) factor in the wiki reference…

At this point I tried to explain my real point: what I’d like to make is getting the c.i. associated with a fit (using TMinuit2) of a TGraphAsymmErrors. Now, in the “root” code, the asymmetric errors bars are selectively chosen and symmetrized (because we need a normal error distribution). At this point, using the symmetrized error bars, I should be able to associate a c.i., but “root” states that I need to use a TGraphErrors (where errors bars are symmetric)…
There is something I’m missing …

Thank very much


This normalization is needed in case no errors are provided (e.g. when doing a TGraph::Fit).
It is the last formula of … al_example.
It is maybe true that sometimes is not desired, when the user provide reliable error at each fit point.
I could introduce an option to not do this multiplication.

I don;t understand your last point. You should be able to get a fit C.I. from a TGraphAsymErrors, but it will be symmetrized.


Thank you for your answer!

First point:

  • I made a fit for a TGraphErrors where I provide reliable error at each point.
  • Then I’d like to get the associated c.i. .
    If I understand correctly, the “root” c.i. are function of the sqrt(Chisquare), while this factor is not included in the “standard” wiki formula…isn’t it?
    Therefore, if I got a Chisquare value <<1 or >>1, then the c.i. will change…even if data values are the same

Last point:

  • I’d like to get the c.i. for a TGraphAsymmErrors
  • I fitted a TGraphAsymmErrors, and it will be symmetrized
  • g1 is a TGraphAsymmErrors
  • I got this error

The object you pass in GetConfidenceIntervals is the one that contains the confidence level result. It is not the object you are fitting. You must do:

TGraphErrors * ge = new TGraphErrors(npoint);

and ge will contain the CL result that you can draw on top of your fitted graph. npoint is the n umber of points you want to evaluate your CL curve. It does not need to be equal to the number of fitted points.
See also tutorials/fit/ConfidenceIntervals.C


Ok! Now the last point is clear!

what about first point?

Yes, as I said before, in ROOT the C.I. values depend of the fitted Chi2 result (as also in the wikipedia reference).
This implies that with the same data point values, but by changing all the errors by a scaling factor A, your C.I will be changed by the same scaling factor.


I created a small example where the confidence intervals remain the same with FactorScale = 1 or = 3.

Is this “physically” correct?

test1.C (1.22 KB)


This sentence is wrong, sorry !
If the errors are scaled the chi2 will be scaled too and the C.I. will stay the same !

I agree that this is maybe not the wanted behavior in some cases, especially when one has reliable error estimates. It is anyway a debatable issue. As I said, the best is to add an option in the routine

Best Regards


Sorry to resurrect this very old thread.
I was wondering if such option has been implemented or if there is a recommended workaround, as I am not able to find anything about it in the TFitter documentation.
Many thanks!