[R] lm coefficients
Thomas Lumley
tlumley at u.washington.edu
Tue Feb 3 18:04:12 CET 2004
On Tue, 3 Feb 2004, Timur Elzhov wrote:
> Dear R experts,
>
> Excuse me if my question will be stupid...
> I'd like to fit data with x^2 polynomial:
>
<snip>
> out <- lm(T ~ poly(X, 4), data = d)
> out
> Call:
> lm(formula = T ~ poly(X, 2), data = d)
>
> Coefficients:
> (Intercept) poly(X, 2)1 poly(X, 2)2
> 9.803 -108.075 51.007
>
> So, d$T best fitted with function
> 9.803 -108.075 * X + 51.007 * X^2,
No. The predictors are not X and X^2, but two orthogonal polynomials.
Look at the help page for poly().
-thomas
More information about the R-help
mailing list