Full_Name: Jens Keienburg
Version: 2.3.0
OS: Windows XP
Submission from: (NULL) (193.174.53.122)
I used the function lm() to calculate the coefficients of a polynome. If I used
the function poly(t,2) to denote a polynome of form 1 + x + x^2, the
coefficients are wrong. I appended an excerpt below:
> t=1:100
> p=-20 - 10 * t + 2 * t^2
> p
[1] -28 -32 -32 -28 -20 -8 8 28 52 80 112 148
188 232 280 332 388 448 512
[20] 580 652 728 808 892 980 1072 1168 1268 1372 1480 1592
1708 1828 1952 2080 2212 2348 2488
[39] 2632 2780 2932 3088 3248 3412 3580 3752 3928 4108 4292 4480
4672 4868 5068 5272 5480 5692 5908
[58] 6128 6352 6580 6812 7048 7288 7532 7780 8032 8288 8548 8812
9080 9352 9628 9908 10192 10480 10772
[77] 11068 11368 11672 11980 12292 12608 12928 13252 13580 13912 14248 14588
14932 15280 15632 15988 16348 16712 17080
[96] 17452 17828 18208 18592 18980> model_p = lm( p ~ poly(t,2))
> model_p
Call:
lm(formula = p ~ poly(t, 2))
Coefficients:
(Intercept) poly(t, 2)1 poly(t, 2)2
6242 55423 14903
> model_p = lm( p ~ 1 + t + I(t^2))
> model_p
Call:
lm(formula = p ~ 1 + t + I(t^2))
Coefficients:
(Intercept) t I(t^2)
-20 -10 2
Best wishes,
Jens Keienburg