[R] Using lm with quadratic term

Liaw, Andy andy_liaw at merck.com
Thu Jan 20 03:42:46 CET 2005


I'd suggest that you read
http://cran.r-project.org/doc/manuals/R-intro.html#Formulae-for-statistical-
models  before proceeding.  It will help a lot, really.

Andy

> From: K Fernandes
> 
> Hello,
> I would like to use lm to model the equation y=x^2.
> 
> However, when I use
> 
> z<-lm(formula=y~x^2)
> summary(z)
> 
> I obtain results that are equivalent to when I use 
> 
> z<-lm(formula=y~x)
> summary(z)
> 
> That is, using x instead of x^2.
> 
> However, I do get different results when I use
> 
> z<-lm(formula=y~log(x))
> summary(z)
> 
> Does anyone know why this might be the case?  Any ideas are 
> appreciated.
> 
> Thank you,
> K
> 
> ______________________________________________
> 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
> 
>




More information about the R-help mailing list