FindFit
- To: mathgroup at smc.vnet.net
- Subject: [mg62540] FindFit
- From: Montgrimpulo <dto_mba at skynet.be>
- Date: Sun, 27 Nov 2005 02:40:47 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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}
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.
Best,
Montgrimpulo