R-beta: Polynomials in lm/glm

Matthew R. Nelson
Fri, 15 Aug 1997 11:44:35 -0000

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
----------------------------------------------------------------------------