Transform Coefficients from Orthogonal Polynomial Form

DESCRIPTION:
Returns the vector of coefficients for the polynomial in simple form when given the coefficients for the orthogonal form.

USAGE:
poly.transform(polymat, coefs, intercept=T)

REQUIRED ARGUMENTS:
polymat:
an object which is the output of poly. In particular, this must have a "coefs" attribute.
coefs:
vector of coefficients for the polynomial in orthogonal form. The order of these must be the coefficient for the intercept (if intercept is TRUE), and then the coefficients in the order implied by polymat.

OPTIONAL ARGUMENTS:
intercept:
logical flag: if TRUE, then the coefs argument is assumed to include the intercept term also.

VALUE:
a vector of coefficients for the polynomial in simple form. That is, the first element is the constant term, the second element is the coefficient for x, the third element is the coefficient for x squared, etc. Notice that even if intercept=F, an intercept term is returned by poly.transform().

DETAILS:
This function only works when poly is given a single vector with which to form a polynomial.

The reason to use poly is that the regression can become ill-conditioned (hence inaccurate) when the straightforward approach is used.


SEE ALSO:
poly , poly.raw .

EXAMPLES:
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))