R-beta: Polynomials in lm/glm
Peter Dalgaard BSA
p.dalgaard at kubism.ku.dk
Fri Aug 15 15:17:58 CEST 1997
"Matthew R. Nelson" <mrn at superh.hg.med.umich.edu> 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
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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