I am trying to illustrate shrinkage in linear mixed models in a 2x2 factorial design. I would like to show the shrinkage effect for all coefficients including the interaction coefficient. However, I am unsure whether my approach is right. Here is what I did:

I fitted a linear-mixed model using lmer() from lme4. It is a complex model of the form:

 mod1 <- lmer(Val ~ Class * Complex
              + (Class * Complex | Subject)
              + (Class * Complex | Word),
              data = Lex)

I used contrast coding in order to see main effects in the model output:

contrasts(Lex$Class) <- contr.sum(2)
contrasts(Lex$Complex) <- contr.sum(2)

I then fit individual models per Subject and extract the coefficients:

df <- coef(lmList(Val ~  Class * Complex | Subject,
           data = Lex))

Then I extract the coefficients per Subject from the mixed-model:

cc1 <- as.data.frame(coef(mod1)[["Subject"]])

And bind it all together in a data frame:

names(cc1) <- c("A", "B", "C", "D")
df <- cbind(df, cc1)

I then go on to plot the (Intercept) per subject on the y-axis and the corresponding (slope-) coefficient on the x-axis for both: the individual models (purple) and the mixed-model (blue). However, I am unsure if this is correct for the interaction coefficient:

Correct way to show shrinkage for the interaction coefficient?

  • $\begingroup$ This looks reasonable at first glance, but (1) I don't quite understand your last sentence (" However, I am unsure if this is correct for the interaction coefficient:" -- please expand/clarify?) (2) Any chance of a reproducible example? $\endgroup$ – Ben Bolker Jun 19 '15 at 22:03
  • $\begingroup$ Of course I can add a reproducible example. Here is a gist on github: gist.github.com/03ed993441f8574c5858.git or gist.github.com/brauner/03ed993441f8574c5858. The data frame is 2060x5 and it needs to be because otherwise this rather complex model would not converge! Regarding my last sentence: I am unsure whether it makes sense to plot per-item-intercept ~ per-item-interaction-coefficient to illustrate the shrinkage for the interaction coefficient. The reproducible example should help to clarify this. $\endgroup$ – lord.garbage Jun 20 '15 at 3:21

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.