Simple Monte Carlo power analysis for complex models. Find the sample size you need or check if your study has enough power — even with complex models that traditional power analysis can’t handle.

Tests PyPI Python License: GPL v3 DOI Windows macOS Linux
MCPower ASCII art

What Is Power Analysis?

Statistical power is the probability that a study will detect a real effect when one exists. A power analysis helps you determine what sample size you need to achieve a target power level (e.g., 80%), or what power you have at a given sample size. Without it, you risk running underpowered studies that waste resources and fail to find real effects.


Why MCPower?

Traditional power analysis breaks down with interactions, correlated predictors, categorical variables, or non-normal data. MCPower uses simulation instead of formulas — it generates thousands of datasets exactly like yours, then sees how often your analysis finds real effects.

  • Works with complexity: Interactions, correlations, factors, any distribution
  • R-style formulas: outcome = treatment + covariate + treatment*covariate
  • Categorical variables: Multi-level factors automatically handled
  • Two simple commands: Find sample size or check power
  • Scenario analysis: Test robustness under realistic conditions
  • Upload your own data: Drop in a CSV and MCPower auto-detects variable types, preserves real distributions, and handles correlations. Especially useful with pilot data
  • Mixed models: Random intercepts, random slopes, and nested structures via R-style syntax — validated against R’s lme4 across 95 scenarios
  • Minimal math required: Just specify your model and effects

Desktop Application (GUI)

Prefer a graphical interface? MCPower GUI is a standalone desktop app — no Python installation required. Download ready-to-run executables for Windows, Linux, and macOS.

PlatformDownload
WindowsMCPower.exe
LinuxMCPower-linux
macOSMCPower-macos.zip
AlternativeSourceForge

The GUI walks you through three steps: Model (define your study design), Analysis (choose mode and settings), and Results (view power tables, charts, and a replication script).

Step 1: Define Your Model

Enter an R-style formula, set variable types and effect sizes. Use Small/Medium/Large buttons for Cohen’s conventions, or type custom values.

MCPower GUI — Model tab with formula, variable types, and effect sizes
Model tab — formula with interaction, variable types, and effect size sliders

Step 2: Configure & Run Analysis

Choose between Find Power (at a fixed sample size) or Find Sample Size (search a range). Enable scenario analysis for robustness testing.

MCPower GUI — Analysis tab with power and sample size settings
Analysis tab — settings for target power, scenarios, and sample size range
MCPower GUI — Simulation running with progress bar
Simulation in progress — real-time progress with option to abandon

Step 3: View Results

Interactive power curves, bar charts with scenario tabs (Optimistic / Realistic / Doomer), data tables, and a ready-to-use Python replication script.

MCPower GUI — Find Sample Size results with power curves
Find Sample Size — power curves across sample sizes with scenario analysis
MCPower GUI — Find Power results with bar chart, table, and replication script
Find Power — bar chart, data table, and replication script

Dark Theme & ANOVA Mode

MCPower GUI includes a dark theme and a dedicated ANOVA mode for factorial designs with automatic factor handling.

MCPower GUI — ANOVA mode in dark theme
ANOVA mode (dark theme) — factorial design with named factors and levels
MCPower GUI — Results in dark theme
Results (dark theme) — power curves with scenario analysis

Python Package: Get Started in 2 Minutes

Installation

pip install mcpower

Your First Power Analysis

# python

from mcpower import MCPower

# 1. Define your model (just like R)
model = MCPower("satisfaction = treatment + motivation")

# 2. Set effect sizes (how big you expect effects to be)
model.set_effects("treatment=0.5, motivation=0.3")

# 3. Change the treatment to "binary" (people receive treatment or not)
model.set_variable_type("treatment=binary")

# 4. Find the sample size you need
model.find_sample_size(target_test="treatment", from_size=50, to_size=200)

Output: “You need N=75 for 80% power to detect the treatment effect”


Python Package: Scenario Analysis

Real studies rarely match perfect assumptions. MCPower’s scenario analysis tests how robust your power calculations are under realistic conditions.

# python

model.find_sample_size(
    target_test="treatment",
    from_size=50, to_size=300,
    scenarios=True  # The magic happens here
)
SCENARIO SUMMARY
================================================================================

Uncorrected Sample Sizes:
Test                                     Optimistic   Realistic    Doomer
-------------------------------------------------------------------------------
treatment                                75           85           100
================================================================================
  • Optimistic: Your ideal conditions (original settings)
  • Realistic: Moderate real-world complications (recommended for planning)
  • Doomer: Conservative estimate (if this is acceptable, you’re really safe!)

When to Use MCPower

Use MCPower when you have:

  • Interaction terms (treatment*covariate)
  • Categorical variables with multiple levels
  • Binary or non-normal variables
  • Correlated predictors
  • Multiple effects to test
  • Need to test assumption robustness
  • Complex models where traditional power analysis fails

Use traditional power analysis for:

  • Models that are not yet implemented in MCPower
  • Simple models where all assumptions are clearly met
  • Very large analyses with tens of thousands of observations

Links & Resources


Citation

GPL v3. If you use MCPower in research, please cite:

Lenartowicz, P. (2025). MCPower: Monte Carlo Power Analysis for Statistical Models. Zenodo. DOI: 10.5281/zenodo.16502734

@software{mcpower2025,
  author = {Pawel Lenartowicz},
  title = {MCPower: Monte Carlo Power Analysis for Statistical Models},
  year = {2025},
  publisher = {Zenodo},
  doi = {10.5281/zenodo.16502734},
  url = {https://doi.org/10.5281/zenodo.16502734}
}