# Power analysis using lmer mixed model

I am using a mixed model in lmer to analyse some phenotype data across 3 levels of a treatment I am interested in, blocked by a random factor I am not interested in (just want to control for). So my model is basically:

model <- lmer( thing ~ treatment + (1|block) )


I have pilot data that gives me a measure of the variance of the phenotype 'thing' in this population. So I was hoping to use a power analysis to ask the question -

'Given the variance X in thing, how many samples would be needed to find significant differences across treatments?'

I was planning on running this power analysis for different hypothetical effect sizes. The thing is, I haven't even thought about power analysis since a distant stats lesson some time in my undergrad bio degree, and at that time I certainly wasn't told anything about dealing with them in mixed models.

I had a look at potential R functions and could only come up with the pwr package, which doesn't seem to have functionality for mixed models. I also came across some tutorials which started with a simulated dataset, but it didn't seem to address what I thought would be a simple problem (either that or I didn't understand).

I simply want to give the variance and [hypothetical] effect size, and get the sample size needed to find a significant difference - within the mixed model. Is this more complicated than I thought? Has anyone got any pointers of where I could look for some clear instruction, or functions I've missed that might be helpful?

Thanks in advance for any help,

Harriet

## migrated from stackoverflow.comJun 15 '16 at 12:49

This question came from our site for professional and enthusiast programmers.