Error function fit

Hi rooters :wink:

I plotted the data in a TGraphError, then I used a linear fit… now I would like obtain the error function respect to the real points.
I know that I could do an iteration error=y-y’ (where y= real points, and y’= expected points) but I hope that there is a more faster function, also because the fit is done only in a specific range of data… can you help me?

Thanks a lot :slight_smile:


I am not sure I have understood exactly your question. What would you like to obtain, the error on the function value for each data point resulting from the fit ?

For this you can use the function FitResult::GetCOnfidenceIntervasl … ntervals@2

Best Regards


Hi Lorenzo,

Thanks for the reply, but what I want obtain is the mean squared error:

there is a function to obtain this parameter directly?

thanks :slight_smile:

I see, I guess you want just to have the residuals, the difference between the data point and the function values.

You might be interested in a new class, TRatioPlot, that can plot the residuals. You might also look at that class

Otherwise, there is no yet an automatic function to get this in ROOT. It is however trivial to loop on the data points and computing the difference with the function values.


HI Lorenzo,
Yes what I want is the mean residual between the real points and the expected points from the function fit… but I don’t want plot each residual values, I want only the mean value.

thanks :slight_smile: