Skip to content
Prev 15543 / 20628 Next

Power calculations for lmer mixed designs

Hi Diane,
On 06/19/2017 03:06 PM, Diana Michl wrote:
See the paragraph above that code: "baseline range (fraction of grid
cells sampled) is 70% (logit(0.7)=0.8473)". qlogis() is the quantile
function for the logistic distribution, so qlogis returns the point in
that distribution where the density is equal to the value mentioned.
This is used here to compute logit(0.7):
[1] 0.8472979

Which is the value in the paragraph given for logit(0.7). This is just
converting effect size to the link (logit) scale (as mentioned in the
introduction: ' "beta" is the fixed-effects parameters, in this case
(intercept,treat) ? also all on the logit scale.').

Note that this is the intercept term ("baseline range").
Skimming the text, -0.2 is the coefficient/coefficient for the treatment
(already on the link scale -- note that it is not transformed, so it
represents log odds). In the explanatory text, "decrease log-odds of
range by 0.4", i.e. -0.4 is used -- maybe Ben Bolker can explain why the
number changed / what obvious transformation step I'm missing.

So the redline represents the "ground truth", i.e. the real parameter
value (because you chose it) and the other plots tell your simulated
estimates -- how close they were (see esp. the CI plot).
You calculate your power based on the ability of models you fit to the
simulated datasets to detect the effect. The general work flow is:

1. define "ground truth" model based on some theoretical assumptions
2. simulate lots of datasets of a certain size
3. fit models to those datasets.
4. number of models able to detect effect / number of models = power
5. if power to low, repeat with bigger simulated datasets

You can do this all by hand, but there are several tools for automating
this. I've tinkered with the simr package in the past and found it nice
(even nice enough to contribute a few things because I plan on using it
again).

There are also "analytic" tools that try to compute power without
simulation, see for exmaple Jake Westfall's Shiny apps (and read his
papers on power issues in mixed effects models!):

https://jakewestfall.shinyapps.io/pangea/
https://jakewestfall.shinyapps.io/crossedpower/

Best,
Phillip