TGraphAsymm x-Errors in pol fit?

Hello

I am trying to fit a TGraphAsymmErrors with a pol1 function.
Both x and y asymmetric uncertainties are needed.
It seems I get the same results no matter the x errors are large or small. The fit options “F” did not work.
Any help?
Thanks
Michela

You must use the “F” fitting option. See the TGraph::Fit description.
You could try to compare two cases: “F” and “F EX0”.

BTW. What do you mean when you say that the fit option “F” did not work. Without this option you should see (in your terminal window) the output from the “linear minimizer”, while with this option you should see the output from the “minuit minimizer” (they look completely different -> if you are using minuit2 then the output is similar to the “linear minimizer” case, but you should also see the name of the minimizer printed, either “Minimizer is Minuit2” or “Minimizer is Linear”).

Hello
thanks for your answer, I attach a simple example below. The results of the fit do not change,
no matter how large or small are the x-errors.
It seems the y-errors instead are taken into account.

{
c1 = new TCanvas(“c1”,"",200,10,700,500);
Int_t n = 3;
Double_t x[n] = { 0.35, 0.5, 1.61};
Double_t y[n] = {7.4,9,9.6};

Double_t xerr_low=2.05.;
Double_t xerr_high=2.05;

Double_t exl[n] = {.05,.051,err_low};
Double_t exh[n] = {.05,.05,err_high};

Double_t yerr_low=0.05.;
Double_t yerr_high=0.05;

Double_t eyl[n] = {.5,.4,yerr_low};
Double_t eyh[n] = {.3,.2,yerr_high};

gr = new TGraphAsymmErrors(n,x,y,exl,exh,eyl,eyh);
gr->SetMarkerColor(4);
gr->SetMarkerStyle(21);
gr->Draw(“AP”);
gr->Fit(“pol1”,“F”);
return c1;
}

Just for the record … your example runs fine in ROOT 5.18 (the last version I was using this feature with, some time ago), but it does not work in 5.28 nor 5.34 (tested now).
Something got ill between 5.18 and 5.28 then. I called the emergency and the doctor’s already on the way.

ok, I am using 5.34…
thanks!

Hi,

This is fixed now, in both trunk and 5.34 patches. The fit will consider the errors in x now and the option “EX0” will work correctly.