Skip to content
Prev 206852 / 398503 Next

Predict polynomial problem

Charles C. Berry wrote:
Right. It might be worth pointing out that the 'i' in
environment(terms(m2)) or in environment(terms(m3)),
which also has an 'i', is there even if you use poly(x,j).
It is (if I'm not mistaken) the number of 'variables' in
the formula: response plus predictor terms. Thus

j <- 5
m4 <- lm(bquote(y ~ sqrt(x) + poly(x, .(j))), data=d)
environment(terms(m4))$i
[1] 3

  -Peter Ehlers