# Power analysis for mixed-effects model

#### LucieR

##### New Member
Does anyone know how I can run a power analysis to determine the sample size for a linear mixed-effects model? Can this be done on G*Power?

Thanks

#### hlsmith

##### Less is more. Stay pure. Stay poor.
@spunky - what are you doing? Answer this question NOW.

#### Dason

I not sure about g power. But you can always simulate to estimate power.

#### spunky

##### Can't make spagetti
Does anyone know how I can run a power analysis to determine the sample size for a linear mixed-effects model? Can this be done on G*Power?

Thanks
It can't be done in GPower. You'll need to approximate it through computer simulations,

#### Buckeye

##### Active Member
Maybe I read or heard somewhere that power analysis' are often a simplification of the model that generates the data. As you start getting in the weeds with more complicated models, a power analysis for that specific model is harder to calculate. So, you do your best with what's tractable.

#### Dason

Maybe I read or heard somewhere that power analysis' are often a simplification of the model that generates the data. As you start getting in the weeds with more complicated models, a power analysis for that specific model is harder to calculate. So, you do your best with what's tractable.
Or you just simulate

#### Dason

It could be done in any reasonable programming language. R would be the easiest though. Basically you just need to fully write out what the data generation process looks like under your proposed alternative hypothesis and then use built in random number generators to simulate the values from those distributions and then do the analysis. One nice benefit of this approach is that the code for analyzing the data is already created after this point.

If you have specific questions we'd be more than happy to help but without specific details that's about all I can say.

#### LucieR

##### New Member
Unfortunately, I don't really have any experience in R/programming in general (beyond the basics). I ran the mixed-effects models in Jamovi - they included one continuous predictor, one categorical predictor, and two cluster variables (two random intercepts). I don't suppose there is any other way this can be done?