0
$\begingroup$

I am attempting to fit a linear mixed-effect model in R using lme4 that is quite a bit more complex than any example I've seen in forums or in textbooks. I am having trouble finding the correct code for the random effects in particular. I have two fixed factors (parental environment and germination treatment) and random factor (genetic line); I want to test all 2 and 3-way interactions between these factors. I have two additional fixed factors that I want to test without interactions (provisioning and block). I want to specify random intercepts and slopes for genetic line, but I am not sure how to do this. The dependent variable is biomass.

Is this model specification correct?:

fullmod <- lmer(biomass ~ parental.environment* germination.treatment*
   (1+parental.environment*germination.treatment|genetic.line)
                + provisioning + block, biomass.data)

I am also interested in testing the significance of the 3-way interaction parental environment x germination treatment x genetic line by comparing the fit of the reduced model to the full model. What would be the correct model specification for the full model minus this 3-way interaction?

$\endgroup$

1 Answer 1

1
$\begingroup$

You're nearly right.

The main effects of the fixed terms plus their interaction is/are represented as

1+parental.environment* germination.treatment

Interactions between random and fixed factors are coded as variation of the fixed effects across levels of the random effects grouping variables, like so:

(1+parental.environment* germination.treatment|genetic.line)

As with all R model formulae, you can choose to include or not include the intercept term explicitly.

The only confusion on your part is that these terms are combined with + rather than *,

fullmod <- lmer(biomass ~ parental.environment* germination.treatment +
   (1+parental.environment*germination.treatment|genetic.line) +
                provisioning + block, biomass.data)

I am also interested in testing the significance of the 3-way interaction parental environment x germination treatment x genetic line by comparing the fit of the reduced model to the full model.

The reduced model would be

biomass ~ parental.environment* germination.treatment +
       (1+parental.environment+germination.treatment|genetic.line) +
                    provisioning + block

Two notes (1) if there are $m$ levels of parental environment and $n$ levels of germination treatment, you will be fitting an $mn \times mn$ variance-covariance matrix (with $mn(mn+1)/2$ parameters), so you'd better have enough genetic lines to make that practical; (2) significance tests of variance components are a little tricky (the $p$-values from a naive likelihood ratio test are typically conservative by a factor of about 2; see Pinheiro and Bates 2000).

$\endgroup$
2
  • $\begingroup$ Thanks for your comment. I would appreciate some clarification. When you say that my only confusion is "these terms are combined with + rather than *", I took you to mean that I should use + to combine parental environment and germination treatment in the random effects specification of the full model. If so, I do not see a difference between the full model and the reduced model that you suggested. Am I correct in my interpretation, and if so, what is the correct reduced model? $\endgroup$ Jul 23, 2015 at 21:55
  • $\begingroup$ the character at the end of the first line of your formula, connecting the fixed- and random-effects parts of the formula, is a *; it should be + instead. I would expect that if you entered the formula exactly as shown in your question it would generate some interesting error messages. $\endgroup$
    – Ben Bolker
    Jul 23, 2015 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.