[R-sig-ME] Syntax interaction polynomial term
thierry.onkelinx at inbo.be
Tue May 16 11:08:29 CEST 2017
This questions has nothing to do with with mixed models. You should have
send it to r-help.
weight * poly(age, 2, raw=TRUE) is equivalent with weight + age + I(age^2)
+ weight : I(age^2) + weight:age. So you need the add the first order
interaction as well.
However you better use the orthogonal polynomials that the raw polynomials.
Because the raw polynomials might be highly correlated. Have a look at this
age <- 15:50
cor(cbind(age, age ^ 2, age ^ 3))
cor(poly(age, 3, raw = TRUE))
c_age <- scale(age, center = TRUE, scale = FALSE)
cor(cbind(c_age, c_age ^ 2, c_age ^ 3))
s_age <- scale(age, center = TRUE, scale = TRUE)
cor(cbind(s_age, s_age ^ 2, s_age ^ 3))
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
2017-05-16 9:58 GMT+02:00 Luca Corlatti <luca.corlatti op boku.ac.at>:
> Dear list members, I am trying to fit some models to investigate the
> effects of some predictors (weight, age) on fertility.
> As the effect of age on fertility is typically quadratic (lower fertility
> for the extreme age-classes and higher fertility for intermediate
> age-classes), I fitted the full additive model as:
> fertility ~ weight + poly(age, 2, raw=TRUE)
> I would also like to fit a model with an interaction term between weight
> and age, but I fail to understand the correct syntax. Should the
> interaction be between weight and the full polynomial term:
> fertility ~ weight * poly(age, 2, raw=TRUE)
> or should it simply be between weight and the age^2?
> fertility ~ weight + age + I(age^2) + weight : I(age^2)
> R-sig-mixed-models op r-project.org mailing list
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models