# Retrospective power analyis of lmer for sample size

I'm an MSc student doing an assignment where I am asked to analyze and write up a report on a dataset on environmental enrichment in zebra finches. Among other things we are being asked to do a retrospective power analysis too see whether the number of birds used was justified.

For the initial power analysis I used the pwr.anova.test() function from the pwr package, and used Cohen's standard d values to fill in f. For the retrospective I suspect they want me to find the effect of my model, plot the value into a power analysis and see what number of observations I would in fact have needed. They specifically say we do not need to use anything more sophisticated than what we learned in class (which was basically power.t.test()).

For modeling we are using lme4, and I have no idea how to extract the effect size from that. I have looked at similar questions and not been able to make much of it.

We're 15 reasonably smart people and all equally confused. Help?

For information: Individual birds were re-used for six trials each in a total of 30 trials (100 birds, 600 observations). My final model goes like this:

fear2 <- lmer(data = acoustic, FEAR ~ SOUND*SEX + (1|BIRD) + (1|TRIAL))


FEAR is a frequency of behaviour in percentages, and SOUND is categorical with three levels.

• You may want to draw your supervisor's attention to the fact that "post hoc power analysis" based on observed effect sizes is useless. See here. – Stephan Kolassa Dec 14 '14 at 19:54
• We know that. We're supposed to do it so that we can discuss sample size from a 3Rs perspective, ie whether the use of that many animals was justified (I'm doing animal welfare science). – Katja Dec 14 '14 at 22:34