pitakakariki / simr

Power Analysis of Generalised Linear Mixed Models by Simulation
68 stars 19 forks source link

specify effect size #232

Open HLiuMath opened 2 years ago

HLiuMath commented 2 years ago

Hi,

I think you you mentioned that there is no standardized effect size for the mixed model. But is there any rule of thumb to specify value of fixef.

For example, I have a fixed effect with coefficient to be 0.29, standard error to be 0.13, p-value to be 0.02 estimated through fit glmer() to a pilot study. I would like to do power analysis and see how big sample size do I need and am confused on which one should I specify: If I do fixef(mod)["TC"] <- 0.25 I need sample size to be 40 for 0.8 power, If I do fixef(mod)["TC"] <- 0.20 I need sample size to be 60 for 0.8 power. And I don't know which one should I trust.

Any suggestions would be much appreciated.

pitakakariki commented 2 years ago

Choosing an effect size is usually the hardest part of a power analysis.

Both of your calculations tell you something:

These numbers can only be interpreted in the context of your experiment and your goals. An effect size of 0.25 could mean a 28% difference between control and treatment. It could mean that an extra week of training increases test scores by 0.25. This will depend on what you were modelling in your pilot analysis.

Another way to look at 80% power is that you have a 20% chance of failing to find an effect. If an effect size of 0.20 would be slightly disappointing, you might be okay with a one in five chance of missing it. But if an effect size of 0.20 would be groundbreaking you would probably want substantially more than 80% power for that effect size.

HLiuMath commented 2 years ago

Many thanks!

Then I would like to say I would like to detect an effect of 0.2 with at least 80% power, so I would need at least a sample size of 60. But since the pilot study has only 17 participants, I cannot run glmer() on pilot if I include three-interaction and one more random effect (intercept and slope), so does it make sense if I say I need extra 20 participants to include three-interaction and one more random effect (intercept and slope) in my model?

I have two more questions regarding simr: can simr deal with generalized additive model (gam)? can simr deal with ordinary response regression?

Thanks in advance!

pitakakariki commented 2 years ago

If you want to check your power for a more complicated model you could use makeGlmer.

No support currently for gams or ordinal responses.