I have a linear mixed model in R using the lmerTest
package, where I have three categorical factors (A with 3 levels, B with 8 levels, and C with 2 levels) and a random effect for Subject. I am interested in performing power analysis using simr
for two specific planned contrasts between the levels of B. Is it possible?
For example, we indicate levels 1, 2, 3, 4 of factor B by B1, B2, B3, and B4, respectively, and A1 as level 1 of factor A. We need the power for the following contrasts.
- Compare B1 and B2, and compare B3 and B4, controlling all other variables (if the model contains no interaction terms)
- Compare B1 and B2, and compare B3 and B4 at specific A level A2 (if considering interaction between A and B)
I understand that simr
can simulate power and sample size for all fixed effects in the model, so we can compare B1 with all other levels of B by setting reference level of B to be B1. But I’m unsure how to set it up to calculate power for above specific contrasts. I also know emmeans
can set up and calculate post-hoc contrasts, but is there a way to integrate this with simr
for power analysis and sizing? If not, what is the appropriate way to do this?
Can someone share experience simulating power and sample size for these planned contrasts using simr
?
2