[R-sig-ME] Plotting means and error bars for fixed effects in a ME model

Paul Johnson pauljohn32 at gmail.com
Sun Feb 7 22:21:40 CET 2016

On Sun, Feb 7, 2016 at 2:56 PM, Ché Lucero <chelucero at uchicago.edu> wrote:
> Hello, list.
> I have a question about error bars on barplotted means of data that has
> been analyzed with mixed effects models.
> Mixed effects models allow us to simultaneously model variance from
> multiple random-effects sources (such as Subjects and Items), a much needed
> solution to a problem pointed out (most potently) in my field by Herb Clark
> in 1973.

You will get better help if you rephrase your question with a fitted
lme4 object and let us see what you are trying to do.  As it is, your
question asks us to wade throught a lot of ANOVA jargon. I'd rather
see your model, data, and the number for which you want the CI.

It appears that even for glm without random effects, there is no
settled upon idea for CI on predicted values. You can fall down a
rabbit hole reading math articles about that. I don't think the
presence of random effects makes that tougher, its just another
element to add in the error bands.  The model you specify when you fit
dictates what's correlated.

I had to improvise some CIs last semester. In the package "arm"
(support for the Gelman & Hill textbook), there's a function called
se.coef and they do the usual plus or minus 2 of those to make error
bars that look like CIs for predicted values. That works because if
you calculate some linear sum, you can use the variances of individual
elements to get a Wald type CI.

I am pretty sure the best answer is simulation with lme4 objects,
however. But don't have code to share to you.

Good luck, think about showing everybody code and such that they can focus on.


> However, to my knowledge, calculating confidence interval/SEM for means has
> not advanced to take this modeling approach into account. A series of
> papers - Loftus and Masson 94 (Using confidence intervals in within-subject
> designs)  Cousineau 05  (Confidence intervals in within-subject designs: a
> simpler solution) and Morey 05 (Confidence Intervals from Normalized Data:
> A correction to Cousineau)   has specified ways to calculate error bars in
> which the within-Subject error has been accounted for.
> That approach to calculating error bars for plotting seems to be well
> matched for when the statistical procedure is a simple repeated measures
> (for Subjects OR Items) ANOVA. But what about the case where I have both
> within-Subjects and within-Items (and within-XYZ random factors too)? Is
> there a way to construct standard errors of the mean for levels of a fixed
> factor (e.g. Condition) taking more than one random-effect into account as
> mixed effects models do? It would be really great to have the charts
> visually suggest the same inferences that the ME statistics do, but I can't
> find any literature about it.
> Thanks for your time.
> -Ché
>         [[alternative HTML version deleted]]
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

Paul E. Johnson
Professor, Political Science        Director
1541 Lilac Lane, Room 504      Center for Research Methods
University of Kansas                 University of Kansas
http://pj.freefaculty.org              http://crmda.ku.edu

More information about the R-sig-mixed-models mailing list