[R] adjusting a power model in R

Greg Snow Greg.Snow at intermountainmail.org
Mon Apr 16 18:20:55 CEST 2007


Depending on the assumptions you make about the error sturcture of your
model there are a couple of options:

1). Use transformations and lm (assumes lognormal multiplicitive
errors):

> fit <- lm( log(Y) ~ log(X) )

This finds log(bo) and b1

2). Use nonlinear least squares (assumes normal additive errors), look
at ?nls

3). Use more general algorithms, look at ?optim or maybe even the BRugs
package.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Milton 
> Cezar Ribeiro
> Sent: Sunday, April 15, 2007 8:23 PM
> To: R-help
> Subject: [R] adjusting a power model in R
> 
> Dear R-gurus,
> 
> How can I fit a power model in R? I would like adjust Y = 
> b0*X^b1 or something like. 
> 
> Kind regards,
> 
> Miltinho
> Brazil.
> 
> __________________________________________________
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list