# How to do a power analysis in linear mixed-effect model in R

I'm trying to figure out how to do a power analysis for a linear mixed effect model with multiple variables, an interaction, and multiple controls (see r code), to find out sample size.

library(lmerTest)

FullModel <- lmer(Mean ~ Sex + Age.Years +
Rf.G * BMRC +
(1|D.G),
data = LowModRf.G)


Sex and age in years are my control variables, D.G (Death group) is my random effect, and Rf.G (rainfall) and BMRC (maternal rank) are my fixed effect predictors.

For the life of me, I cannot figure out how to do a power analysis with my model in simr or pwr (I've tried both and I don't this the analysis are correct). Really, any help would be greatly appreciated!

• If this is a "how do I do this" question rather than "what should I do", it belongs on Stack Overflow. It would help to have you include the code that you tried in simr and/or pwr, what the results are, and why you don't think they're correct ... Sep 23 at 1:23