poly(x, 3)rather than just a shortcut to x + I(x ^ 2) + I(x ^ 3)- it actually produces legendary polynomials that have the good ability to be uncorrelated
options(digits = 2)
x <- runif(100)
var(cbind(x, x ^ 2, x ^ 3))
# x
# x 0.074 0.073 0.064
# 0.073 0.077 0.071
# 0.064 0.071 0.067
zapsmall(var(poly(x, 3)))
# 1 2 3
# 1 0.01 0.00 0.00
# 2 0.00 0.01 0.00
# 3 0.00 0.00 0.01
source
share