#Read in the ANT data (see ?ANT).
data(ANT)
head(ANT)
#fit a mixed effects model to the error rate data
er_fit = lmer(
formula = error ~ cue*flank*group + (1|subnum)
, family = binomial
, data = ANT
)
#obtain the predictions from the model
er_preds = ezPredict(
fit = er_fit
)
#compute 95% CI for each prediction
er_preds$lo = er_preds$value - qnorm(.975)*sqrt(er_preds$var)
er_preds$hi = er_preds$value + qnorm(.975)*sqrt(er_preds$var)
#visualize the predictions
ggplot(
data = er_preds
, mapping = aes(
x = flank
, y = value
, ymin = lo
, ymax = hi
)
)+
geom_point(
alpha = .75
)+
geom_line(
alpha = .5
)+
geom_errorbar(
alpha = .5
)+
facet_grid(
cue ~ group
)+
labs(
y = 'Error Rate (log odds)'
)
Run the code above in your browser using DataLab