# TGraphAsymmErrors fitting question

How are fits handled to asymmetric errors. For example…

void test() {

Double_t x = {1,2,3};
Double_t y = {5,3,2};
Double_t exlow = {0,0,0};
Double_t exhigh = {0,0,0};
Double_t eylow = {1,0.4,0.75};
Double_t eyhigh = {2.,3.,2.5};

TGraphAsymmErrors *gr = new TGraphAsymmErrors(3,x,y,exlow,exhigh,eylow,eyhigh);
gr->SetMarkerStyle(24);
gr->Draw(“AP”);
gr->Fit(“pol1”);
}

are both the high and low errors considered?

Thanks

see function “GraphFitChisquare” at
root.cern.ch/root/htmldoc/src/TFitter.cxx.html

Rene

It seems to me that this code takes care of the different x-errors in the following fashion, taken from TFitter.cxx, but not the different y-errors:

// The chisquare is computed as the sum of the quantity below at each point:
//
// (y - f(x))2
// -----------------------------------
// ey
2 + (0.5*(exl + exh)*f’(x))**2
//
// where x and y are the point coordinates and f’(x) is the derivative of function f(x).
// This method to approximate the uncertainty in y because of the errors in x, is called
// “effective variance” method.
// The improvement, compared to the previously used method (f(x+ exhigh) - f(x-exlow))/2
// is of (error of x)**2 order.
//
// In case the function lies below (above) the data point, ey is ey_low (ey_high).

I don’t see how ey_low and ey_high are handled separately in calculating the chi square, unless I interpret the last sentence as it using either ey_low or ey_high depending upon where the function lies with respect to the data point. Is that how it works?

In principle, when you perform a chi2 fit to your data you cannot have asymmetric errors, since the chi2 formula is valid ONLY in the approximation that your data are normal distributed.

Therefore when you have asymmetric errors you have to make some assumptions, like is done in GraphFitChisquare.

Lorenzo