       Re: FindFit

• To: mathgroup at smc.vnet.net
• Subject: [mg62568] Re: FindFit
• Date: Mon, 28 Nov 2005 00:58:02 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

On 11/27/05 at 2:40 AM, dto_mba at skynet.be (Montgrimpulo) wrote:

>t={{1,1},{2,1},{3,2},{4,2},{5,4},{6,2},{7,6},{8,4},{9,6},{10,4},{11
>,10}}

>f=a+b*x+c*x^2

>FindFit[t, f, {a, b, c}, {x}]

>Out[] {a -> 0.969697, b -> 0.108392, c -> 0.0477855}

>So far so good. Now, I want to use a different metric in FindFit.
>However, I'm in doubt if my use of the option "NormFunction" in
>FindFit is correct.

>nf[x_] := Max[Abs[x]]

>FindFit[t, f, {a, b, c}, {x}, NormFunction -> nf]

>Out[] "The model a+b*x+c*x^2 is linear in the parameters {a, b, c},
>but a nonlinear method or non-Euclidean norm was specified, so
>nonlinear methods will be used. "

>Out[] The line search decreased the step size to within tolerance
>specified by \AccuracyGoal and PrecisionGoal but was unable to find
>a sufficient decrease \in the norm of the residual.  You may need
>more than MachinePrecision digits \of working precision to meet
>these tolerances.

>Out []{a -> 0.988004, b -> 0.890595, c -> -0.0325868}

You could avoid the second warning message by using Norm to specify the norm function, i.e.,

FindFit[t, f, {a, b, c}, x, NormFunction -> (Norm[#, Infinity]&)]

Of course since this doesn't change the minimization method, starting points or norm to be minimized, this results in the same solution

Out[]= {a -> 0.988004, b -> 0.890595, c -> -0.0325868}

>If I use NMinimize instead, I get with

>d := t[[All, 2]] - Table[(f /. x -> t[[i, 1]]), {i, 1, Length[t]}]
>and

>NMinimize[Max[Abs[d]],{a,b,c}]

>Out [] {2.42413, {a -> 0.470545, b -> 0.089553, c -> 0.0505806}}

>as a result.

>As the preparatory work to use FindFit is less than for NMinimize
>and as NMinimize is slowes down drastically with increasing number
>of points (also for NelderMead), I would like to get some hints to
>improve the result from FindFit. Working with a higher
>MachinePrecision did not lead to any improvements.

You might try changing the minimization method being used. But if the norm function is relatively flat in the neighborhood of the optimum solution, changing the minimization method isn't likely to help much.

You also might try specifying a starting point, but this too won't do much when the norm is relatively flat near the optimum solution.
--
To reply via email subtract one hundred and four



• Prev by Date: Re: Making a phase plot
• Next by Date: Re: Re: Re: NSolve Vs. Elliptic Integral
• Previous by thread: Re: FindFit
• Next by thread: Package development