poly.transform(polymat, coefs, intercept=T)
The reason to use poly is that the regression can become ill-conditioned (hence inaccurate) when the straightforward approach is used.
price <- freeny.x[,"price index"] price.poly <- poly(price, 3) price.reg <- lm(freeny.y ~ price.poly) coef(price.reg) # coefficients for orthogonal form# coefficients for simple form poly.transform(price.poly, coef(price.reg))
# logically the same thing, though computationally inferior coef(lm(freeny.y ~ price + price^2 + price^3))