Simulates regression models, including both simple regression and generalized linear mixed models with up to three level of nesting. Power simulations that are flexible allowing the specification of missing data, unbalanced designs, and different random error distributions are built into the package.
simglm: Tidy simulation and power analyses 
This package can be directly installed through CRAN:
install.packages("simglm")
The development version of the package can be installed by using the devtools package.
library(devtools)
install_github("lebebr01/simglm")
The best way to become oriented with the simglm package is through the package vignette. There are two ways to get to the vignettes (both will open a browser to view the vignette). Below is an example loading the "Intro" vignette directly:
browseVignettes()
vignette("Intro", package = "simglm")
Note: If you install the development version of the package, you may need to tell R to build the vignettes when installing the simglm package by doing the following:
install_github("lebebr01/simglm", build_vignettes = TRUE)
A flexible suite of functions to simulate nested data.
Currently supports the following features:
The alternative power framework estimates the proportion of simulated coefficient
estimates that meet a chosen effect threshold. Set thresholds for each model term
and use compute_statistics(..., alternative_power = TRUE) to summarize results
across replications. See the alternative power guide
for a worked example and guidance on interpreting the results.
Bugs and feature requests are welcomed. Please track these on GitHub here: https://github.com/lebebr01/simglm/issues. I'm also open to pull requests.
Enjoy!