       Re: specifying further options to NMinimize method when using NonlinearModelFit

• To: mathgroup at smc.vnet.net
• Subject: [mg117729] Re: specifying further options to NMinimize method when using NonlinearModelFit
• From: Peter Pein <petsie at dordos.net>
• Date: Wed, 30 Mar 2011 04:15:09 -0500 (EST)
• References: <imshd3\$5pa\$1@smc.vnet.net>

```Am 29.03.2011 13:56, schrieb Alex Gittens:
> I'm using NonlinearModelFit to fit a model with UnitStep statements in it, so my only option seems to be to use the NMinimize method (judging from the errors I get, all the other options seem to need symbolic gradient information).
>
> The results are poor, so I'd like to specify that NonlinearModelFit use NMinimize with the Differential Evolution method. How do I go about doing that?
>
Hi Alex,

are you sure that NlMFit uses NMinimize? I constructed a hard-to-fit
example and tried to set different methods for NMinimize; to no avail:

In:= data=Table[{x,Exp[-x]+.1Sin[Pi x]},{x,0,1,1/50}]//N;
In:= model=a+b/(x+c);
In:=
Table[SetOptions[NMinimize,Method->met];NonlinearModelFit[data,model,{a,b,c},x]//Normal,{met,{Automatic,
"SimulatedAnnealing"}}]

... some warnings (each the same) ...

Out= {
-7.50222+108.153/(12.7003 +x),
-7.50222+108.153/(12.7003 +x),
-7.50222+108.153/(12.7003 +x),
-7.50222+108.153/(12.7003 +x),
-7.50222+108.153/(12.7003 +x)}

I see no difference, do you?

Hmm... an Option Method is not documented for NlMFit under "Options".
But who will give up as soon? Using Method->"foo" will give the possible
valuses for NlMNFit:

using

In:= Table[
NonlinearModelFit[data, model, {a, b, c}, x, Method -> met] //
"InteriorPoint", "QuasiNewton", "Newton", "NMinimize",
"LevenbergMarquardt"}}]

...some warnings ...

Out= {
-7.50222 + 108.153/(12.7003 + x),
-3.58119 + 29.3825/( 6.38402 + x),
-1.13263 + 5.36751/(2.46604 + x),
2.02043 - 172.578/(129.759 + x),
-3.16362 + 24.1187/(5.76332 + x),
-5.39831 + 59.8129/(9.32438 + x),
-15.3664 + 414.781/(25.3272 + x),
-7.50222 + 108.153/(12.7003 + x)}

gives us a broader range to choose of :-)