[R] power analyses for mixed effects lmer models

Greg Snow Greg.Snow at imail.org
Wed Jan 14 19:40:20 CET 2009


My preferred method for this type of thing is to use simulation.  You have already done the hard parts in figuring out what your data is going to look like and how you plan to analyze it.  Now just write a function that will simulate data according to your pattern and with the difference(s) that you want to compute the power for, then analyzes the simulated data and returns the value of interest (usually a single p-value, but could be something else).  Now run this function a bunch of times (I would use the replicate function to do this) and see how often the conclusion of interest occurs (p-val < alpha, or something else).  This is your estimate of power.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of LeeDetroit
> Sent: Wednesday, January 14, 2009 8:12 AM
> To: r-help at r-project.org
> Subject: [R] power analyses for mixed effects lmer models
> 
> 
> Hi all,
> 
> I'm new (post #1!) and I hope you'll forgive me if I'm acting like an
> idiot...
> 
> I have been asked for some power analyses for some mixed-effects models
> I'm
> running using lmer. My studies nearly always contain mixes of
> repeated-measures and between-subjects predictor variables.
> 
> As an example, suppose I want to see if men or women show a stronger
> word
> frequency effect. I have 50 words of varying frequency that I show to
> 30 men
> and 30 women, who are supposed to decide as quickly as possible whether
> it's
> a real word. So my data object would end up being 3000 lines long, and
> look
> like this:
> 
> Subject  Word  Sex  Frequency  ReactionTime
> s1 w1 M 23 2543
> s1 w2 M 67 1438
> s1 w3 M 1 8033
> ...
> s60 w50 F 4 1099
> 
> I analyze this with
> 
> lmer(log(ReactionTime) ~ (Sex * Frequency) + (1|Subject) + (1|Word)
> 
> Does anyone know how I might do power analyses or compute effect sizes
> in
> this kind of situation?
> 
> Thanks.
> 
> --Lee
> --
> View this message in context: http://www.nabble.com/power-analyses-for-
> mixed-effects-lmer-models-tp21457651p21457651.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list