Weighted inverse variance fit

Hello,

I want to fit a TGraph object and I want to use an inverse variance weighting. How can I give a certain weight to an individual point in a TGraph object and what input do I need to give to the Fit() expression?

Thank you all in advance,
Felix

Hi Felix,

If you mean by fitting using inverse variance weighting like in chi^2 fit, then have a look at fitLinear.C

-Eddy

I am not sure if this solves the problem. Essentially, I have data points with large errors and I would like these points to carry less weight compared to points with smaller errors. I don’t quite see how this is done in fitLinear.C! I was hoping to find more like a function that works like:

graph->SetPointWeight(I, weight[i]);

where weight[I] could be defined as

double weight[i] = 1.0/ pow(err_y[i],2);

where of course err_y corresponds to the errors of the datapoint i.

Does this explain my problem better?

Regards,
Felix

The following line of the example implements this:

   TGraphErrors *gre3 = new TGraphErrors(n, x, y, 0, e);

Here the TGraphErrors constructor is called with x, y and error in y.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.