Spower Provides a general purpose simulation-based power analysis API for routine and customized simulation experimental designs. The package focuses exclusively on Monte Carlo simulation experiment variants of (expected) prospective power analyses, criterion analyses, compromise analyses, sensitivity analyses, and a priori/post-hoc analyses. The default simulation experiment functions defined within the package provide stochastic variants of the power analysis subroutines in GPower 3.1 (Faul, Erdfelder, Buchner, and Lang, 2009), along with various other parametric and non-parametric power analysis applications (e.g., mediation analyses) and support for Bayesian power analysis by way of Bayes factors or posterior probability evaluations. Additional functions for building empirical power curves, reanalyzing simulation information, and for increasing the precision of the resulting power estimates are also included, each of which utilize similar API structures. For further details see the associated publication in Chalmers (2025).
Installation
You can install Spower from CRAN:
install.packages("Spower")To install the development version of the Spower package, you need to
install the remotes package then the Spower package.
install.packages("remotes") remotes::install_github("philchalmers/Spower")
Quick Start
Spower requires only two components: an available function used to
generate exactly one simulation experiment that returns one or more
p-values given the null hypothesis of interest (or alternative
criteria that return logical indicators or posterior probabilities),
and the use of either Spower() or SpowerCurve() to perform the
desired prospective/post-hoc, a priori, sensitivity, compromise, or
criterion power analysis.
For example, the built-in p_t.test() function performs t-tests using
various inputs, where below a sample size of