Default algorithm in NonlinearModelFit

Does anyone know the default algorithm used in NonlinearModelFit? The documentation gives several possible algorithms, but I can't figure out what it uses if you do not specify the algorithm.

Thanks.

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. Feb 8, 2015 at 23:25
• The Answer to 21823 has some information. Feb 9, 2015 at 0:08

With Method -> Automatic, the Wolfram Language uses the quasi-Newton method unless the problem is structurally a sum of squares, in which case the Levenberg-Marquardt variant of the Gauss-Newton method is used.

To confirm, I use the first example in FindFit >> Options >> Method and compare the output for various settings for the Method option:

Possible settings for Method include "ConjugateGradient", "Gradient", "LevenbergMarquardt", "Newton", "NMinimize", and "QuasiNewton", with the default being Automatic.

model = a Exp[-b (x - c)^2] + d Sin[ω x + ϕ];
data = Table[{x, model /. {a -> 2, b -> 1, c -> 0, d -> 2, ω -> 0.67, ϕ -> 0.1}},
{x, -5, 5, .1}] + RandomReal[.25, 101];

"Newton", "NMinimize", "QuasiNewton"};

nlms = Quiet@ NonlinearModelFit[data, model, {a, b, c, d, ω, ϕ}, x,
Method -> #]["ParameterTable"] & /@ methods;
Grid[Partition[Labeled[#, #2, Top] & @@@ Transpose[{nlms, methods}], 3], Spacings -> {5, 5}]

• Perfect! Thank you so much. Feb 9, 2015 at 14:33
• @user3037237, my pleasure. Welcome to mma.se.
– kglr
Feb 9, 2015 at 15:34
• How to tell if Mathematica thinks your problem is a sum of squares? is there anyway to query the fit to ask what it used? Oct 12, 2018 at 2:31
• @TomMozdzen, good question. I don't know the answer ottomh.
– kglr
Oct 12, 2018 at 7:03
• @kglr I suppose I could use your code above and substitute my fitting equation and a sample data set and compare outputs as you have done above. Finding out should be a single simple command I would think. Do you know where the various methods are documented? I haven't found the page where they give you the full list of options. Oct 12, 2018 at 7:23