[R] power function fitting
Bernardo Rangel Tura
tura at centroin.com.br
Mon Nov 5 19:32:14 CET 2007
On Mon, 2007-11-05 at 17:50 +0100, Duccio - wrote:
> I would like to fit a power model of type:
> y=b*x(^z)
> to my data (having y as the response and x as the predictor variables).
> I could not use linear models like y~x since R should estimate the parameter
> z and not only the coefficient b.
> Thus I need a package and a function! Any suggestions?
> Thanks
> Duccio
Ducio
I think two solutions:
1- log(y)=log(b*x^z)=log(b)+z*log(x)
In this case lm(log(y)~log(x) ) solve your problem
2- use nls
nls(y~b*x^z,start = list(b = 0, z = 1),data=your database)
--
Bernardo Rangel Tura, M.D,Ph.D
National Institute of Cardiology
Brazil
More information about the R-help
mailing list