Examples of Simulation for Power Analysis: 3 Practical Examples Researchers Actually Use
Why simulation-based power analysis is taking over
Classical power formulas are great when your design is simple: one predictor, independent observations, normal outcomes, equal group sizes. But real studies in 2024–2025 rarely look that clean.
That’s why many of the best examples of simulation for power analysis come from areas like:
- Multilevel and clustered designs (schools, hospitals, sites)
- Logistic or Poisson outcomes
- Time-to-event (survival) data with staggered entry
- Adaptive or sequential designs
- Nonlinear models and interactions
Instead of hunting for the perfect formula, you:
- Assume a data-generating mechanism (your best guess at reality)
- Simulate many fake datasets under that mechanism
- Fit the model you plan to use
- Check how often your test finds the effect (power)
The three main examples of simulation for power analysis: 3 practical examples below all follow this pattern, with variations tailored to the research question.
Example 1: Parallel-group clinical trial with non-normal outcomes
This first example of simulation for power analysis mirrors a common scenario: a two-arm randomized clinical trial where the outcome is skewed or bounded, so a simple t-test formula feels risky.
Scenario
A team at a large U.S. academic medical center is planning a trial comparing a new digital cognitive-behavioral therapy (CBT) app versus usual care for moderate depression. The outcome is a depression score at 12 weeks, measured on a 0–27 scale (similar to PHQ-9). Past studies show:
- Mean score in usual care at 12 weeks: 11
- Clinically meaningful reduction: 2 points
- Standard deviation: about 6, but distribution is skewed with a floor at 0
They want 80–90% power at α = 0.05 to detect a 2-point mean difference.
Why simulation instead of formulas here?
The outcome is bounded (0–27) and skewed, and they plan to use a linear model adjusting for baseline score, age, and site. Standard two-sample t-test formulas ignore the covariates and the bounded scale.
Simulation lets them:
- Generate baseline and follow-up scores with realistic skew
- Include baseline score as a covariate in the model
- Incorporate site effects and missing data
Simulation setup
A typical workflow in R or Python would:
Specify parameters
- Control mean at 12 weeks: 11
- Treatment mean: 9 (effect = −2)
- SD: 6
- Correlation between baseline and follow-up: 0.6
- 10% dropout, slightly higher in usual care
Simulate data for a given sample size, say 200 per arm (N = 400):
- Randomize participants to treatment or control
- Generate baseline scores from a skewed distribution (for example, log-normal transformed and truncated between 0 and 27)
Generate follow-up scores with:
followup = baseline * 0.5 + treatment_effect + error
wheretreatment_effect = −2in the treatment arm and0in controlAdd dropout by randomly setting some follow-up scores to missing, with slightly higher probability in control
Fit the planned model
- Linear regression: follow-up score ~ treatment + baseline + age + site
Repeat
- Run steps 2–3 maybe 2,000–5,000 times
- Record how often the p-value for treatment < 0.05
Estimate power
- If, say, 1,720 of 2,000 simulations detect the treatment effect, estimated power is 86%.
By repeating this for different sample sizes (e.g., 150, 200, 250 per arm), the team gets a data-driven sense of how many participants they need.
Extra twist: missing-not-at-random sensitivity
A more advanced example of simulation for power analysis in this same trial is to assume that participants with worse outcomes are more likely to drop out. The team can:
- Make dropout probability depend on the unobserved follow-up score
- Compare power using complete-case analysis versus multiple imputation
This gives reviewers a clear, simulation-backed argument about how missing data assumptions affect power and bias.
For more on trial design and power, the NIH offers accessible guidance and examples at:
https://www.nia.nih.gov/research/blog/2021/07/sample-size-and-power-clinical-trials
Example 2: Clustered education study with multilevel modeling
Some of the clearest examples of simulation for power analysis: 3 practical examples come from education research, where data are almost always clustered: students within classrooms, classrooms within schools.
Scenario
A district wants to test a new reading curriculum in 4th grade. Schools are randomized to either adopt the new curriculum or stick with the existing one. Outcomes are end-of-year reading scores (standardized to mean 0, SD 1). Past data suggest:
- Intra-class correlation (ICC) at the school level: 0.10
- Average of 60 4th-graders per school
- Target effect: 0.25 SD improvement (small-to-moderate)
They’re debating between 20, 30, or 40 schools.
Why formulas struggle here
There are analytic formulas for cluster-randomized trials, but they often assume:
- Equal cluster sizes
- Simple two-level structure
- No covariates or only basic ones
In reality, this study has:
- Unequal school sizes (some with 40 students, some with 80)
- Two levels of clustering (students in schools, possibly also classrooms)
- Covariates like baseline scores and socioeconomic status
This makes it a perfect example of simulation for power analysis with multilevel modeling.
Simulation setup
The district’s statistician sets up a multilevel data-generating process:
Define structure
- Number of schools per arm (e.g., 10, 15, 20)
- Students per school: sampled from a distribution (e.g., 40–80)
Generate school-level random effects
- Each school has a random intercept capturing school quality
- Variance chosen so the school-level ICC is ~0.10
Assign treatment
- Randomize schools to treatment or control
Generate student-level data
- Baseline reading score for each student
- End-of-year score = baseline * 0.7 + treatment_effect + school_effect + error
- treatment_effect = 0.25 SD in treated schools, 0 in controls
Fit the planned model
- Mixed-effects model: score ~ treatment + baseline + (1 | school)
Repeat many times
- For each candidate design (20, 30, 40 schools)
- Estimate power as the proportion of simulations with treatment p < 0.05
What the simulation might show
A realistic outcome:
- 20 schools (≈1,200 students): ~63% power
- 30 schools (≈1,800 students): ~79% power
- 40 schools (≈2,400 students): ~89% power
This gives decision-makers a clear tradeoff: cost of recruiting more schools versus the risk of an underpowered study.
Additional education-focused examples
You can easily adapt this example of simulation for power analysis to:
- Three-level models: students within classrooms within schools
- Cross-classified designs: students belong to both neighborhoods and schools
- Stepped-wedge trials: schools gradually roll out an intervention over time
Researchers in education often lean on simulation because complex sampling and policy constraints make textbook formulas unrealistic. For background on multilevel modeling in education, see resources from the Institute of Education Sciences (IES):
https://ies.ed.gov/ncee/tech_methods/
Example 3: Logistic regression with a rare binary outcome
The third of our examples of simulation for power analysis: 3 practical examples deals with a binary outcome and logistic regression, where effects are expressed as odds ratios and events can be rare.
Scenario
A public health team is studying whether a new community-based intervention reduces 30-day hospital readmissions among older adults discharged after heart failure. They plan an observational cohort study with adjustment for confounders.
Based on recent U.S. data (see, for example, analyses summarized by the CDC and Medicare reports), they expect:
- 30-day readmission rate in the usual care group: about 20%
- Target odds ratio for the intervention: 0.75 (a 25% reduction in odds)
- Several covariates: age, sex, comorbidity index, prior hospitalizations
They want to know how many patients they need to detect this effect using a logistic regression model.
Why simulation is attractive here
Analytic power formulas for logistic regression exist, but they typically rely on approximations and can be awkward when:
- There are multiple correlated predictors
- The event is not extremely common or rare, but in the mid-range
- You care about how model misspecification or collinearity affects power
Simulation gives a direct way to explore these factors, making this a very practical example of simulation for power analysis.
Simulation setup
The team outlines a data-generating process:
Specify covariate distributions
- Age: normal with mean 75, SD 8
- Sex: 55% female
- Comorbidity index: Poisson with mean 3
- Prior hospitalizations: Poisson with mean 1.5
Specify logistic model parameters
- Intercept chosen so that the average readmission rate in usual care is ~20%
- Intervention coefficient corresponding to odds ratio = 0.75
- Coefficients for age, comorbidities, and prior hospitalizations based on literature or pilot data
Simulate a dataset for a given N
- Assign intervention vs usual care according to the planned design (e.g., 1:1 if randomized, or according to expected uptake if observational)
- Generate readmission outcome via the logistic model
Fit the planned analysis model
- Logistic regression: readmission ~ intervention + age + sex + comorbidity + prior_hosp
Repeat for many datasets
- For each N (e.g., 1,000, 2,000, 3,000 patients)
- Power is the proportion of runs with p < 0.05 for the intervention term
Exploring rare-event and imbalance issues
This example of simulation for power analysis becomes even more informative when you:
- Lower the baseline event rate to, say, 10% to see how power drops
- Increase imbalance between groups (e.g., 70% usual care, 30% intervention)
- Add misclassification of the outcome (e.g., some readmissions not captured)
- Test different modeling strategies, like Firth’s penalized logistic regression for rare events
For more on logistic models in medical research, the NIH’s National Library of Medicine has tutorials and articles through PubMed and MedlinePlus:
https://medlineplus.gov/statistics.html
Other real examples where simulation for power analysis shines
Beyond these three flagship scenarios, there are several other real examples of simulation for power analysis that come up constantly in 2024–2025:
Time-to-event (survival) studies with staggered entry
Oncology trials and cardiovascular studies often use Cox proportional hazards models with staggered enrollment and varying follow-up. Simulation can:
- Model accrual over calendar time
- Include competing risks (death from other causes)
- Account for loss to follow-up
Adaptive and group-sequential designs
When you want interim looks at the data, simulation helps evaluate:
- Power under different stopping rules
- Type I error inflation
- Expected sample size under various true effect sizes
Nonlinear dose–response or spline models
Toxicology and pharmacology studies often test several dose levels with a nonlinear response. Simulation supports:
- Flexible dose–response curves
- Identification of the minimum effective dose
- Power to detect nonlinearity
These are some of the best examples where simulation-based power analysis is not just a nice-to-have, but practically the only realistic option.
Practical tips: turning examples into your own simulation
Looking across these examples of simulation for power analysis: 3 practical examples, a common pattern emerges:
- Start from a plausible data-generating story, not from the software menu.
- Use realistic parameter values from pilot data, prior studies, or expert opinion.
- Simulate the exact analysis model you plan to use, including covariates and clustering.
- Run enough iterations (often 1,000–5,000) to stabilize your power estimate.
- Summarize results in a simple table or chart for your protocol or grant.
If you want step-by-step code examples, many universities now publish open course materials. For instance, Harvard and other institutions share R-based power simulation tutorials that you can adapt to your own design:
https://projects.iq.harvard.edu/hcbi/book/simulation
FAQ: Common questions about simulation for power analysis
Why use simulation for power analysis instead of standard formulas?
Simulation is especially helpful when your design has clustering, non-normal outcomes, multiple covariates, or adaptive features. The best examples of simulation for power analysis show that you can mirror your planned analysis exactly, rather than forcing your study into a simplified formula that ignores key features of the design.
How many iterations do I need in a simulation-based power analysis?
For most applied work, 1,000–5,000 iterations per scenario are common. More iterations reduce Monte Carlo error but increase computation time. In many of the real examples of simulation for power analysis described above, 2,000 iterations strike a good balance.
What is an example of simulation for power analysis in a small pilot study?
A classic example of simulation for power analysis in a pilot context is testing whether a small feasibility trial can reliably detect large safety signals. You might simulate 50–80 participants, rare adverse events, and different thresholds for stopping the study early if problems emerge. This doesn’t replace a definitive trial, but it informs whether your pilot can at least flag major concerns.
Do I need advanced software to run these examples of simulation for power analysis?
No. Most examples of simulation for power analysis: 3 practical examples can be implemented in standard tools like R, Python, or even Stata and SAS. Packages like simr (R) extend mixed-effects models for power simulation, while base R or Python’s statsmodels and scikit-learn can handle logistic and linear models with custom loops.
How do reviewers view simulation-based power analysis?
In 2024–2025, major funders and journals increasingly welcome simulation-based power analyses, especially for complex designs. What matters is transparency: clearly state your assumptions, show the code or pseudocode, and present results in a way that connects back to your study aims. Many methodologists now argue that, for complex trials, the strongest examples of simulation for power analysis are more informative than forced, oversimplified analytic formulas.
Related Topics
Practical examples of effect size calculations for power analysis
Practical examples of G*Power power analysis examples for real studies
Practical examples of statistical power analysis for t-tests
Real‑world examples of power analysis for mixed-design ANOVA
Best examples of power analysis for ANOVA examples in real research
Examples of Simulation for Power Analysis: 3 Practical Examples Researchers Actually Use
Explore More Statistical Power Analysis Examples
Discover more examples and insights in this category.
View All Statistical Power Analysis Examples