Question on LinearFitter + multidimensionnal interpolation

Hello,

I have looked in the LinearFitter code how the errors on parameters are calculated but I couldn’t find it. I’ve also digged into the ROOT documentation but nothing as well.

Could someone tell me how the errors are calculated?

A disconnected question: I want to do a multidimensionnal interpolation, say I have a variable V that I want to have as a function of x, y and z. I have values of V at the grid points (xi, yj, zk) and I would like a smooth distribution. For this, a sort of cubic spline is what I would to use for the interpolation. I’ve seen (and tested) some tools for one dimension interpolation (in ROOT::Math) but not more.

Are you aware of existing tools or would I have to do it almost from scratch?

Cheers,
Adlene.

Hi,

As you probably know the solution in the linear fitter is found by solving a linear system, see for example:
mathworld.wolfram.com/LeastSquar … omial.html

The error on the parameters can then be obtained from the inversion of the associated fitting matrix. The inverse of the matrix represents the correlation matrix of the parameters.
But I agree with you, we should describe in more detail the algorithm in the ROOT documentation.

For the multi-dimensional interpolation we have in ROOT only something in 2D, for interpolating X,Y points in Z values using Delaunay triangles.
See the documentation for TGraph2D

root.cern.ch/root/htmldoc/TGraph … escription

We are thinking to add in the future releases the support for multidimensional splines.

Best Regards

Lorenzo

Hi,

Thanks for your answer.

The correct link for the polynomial fit is:

mathworld.wolfram.com/LeastSquar … omial.html

So you confirm that you’re using the inverse of the second order chi2 derivatives matrix to get the errors.

I assume that you also take into account the fact that when the user gives errors on the y coordinate, you have to rescale all the terms by 1/(sigma_i)^2 but apart from that the general form of the matrix stays the same.

I understand that the LinearFitter is not just a Least Square Fitter but can work as a chi2 fitter as well (with weights).

As for the interpolation, the problem is that even with the available “default tool” in TGraph2D, one cannot access the interpolation coefficients which are the most valuable information to store (for future reuse).

I’ve seen the same problem with ROOT::Math interpolator where one can ask for values of the interpolated spline, or integrals or derivatives but no access to the interpolated coefficients.

This means each time I want to run a code needing values of the smoothed function at some points, I need to redo an interpolation.

This may be fine for simple cases (1D) but what about complicated, time consuming interpolations (3D, a lot of data points, etc…)?

So for the future developpments, I would suggest to make available the coefficients as well.

Regards,

Adlene.

Hi ,

thank you for fixing the link.
Yes, the linear fit correctly treats the errors in y, by scaling the matrix. You can also fit weighted data if the data errors are still normal distributed.

For interpolation, in the case of the ROOT::Math::Interpolator the coefficients are stored internally in an state ( a C structure in GSL).
Every time you call Inperpolator::Eval(), the function is evaluates using the stored coefficients, and it is not re-done a new interpolation.

Best Regards,

Lorenzo