       Re: findfit or solve?

• To: mathgroup at smc.vnet.net
• Subject: [mg55029] Re: findfit or solve?
• From: Peter Pein <petsie at arcor.de>
• Date: Thu, 10 Mar 2005 05:24:28 -0500 (EST)
• References: <d0modp\$76l\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Tegla Bela wrote:

> Greetings to everybody,
>
> I have found a model and I would like to use Mathematica for the data under
> the model. The model is as follows:
>
> = h1 - ((2 * (h1 - hÎ¸)) / ((EXP(s0 * (t -Î¸))) + (EXP(s1 * (t -Î¸)))))
>
> data = {{6.968, 117.1}, {7.967, 123.3}, {9.046,
>       129.4}, {9.982, 134.6}, {10.951,
>        139.2}, {11.973, 145.2}, {13.021, 151.1}, {13.892, 159.9}, {
>       14.888, 167.8}, {15.858, 171.9}, {16.857, 175.7}, {17.854, 177.2}, {
>       18.724, 175.6}};
>
> I have managed to do it with nonlinear least-square fitting in other
> program. But not working for me in Mathematica. (I do not know how to give
> initial values to have the five unknown parameters estimated) These are the
> initial values that I would like to use: a=176, b=160, c=0.1, d=14, e=1.2
> (t is the age, first value in each pair of the data)
>
> Does anybody have idea how it can be done? Any help is appreciated.
>
> Spiller
>
> _________________________________________________________________
> æ?¥æ?¬å?½å??æ??å¤§ç´?570ä¸?ã?¦ã?¼ã?¶ã?¼ã?®MSN Hotmail
> https://registernet.passport.net/reg.srf?id=2&lc=1041
>

NonlinearFit[data, h1 - (2*(h1 - h\[Theta]))/(E^(s0*(t - \[Theta])) +
E^(s1*(t - \[Theta]))), {t},
{h1, h\[Theta], s0, s1, \[Theta]}]
Out=
151.3846153846154 - 111410.8547029138/
(E^(-14.335393999263037*(-115.43433836614763 + t)) +
E^(-14.335393999252005*(-115.43433836614763 + t)))

which is an extremely bad approximation. In the range of your data, this
is Mean[Last/@data]+Interval[{2.87121*1^0-671, 4.45004*10^-598}]

But if I help Mathematica by feeding it with some start values, I get

modl = NonlinearFit[data,
h1 - (2*(h1 - h\[Theta]))/(E^(s0*(t - \[Theta])) + E^(s1*(t -
\[Theta]))), {t},  {{h1, 175}, {h\[Theta], 160}, {s0, 1}, {s1, 0.1},
{\[Theta], 15}}]

==>
176.5881087074734 - 26.129646337226745/
(E^(0.11114476528689875*(-14.376501386067005 + t)) +
E^(1.1865954467323878*(-14.376501386067005 + t)))

To have a look at the result:

Show[Block[{\$DisplayFunction = #1 & }, {Plot[modl, {t, 6, 19}],
ListPlot[data, PlotStyle -> {Red, PointSize[0.02]}]}]];

--
Peter Pein
Berlin

```

• Prev by Date: Re: symbolic approximation (formular manipulation)
• Next by Date: Determinant problem
• Previous by thread: Re: findfit or solve?
• Next by thread: Re: findfit or solve?