
Maybe a stupid question, but I failed to find an answer:
Is there a way in Math.NEt to best fit some polynomial function (even linear) to a set of x,y, pair values?
Something similar to this feature: http://metanumerics.codeplex.com/wikipage?title=DataSet&referringTitle=Documentation


Coordinator
Mar 24, 2011 at 8:18 PM
Edited Mar 24, 2011 at 8:20 PM

Hi,
I think we need to separate two cases here:
 Interpolation & Extrapolation: exact fitting, i.e. the curve goes exactly through the provided sample points. Degree of freedom corresponds to the number of sample points.
 Regression: optimal yet not exact fitting according to some metric (e.g. least squares). Degree of freedom often very small, much smaller than the number of sample points.
We do support interpolation to polynomial and rational functions as well as various splines. However, the implementation is targetting the scenario where you want to evaluate the interpolated curve at arbitrary points and not just to compute
the coefficients/parameters of the curve (the reason is that this is often much more numerically stable), even though some algorithms support computing the coefficients if needed.
However, we do not provide a nice frontend for regression
comparable to that of Meta.Numerics yet.
Nevertheless, if the curve you'd like to fit to is linear, i.e. something like
x > a0 + a1*f1(x) + a2*f2(x) + a3*f3(x)
Where f1, f2, f3 are arbitrary (can be nonlinear) known functions of x and you'd like to find the best fitting (least squares) coefficients a0, a1, a2, a3, then you can solve that easily using our linear algebra classes. I can provide a sample if you're
interested.
If it is nonlinear, the Levenberg–Marquardt algorithm might help; again using our linear algebra classes.
Thanks,
Chris



Hello Chris,
Thanks for your prompt reply. Actually the second case is of my interrest and I would like to fit something as simple as
x> a0 +a1x
or
x> a0 +a1x +a2x^2
to a set of N points using regression with the RMSE or MAE error as a criteria,.(or any other similar).
I am very interrested, so if you can provide a sample i would be really glad.
With best regards
Jan

