       Re: specifying further options to NMinimize method when using NonlinearModelFit

• To: mathgroup at smc.vnet.net
• Subject: [mg117777] Re: specifying further options to NMinimize method when using NonlinearModelFit
• From: Darren Glosemeyer <darreng at wolfram.com>
• Date: Thu, 31 Mar 2011 04:01:34 -0500 (EST)

```On 3/30/2011 4:15 AM, Peter Pein wrote:
> 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 :-)
>
> Whatever fits your needs best...
>
> Peter
>

The version 8 docs for NonlinearModelFit now state:

"LevenbergMarquardt", "Newton", "NMinimize", and "QuasiNewton", with the
default being Automatic."

That note was absent in version 7, though, so perhaps you were looking
in the version 7 docs.

It does not use NMinimize by default, but use of NMinimize can be set
optionally. Options to NMinimize can be passed in as suboptions to the
Method option, e.g.

NonlinearModelFit[data, model, {a, b, c}, x,  Method -> {"NMinimize",
Method -> "DifferentialEvolution"}]

I seem to recall that there were some issues with processing when Method
was set to "NMinimize" in version 7, but those should all be
straightened out in version 8.

Darren Glosemeyer
Wolfram Research

```

• Prev by Date: Re: Filling Plots to the X-Axis for a Range of X Values
• Next by Date: Re: Mathematica 6.0.1 nb working, but not on Mathematica 8.0.1.
• Previous by thread: Re: specifying further options to NMinimize method when using NonlinearModelFit
• Next by thread: Capture values that Min(imize)