FAQ¶
General¶
Q: What models does MCPower support?
A: MCPower currently supports:
OLS linear regression (fully supported)
Factor variables / ANOVA (fully supported)
Post-hoc pairwise comparisons (fully supported)
Mixed-effects models: random intercepts, random slopes, nested effects (fully supported)
Logistic regression is planned for a future release.
Q: How many simulations should I use?
A: The default (1,600 for OLS) is sufficient for most cases. For mixed models, the default is 800 (compared to 1,600 for OLS) because each simulation is more expensive. Consider increasing for final calculations. See Performance & Backends.
Q: Can I use my own data?
A: Yes, use upload_data() to preserve real-world distributions and correlations. MCPower auto-detects variable types and offers three correlation preservation modes. See Uploading Data.
Q: What effect size should I use?
A: Effect sizes are standardized coefficients. Guidelines: small (0.1 continuous / 0.2 binary), medium (0.25 / 0.5), large (0.4 / 0.8). Base them on prior research or the smallest practically meaningful effect. See Effect Sizes.
Q: What’s the difference between find_power and find_sample_size?
A: find_power(sample_size=N) tells you the power at a given N. find_sample_size() searches a range of sample sizes to find the minimum N that achieves your target power (default 80%).
Mixed Models¶
Q: How many clusters do I need?
A: For random intercept models, 10–20 clusters are sufficient for stable estimation. For random slope models, 30+ clusters are recommended (50+ for large slope variance). Each cluster must have at least 5 observations (warning below 10). Note: for individual-level treatment (MCPower’s default), power depends primarily on total N, not on the number of clusters.
Q: What ICC should I use?
A: Use an ICC that reflects the expected clustering in your data. MCPower accepts ICC values of 0 (no clustering) or 0.10–0.90. Note that ICC has minimal impact on fixed-effect power in MCPower because treatment is assigned at the individual level within clusters – power depends primarily on total N.
Q: What about random slopes vs random intercepts?
A: Random intercepts (1|group) model shared baseline differences between clusters. Random slopes (1 + x|group) allow the effect of a predictor to vary across clusters. Random slopes need larger samples and are more prone to convergence issues. Start with random intercepts if unsure.
Troubleshooting¶
Q: Power seems too low or too high
A: Check your effect sizes. A “medium” effect is ~0.25 for continuous, ~0.5 for binary. Also check: Are predictors correlated? Correlations reduce power for individual effects. Is a correction applied? Corrections reduce power.
Q: “Invalid target test” error
A: Make sure the test name matches your formula exactly. For factor variables, use the bracket notation (e.g., "group[2]"). Use target_test="all" to see all available tests.
Q: “Too many failed simulations”
A: Mixed model convergence failures. Solutions:
model.set_max_failed_simulations(0.10) # Allow 10% failures
model.set_max_failed_simulations(0.30) # For complex models
Also consider increasing sample size per cluster.
Q: “Insufficient observations per cluster”
A: Cluster size < 5 (the enforced minimum). Increase sample_size or decrease n_clusters:
# 150/30 = 5 per cluster
model.find_power(sample_size=150)
Q: C++ backend not available
A: The C++ extension failed to compile during installation. This is usually due to a missing C++ compiler. The C++ backend is required for MCPower to function. Make sure you have a C++ compiler installed:
Linux:
sudo apt install build-essential cmake(Ubuntu/Debian) orsudo dnf install gcc-c++ cmake(Fedora)macOS:
xcode-select --installWindows: Install Visual Studio Build Tools
Then reinstall: pip install --force-reinstall mcpower
MCPower vs G*Power¶
Q: How does MCPower compare to G*Power?
A: They are complementary tools with different strengths. G*Power uses analytical (closed-form) formulas and covers ~70+ standard tests. MCPower uses Monte Carlo simulation and handles complex models where closed-form solutions don’t exist.
Feature |
MCPower |
G*Power |
|---|---|---|
Approach |
Monte Carlo simulation |
Analytical (closed-form) |
Platform |
Python + app for Win/Mac/Linux |
Win/Mac |
Simple tests (t, Anova) |
Via regression formulation + deticated Anova in APP |
Yes — ~70+ dedicated tests |
Manova |
No |
Yes — ~70+ dedicated tests |
Regression (linear, logistic, Poisson) |
Linear (logistic and Poisson under development) |
All three |
Mixed-effects models (nested, random slopes) |
Yes (custom solver) |
No |
Factorial designs & interactions |
Yes (almost any) |
Limited |
Correlated & non-normal predictors |
Yes (7 default distributions + unlimited empirical upload) |
No |
Effect sizes |
Cohen’s conventions and standardized β |
Full Cohen suite (d, f, w, h) + calculator |
Power analysis modes |
A priori, post-hoc |
A priori, post-hoc, sensitivity |
Multiple comparison corrections |
Bonferroni, BH-FDR, Holm, Tukey HSD |
No |
Robustness stress-testing |
Yes (Default + custom scenarios) |
No |
Model misspecification testing |
Yes (via diffrent generation and testing formula) |
No |
Cumulative probability (at-least-k significant) |
Yes |
No |
Speed |
1–5s simple, 15–30s complex models |
Near-instant |
In short: Use G*Power for standard tests (t-test, χ², ANOVA) with known formulas. Use MCPower when your design involves interactions, correlated predictors, non-normal data, mixed-effects models, or you need robustness analysis.
Performance¶
Q: How can I speed up the analysis?
A: Several options:
The C++ backend is compiled automatically during install and provides major speedups.
Enable parallelization:
model.set_parallel(True)Reduce simulations for exploratory work:
model.set_simulations(500)
See Performance & Backends for details.
Q: Should I enable parallelization?
A: The default ("mixedmodels" mode) is usually best – it enables parallelization only for mixed models where the overhead is worthwhile. For OLS with default simulations it’s already fast, also the overhead of spawning processes often exceeds the computation time.