[R] lm coefficients
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Feb 3 18:27:40 CET 2004
Do read ?poly: you have orthogonal polynomials.
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:
>
> d <- read.table(file = "Oleg.dat", head = TRUE)
> d
> X T
> 3720.00 4.113
> 3715.00 4.123
> 3710.00 4.132
> ...
>
> out <- lm(T ~ poly(X, 4), data = d)
You asked for 4 and got 2? Really?
> 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,
> yes?
No!
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list