Does anyone know how to program a mathematica algorithm that does the same thing that FindFit
does? Is there documentation of it somewhere? I assume it is a least squares algorithm but with very generalized arguments. I ask because I'm trying to use 'weighted' least squares and it basically involves just one more factor.
$\begingroup$
$\endgroup$
1
1 Answer
$\begingroup$
$\endgroup$
3
Fit
works using singular value decomposition.FindFit
uses the same method for the linear least-squares case, the Levenberg–Marquardt method for nonlinear least-squares, and generalFindMinimum
methods for other norms.
NonlinearModelFit
allows fitting of weighted data, as J.M. commented
Edit:
The best fit parameters are a property of the model:
p = Table[Prime[x], {x, 20}];
nlm = NonlinearModelFit[p, a x Log[b + c x], {a, b, c}, x];
nlm["BestFitParameters"]
{a -> 1.42076, b -> 1.65558, c -> 0.534645}
-
$\begingroup$ How do I get the list parameters from NonlinearModel? FindFit outputs such a thing $\endgroup$ Commented Oct 31, 2015 at 16:56
-
-
$\begingroup$ @minus, it's all in the docs, if you'd look for them. $\endgroup$ Commented Nov 1, 2015 at 2:04
NonlinearModelFit[]
can handle weighted nonlinear least squares. $\endgroup$