On 19/08/2008, at 12:55 PM, ascentnet wrote:
>
> I have a simple X, Y data frame that I am trying to run regression
> analysis
> on. The linear regression looks great, but when I use lm(formula =
> y ~
> poly(x, degree = 5)) I get the same coeffecients. So for example
> if I use
> degree =3 my formula would look like y = 4.2 x^3 + 3.2x^2 + 2.1x +
> 1.0 and
> my degree 5 would look like y = 6.5x^5+ 5.4x^4 + 4.2 x^3 + 3.2x^2 +
> 2.1x +
> 1.0, which doesn't make sense to me.
>
> I was wondering if someone knew what I was doing wrong or if this is
> correct?
This is correct. By default the syntax you use gives *orthogonal*
polynomial
regression. You are misinterpreting the coefficients of the fit.
You actually
have, in the first instance
``y = 4.2 p_3 + 3.2 p_2 + 2.1 p1 + 1.0''
where p_1, p_2, p_3 are orthogonal polynomials of degree 1, 2, and 3
respectively.
They are *NOT* equal to x, x^2, and x^3.
Try:
> m <- cbind(1,poly(1:10,3))
> round(t(m)%*%m,digits=8)
If you don't want orthogonal polynomials, use e.g. poly
(x,degree=3,raw=TRUE).
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}