Sample size and statistical power
Repeat virtual trials and see how the true difference, variability and sample size affect detection.
Simulation settings
01 / SIMULATIONIndependent normal populations with equal SD; population mean A is 0. Using the same parameters and random seed reproduces results.
Repeated trial results
Each bar is an independent virtual trial: height is the sample mean difference, and color indicates whether the two-sided Welch t test reaches α = 0.05.
Set parameters and run simulations.
Sample mean difference B − A per trial · Bars extend downward for negative sample mean differences.
How to interpret
The detection rate is the frequency of rejecting equal means under the specified simulation conditions; when the true difference is 0, it represents the simulated false-positive rate. It does not guarantee success in a single trial or establish clinical importance.
A finite simulation has Monte Carlo variation; standard error is approximately √[p̂(1−p̂)/number of simulations].
Synthetic educational data. Actual sample size planning also requires clinical effect, design, attrition, test method and prior evidence.
NIST: sample size and power ↗