Re: [R] nls: different results if applied to normal or linearized data

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed, 05 Mar 2008 15:47:28 +0000 (GMT)

On Wed, 5 Mar 2008, Wolfgang Waser wrote:

> Dear all,
>
> I did a non-linear least square model fit
>
> y ~ a * x^b
>
> (a) > nls(y ~ a * x^b, start=list(a=1,b=1))
>
> to obtain the coefficients a & b.
>
> I did the same with the linearized formula, including a linear model
>
> log(y) ~ log(a) + b * log(x)
>
> (b) > nls(log10(y) ~ log10(a) + b*log10(x), start=list(a=1,b=1))
> (c) > lm(log10(y) ~ log10(x))
>
> I expected coefficient b to be identical for all three cases. Hoever, using my
> dataset, coefficient b was:
> (a) 0.912
> (b) 0.9794
> (c) 0.9794
>
> Coefficient a also varied between option (a) and (b), 107.2 and 94.7,
> respectively.
>
> Is this supposed to happen? Which is the correct coefficient b?

Yes. You are fitting by least-squares on two different scales: differences in y and differences in log(y) are not comparable.

Both are correct solutions to different problems. Since we have no idea what 'x' and 'y' are, we cannot even guess which is more appropriate in your context.

>
>
> Regards,
>
> Wolfgang
>
> --
> Laboratory of Animal Physiology
> Department of Biology
> University of Turku
> FIN-20014 Turku
> Finland
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 05 Mar 2008 - 15:50:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 06 Mar 2008 - 09:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive