Re: A Problem with the NonlinearFit?
- To: mathgroup at smc.vnet.net
- Subject: [mg61765] Re: A Problem with the NonlinearFit?
- From: Antti Penttil <Antti.I.Penttila at helsinki.fi.removethis>
- Date: Sat, 29 Oct 2005 01:32:33 -0400 (EDT)
- Organization: University of Helsinki
- References: <djskuf$8p2$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Dear Axel,
There's a different error that is minimized in nonlinear fit for cases A and B. For A, we minimize the sum of
A) (y - a exp(-b x))^2
where as in B
B) (ln(y) - ln(a exp(-b x)))^2 = (ln(y / (a exp(-b x)))^2
The idea of data conversions is to have errors that are homoskedastic and normally distributed, which is much more true with B.
Yours,
Antti
Axel Ligon wrote:
> Deas Sirs,
>
> concerning the NonlinearFit procedure I have a problem. I used the
> following inputs:
>
> A)
> *Raw datas {x, y}*
> dat1={{0,319.9},{1,196.7},{3,140.2},{7,99.0},{14,56.1},{31,32.8},{90,1.9}}
> FindFit[dat1,a*Exp[-b*x],{a,b},x]
>
> a ->280.376, b->0.175479
>
> <<Statistics`NonlinearFit`
> f=NonlinearFit[dat1,a*Exp[-b*x],x,{a,b}]
>
> 280.376 * Exp(-0.175479x)
>
> B)
> *Convert datas {x, ln[y]}*
> dat2={{0,5.7680},{1,5.2817},{3,4.9430},{7,4.5951},{14,4.0271},{31,3.4904},{90, 0.6419}}
> FindFit[dat2,-b*x+a,{a,b},x]
>
> a->5.18756, b->0.0518199
>
> <<Statistics`NonlinearFit`
> f=NonlinearFit[dat2,-b*x+a,x,{a,b}]
>
> 5.18756 - 0.0518199 x
>
> The difference between A) and B) is only the conversion of y to ln[y]
> and the equation y = a * exp(-b*x) to ln[y] = ln[a] - b*x. From this
> it follows that a = exp[ln[a]].
> But I get in A) 280.376 / -0.175479 and in B) 179.031 / -0.05182 !!
> Why do I get these error?? If I use Excel, I don't get these errors.
> Is it an error in the programming of Mathematica, or not???
>
> I'd be glad if you could help me.
>
> With best regards
>
> Axel Ligon
>
>
--
Antti Penttilä Antti.I.Penttila at helsinki.fi.removethis
Researcher Observatory
tel. +358 50 5240968 00014 University of Helsinki