0
$\begingroup$

As the title reads, the results from the linear and first degree polynomial model are different and I am not sure why. Any ideas why this might be?

linear_model <- nlme::lme(mpg ~ vs * gear, random = ~ 1 | ID, 
          data = mutate(mtcars, ID = dplyr::row_number()))

summary(linear_model)

                 Value     Std.Error    DF    t-value   p-value
(Intercept)     8.378571    4.242762    28  1.9747918   0.0582
vs             -3.047802    9.300390    28  -0.3277069  0.7456
gear            2.316964    1.161928    28  1.9940684   0.0560
vs:gear         2.667651    2.423512    28  1.1007375   0.2804

------------------------------------------------------------------------

poly_model <- nlme::lme(mpg ~ vs * poly(gear, 1), random = ~ 1 | ID, 
          data = mutate(mtcars, ID = dplyr::row_number()))


summary(poly_model)


                     Value     Std.Error    DF    t-value   p-value
(Intercept)         16.922377   0.978208    28  17.299367   0.0000
vs                  6.789161    1.512328    28  4.489213    0.0001
poly(gear, 1)       9.517902    4.773107    28  1.994068    0.0560
vs:poly(gear, 1)    10.958495   9.955593    28  1.100738    0.2804
```
$\endgroup$
2
  • $\begingroup$ The documentation ?poly indicates that these are orthogonal polynomials. More information: mathoverflow.net/questions/38864/… $\endgroup$
    – Sycorax
    Commented Dec 12, 2022 at 18:11
  • $\begingroup$ Oh, right! Thanks. $\endgroup$
    – Yaaman
    Commented Dec 12, 2022 at 20:02

0

Browse other questions tagged or ask your own question.