How can I made a non linear regression in ROOT?

Hello everyone

I’m trying to fitting data making a non linear regression.
I have three variables and a constant.
Q,K,Y and So.
The data I know are Q,Y and So.
The result of the regression should be this.
Q=K * (Y^a) * (So^b)
How can I fit the K, a and b parameters using a non linear regression with known data? Coding in ROOT. Does it exist an specific library or something?

Thanks a lot

I guess @moneta can help you


If you have a data set consisting of (So,Y, Q) data, where the predictors are Y and So and the depended variable Q , the simplest way in ROOT is to create a TGra2D class with (x,y) = (Y,So) and z = Q and you fit with a TF2 created with 3 parameters.
TF2 * f2 = new TF2(“f2”,"[K] * (x^[a]) * (y^[b])")

and then you can call TGraph2D::Fit.

An example is

Best Regards


Thank you so much

It was very helpful to me. It works excellent.


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