Method · Statistics Library

DOE power simulation (Monte Carlo)

This answers whether a designed experiment can detect an effect of a given size by literally simulating the experiment thousands of times under an assumed true effect and counting how often the test would actually detect it, cross-checked against the closed-form analytic power formula.

Topic indexA reference reading outside the guided chapter sequence

Understand the idea

Ordinary power calculators use a formula to tell you, in advance, roughly how likely your planned experiment is to detect a real effect of a given size. This tool answers the exact same question a completely different way: it actually SIMULATES your experiment thousands of times on a computer, each time pretending a specific true effect really exists, adding realistic random noise, running the exact statistical test you would actually run, and simply counting what fraction of those thousands of simulated experiments would have detected the effect.

Why bother simulating when a formula already exists? Two reasons. First, it builds genuine trust: if the simulated number and the formula's number agree closely (they should, up to a small amount of expected simulation randomness), that is independent confirmation the formula is being applied correctly to YOUR exact design, not just in general. Second, it generalizes: the same simulate-and-count recipe works even in situations where no tidy formula exists at all.

Because the simulation itself involves randomness, the resulting 'empirical power' number has its own small amount of noise attached: run the same simulation twice with different random seeds and you'll get slightly different answers, converging closer together as you run more simulated trials. This uncertainty (the Monte Carlo standard error) is reported explicitly alongside the headline power number, rather than presenting the simulated result as if it were perfectly exact.

A DOE power simulation estimates Monte Carlo power: it generates many simulated experiments with the effect you expect and counts how often the analysis detects it, giving the simulated power.

Practitioner explanation

KernelStats assumes every model term (main effect, interaction, or quadratic, per the chosen model) has a true effect of size effect_size expressed in units of the noise standard deviation sigma (the effect size option is the true regression COEFFICIENT per coded unit: with factors coded -1/+1, an effect size of 1 means the response moves by 1 sigma per coded unit, i.e. by 2 sigma from the low to the high setting), simulates y = X*beta_true + noise with noise ~ Normal(0,1), REFITS the model by ordinary least squares on each simulated dataset, tests each term at the chosen alpha, and records detection (p < alpha). This loop repeats n_simulations times (default within a documented range) and empirical power is simply the detection fraction: the same t-tests used elsewhere in the DOE section, so the simulated and analytic power numbers are directly comparable rather than being computed by two unrelated methods that happen to answer a similar question.

The Monte Carlo standard error of the empirical power estimate is reported explicitly: sqrt(p-hat*(1-p-hat)/n_sim), stated to be usually well under 0.02 at the default 2,000 simulations, small enough to trust the headline number, but reported rather than hidden, so the analyst can judge the estimate's own precision directly rather than treating a single simulated run as infinitely precise.

This is a design-time PLANNING tool: it requires only a design/run table of factor columns, with NO response data needed at all, since power is simulated under an ASSUMED true effect rather than estimated from data already collected. Because it reuses the same t-tests as the rest of the DOE analysis section, agreement between the simulated and closed-form analytic power (reported side by side) is itself evidence that both the simulation and the underlying formula are being applied correctly to this specific design, a genuine cross-check the product treats as a first-class output, not an afterthought.

When to use it

Consider it when

You have a candidate design (generated or imported) and want to verify, by direct simulation rather than trusting a formula alone, whether it can realistically detect an effect of an assumed size for each model term.

Use caution when

You have already collected response data and want to test an actual observed effect (use the appropriate hypothesis test, not this planning tool), or a simple closed-form power calculation already suffices and the added confirmation from simulation is not needed (use the power and sample size calculator for the simpler standard designs it covers).

Formulas and symbols

Simulated response

y=Xβtrue+ε,ε∼N(0,1)y = X\beta_{\text{true}} + \varepsilon, \qquad \varepsilon \sim N(0, 1)

beta_true set from the assumed effect_size (in noise-SD units); X the design matrix for the chosen model (main effects, interactions, or quadratic).

Empirical (simulated) power

p^=#{simulated trials with p<α}nsim\hat p = \dfrac{\#\{\text{simulated trials with } p < \alpha\}}{n_{\text{sim}}}

The fraction of simulated replicates in which the term was detected at the chosen alpha; compared directly to the closed-form analytic power.

Monte Carlo standard error of the power estimate

SE(p^)=p^(1−p^)nsimSE(\hat p) = \sqrt{\dfrac{\hat p(1-\hat p)}{n_{\text{sim}}}}

Usually well under 0.02 at the default 2,000 simulations; reported explicitly rather than presenting the simulated power as exact.

Assumptions and checks

  • This is a Monte Carlo POWER SIMULATION based on the analyst's assumed effect sizes, noise level, and design; it does not run on any collected data, so it cannot detect whether those assumptions are realistic for the actual process being studied.

    In KernelStats: Not applicable: there is no data to check assumptions against; the assumed effect sizes and noise are required inputs, not validated against any prior study.

  • Normality (of residuals, not of the raw data). The simulated power numbers assume the noise added to each simulated run is normally distributed and independent from run to run, matching the assumptions of the standard analysis the design will later use; a process with genuinely different noise behavior (heavy tails, autocorrelated noise) will see different real-world power than simulated here.

    In KernelStats: Not checked by KernelStats: the simulation always draws normal, independent noise; there is no option to simulate a different noise distribution.

Alternatives

  • Power & Sample Size. The design fits one of the standard closed-form cases (t-test, ANOVA, two-proportion, chi-square goodness-of-fit) and a simulation-based cross-check is not needed.
  • Design of Experiments (2-Level Factorial). The experiment has already been run and you want to analyze the actual collected response data rather than simulate power before running it.

Worked example

Scenario

A 16-run 2^4 full factorial (four factors coded -1/+1) analyzed with the interaction model (main effects plus two-factor interactions, 5 residual df), every term's coefficient assumed equal to 1 noise SD (effect_size = 1, so a 2-sigma change from low to high), simulated 2,000 times at alpha = 0.05 with the default seed.

Result

For main effect A: empirical power = 88.5% (Monte Carlo SE = 0.7%), analytic power = 88.7%; the weakest term's empirical power is 87.5%. Under the main-effects-only model (11 residual df) the same design reaches about 95%.

Interpretation

The close agreement between simulated and analytic power (within the Monte Carlo margin) confirms the analytic formula is being applied correctly to this design. Roughly 88% power means a term of this size would be missed about one time in eight, and the drop from 95% to 88% when interactions are added shows the price of spending residual degrees of freedom on extra model terms.

Common misconceptions

Misconception

The empirical power number from a Monte Carlo simulation is an exact answer, unlike a formula-based power calculation which has rounding error.

Correction

The empirical power estimate has its own genuine sampling noise from the simulation's randomness, quantified by the Monte Carlo standard error (sqrt(p-hat*(1-p-hat)/n_sim)); it is not exact, and running the same simulation with a different random seed would give a slightly different number. The product reports this standard error explicitly precisely because the simulated result is an estimate, not a precise closed-form value.

Misconception

If the simulated and analytic power numbers disagree meaningfully, the simulation must be buggy.

Correction

The two methods are expected to agree closely (within the reported Monte Carlo margin) specifically because they test the SAME model terms with the SAME underlying t-tests. A meaningful disagreement is a genuine signal worth investigating: it could indicate the analytic formula's assumptions do not quite hold for this specific design, or a specification mismatch between the two, not something to dismiss as simulation noise if it exceeds the reported standard error by a wide margin.

References

  1. Design and Analysis of Experiments, Montgomery, D. C. (2019).
  2. Statistical Power Analysis for the Behavioral Sciences, Cohen, J. (1988).