poly(x, ...)
When called with a single vector argument, there is an additional attribute coefs. The coefs attribute is a list with component names alpha and norm2.
For several arguments (vector, matrix, or both), each of the column vectors is used to generate orthogonal polynomials of the required degree. The columns will be a subset of the tensor product of the orthogonal polynomials of given degree of each of the individual variables.
The coefs attribute contains the normalization constants used in constructing the orthogonal polynomials. See poly.raw for information on how these can be used to construct additional evaluations of the same polynomial basis.
We now describe the meaning of coefs. The jth column of the output represents a polynomial P(j). Define P(-1) = 0, and P(0) = 1. Then P(j+1) = (x - alpha[j+1]) * P(j) - norm2[j+2]/norm2[j+1] * P(j-1). Finally, the columns (polynomials) are scaled by their norms.
poly(freeny.y, 3) poly(freeny.y, freeny.x) poly(freeny.y, freeny.x, 2)glm(Kyphosis ~ poly(Age, 3) + Start, family=binomial, data=kyphosis) lm(NOx ~ poly(C, E, 4), data=ethanol)