Re: R-beta: Polynomials in lm/glm

Peter Dalgaard BSA (
15 Aug 1997 15:17:58 +0200

To: "Matthew R. Nelson" <>
Subject: Re: R-beta: Polynomials in lm/glm
From: Peter Dalgaard BSA <>
Date: 15 Aug 1997 15:17:58 +0200
In-Reply-To: "Matthew R. Nelson"'s message of Fri, 15 Aug 1997 07:44:35 -0400 (EDT)

"Matthew R. Nelson" <> writes:

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

I(x^2) should work. We've discussed previously, whether x^2 should do
what you expect, and as far as I remember the consensus was positive.

In general, one cannot expect to be able to do computations in model
formulas (think of autoflu~onset+duration != autoflu~age).

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (             FAX: (+45) 35327907
r-help mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: