R-beta: Polynomials in lm/glm

Matthew R. Nelson mrn at superh.hg.med.umich.edu
Fri Aug 15 13:44:35 CEST 1997


R users,

I was a bit surprised to find that when I attempted to add a polynomial 
term to a linear model using either lm or glm as could be done in S 
resulted in a fit without that term included and without warning(!!), e.g.

> lm(response ~ x + x^2, data).

As far as I can gather, there is no poly() yet in R, and if lm/glm do not 
allow functions of variables as their formula arguements, is our only 
option to add variables to our dataframe before using lm/glm?

> data2 <- cbind(data,x2=data$x^2)

I did search the archive for a discussion of this topic, but did not come 
up with any discussion on this topic.  Have I missed something?  

BTW:  Version 0.50 Alpha-1 (July 22, 1997)

Thanks for any help,

Matt
----------------------------------------------------------------------------
Matthew R. Nelson
Dept. of Human Genetics         
University of Michigan              http://www-personal.umich.edu/~ticul/
4711 Medical Science II             email: ticul at umich.edu
Ann Arbor, MI  48109-0618           phone: (313) 647-3151
----------------------------------------------------------------------------


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the R-help mailing list