ggplotting power curves from simr package
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
The R package simr
has greatly facilitated power analysis for mixed-effects models using Monte Carlo simulation (i.e., hundreds or thousands of tests under slight variations of the data). The powerCurve
function is used to estimate the statistical power for various sample sizes in one go. Since it runs serially, it can take a VERY long time to finish; approximately, the time it takes to run the model supplied once (say, a few hours) times the number of simulations (nsim
, which should be higher than 200) times the number of different sample sizes examined. While there isn’t a built-in parallel method, the power curves for different sample size can be run separately, and the results can be combined (see tutorial). The power curves produced by simr
are so good they deserve ggplot2
rendering. So, here’s a function for it.