MCPower answers two questions about a study before you run it: how much statistical power a given sample size buys, and what sample size reaches a power target. It works by simulating the study many times on a native engine, so the same short workflow covers OLS, logistic, mixed, and factorial models.
Install
install.packages("mcpower", repos = "https://r.mcpower.app")
This installs a prebuilt binary on Windows, macOS, and Linux. Need a specific R version, an offline install, or the previous R release on Linux? See manual binary downloads. The package is also on R-universe. On other systems (Intel Mac, older Linux, older R) compile the current source instead:
remotes::install_github("pawlenartowicz/mcpower", subdir = "ports/r", build = FALSE)
A first analysis
Describe the model as a formula, mark which predictors are binary, set the effect sizes you want to be able to detect, and ask for power:
library(mcpower)
# Does a treatment lift satisfaction, controlling for age?
model <- MCPower$new("satisfaction ~ treatment + age")
model$set_variable_type("treatment=binary")
model$set_effects("treatment=0.5, age=0.3")
result <- model$find_power(sample_size = 120, target_test = "treatment")
Power Analysis — OLS N=120 sims=1600 α=0.05 target=80% formula: satisfaction ~ treatment + age ─────────────────────────────────── Test Power Target ─────────────────────────────────── treatment 77.4% 80% ───────────────────────────────────
That is the whole loop. At n = 120 this design has 77.4% power to detect the
treatment effect — just under the conventional 80% target, so you would want a
few more participants. The next page asks both questions properly.
The tutorial ladder
Each rung adds one modelling idea and powers it. Climb from the top:
- First analysis — the two questions, in full
- Interactions —
a:bterms - Correlations — correlated predictors
- Logistic regression — a binary outcome
- Mixed models — grouped / hierarchical data
- ANOVA & post-hoc — factors and pairwise contrasts
- Multiple testing — corrections across many tests
- Custom scenarios — robustness sweeps
- Upload data — drive simulation from a CSV or dataframe
- Model misspecification — what testing the wrong model costs
New to power analysis? The Concepts pages explain effect sizes, model specification, and what the power number actually means.