1
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ NonlinearModelFit[] can handle weighted nonlinear least squares. $\endgroup$ – J. M. will be back soon Oct 31 '15 at 14:04
4
$\begingroup$

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 general FindMinimum methods for other norms.

- source

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}
$\endgroup$
  • $\begingroup$ How do I get the list parameters from NonlinearModel? FindFit outputs such a thing $\endgroup$ – minusatwelfth Oct 31 '15 at 16:56
  • $\begingroup$ @minusatwelfth see my edit. $\endgroup$ – paw Oct 31 '15 at 17:12
  • $\begingroup$ @minus, it's all in the docs, if you'd look for them. $\endgroup$ – J. M. will be back soon Nov 1 '15 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.