Message Boards Message Boards

1 Reply
1 Total Likes
View groups...
Share this post:

How does one fit a several variable equation using nonlinear least squares?

I want to fit a curve to data using non linear least squares with matrix inversion

Right now I'm using this, but I'm not sure what algorithm it is using, but I suspect it may not be using non-linear least squares.

z4 = NonlinearModelFit[spectra, a (x + 99)^-2.5 + b (x + 99)^-1.5 + c (x + 99)^-0.5 + d (x + 99)^0.5, {a, b, c, d}, x];

I've tried the "Method -> Option" , but I can't find an option that says nonlinear least squares (regular least squares only allows 2 variables).

I could use some help figuring out what Mathematica is doing and how to get it to using matrix inversion so that I can get a covarience matrix for the fit and not use a method where iterations are done to find the best coefficients.

Thanks in advance, Tom

POSTED BY: Tom Mozdzen
Posted 9 years ago

The tutorial StatisticalModelAnalysis found in the documentation for NonlinearModelFit states that it will "construct a nonlinear least-squares model". So it is doing least squares with an additive error. You can also use weights with the Weights option.

This link ( states that the possible settings for Method include "ConjugateGradient", "Gradient", "LevenbergMarquardt", "Newton", "NMinimize", and "QuasiNewton" (for Mathematica 8.1). These names would lead me to believe that "Method" has to do with HOW the mean square error is minimized as opposed to WHAT is minimized.

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract