We take a different approach to statistical analysis. Rather than advocating for "cook book" style analysis, this channel advocates for analytic strategies that dig deeper into the data at hand.
R file for the analysis (no guarantee it works! I have made a lot of changes to my R packages since I did this).
data(alcuse)
d = alcuse
#### read in the right package to do mixed models
require(lme4)
#### not a bad idea to convert ID to a factor
#### (otherwise R might treat it as continuous)
d$ID = factor(d$ID)
#### RANDOM EFFECTS ANOVA
#### run the model
rand.effects.anova = lmer(ALCUSE~1 + (1|ID), data=d)
##### study estimates
summary(rand.effects.anova)
##### plot the data
flexplot(ALCUSE~ID, data=d, jitter=T) + geom_hline(yintercept=.9330)
icc(rand.effects.anova)
#### RANDOM INTERCEPT MODEL
#### run the model
rand.intercept = lmer(ALCUSE~1 + AGE_14 + (1|ID), data=d)
##### study estimates
summary(rand.intercept)
##### plot the data
source("research/RPackages/fifer/R/mixed.mod.visual.R")
mixed.mod.visual(ALCUSE~AGE_14, data=d, rand.intercept)
#### RANDOM SLOPE MODEL
#### run the model
rand.slope = lmer(ALCUSE~1 + AGE_14 + (-1 + AGE_14|ID), data=d)
##### study estimates
summary(rand.slope)
##### plot the data
mixed.mod.visual(ALCUSE~AGE_14, data=d, rand.slope)
#### RANDOM SLOPE/INTERCEPT MODEL
#### run the model
rand.slope.int = lmer(ALCUSE~1 + AGE_14 + ( AGE_14|ID), data=d)
##### study estimates
summary(rand.slope.int)
##### plot the data
mixed.mod.visual(ALCUSE~AGE_14, data=d, rand.slope.int)
coef(rand.slope.int)$ID[26,]