Mathematics · Simulator 052
Run the same experiment thousands of times. When there is no real effect, see how often you still get “significant” results (false positives). When there is a real effect, see how often you detect it (power), and how both depend on sample size and the significance threshold.
Each simulated experiment compares a treatment group with a control group (n per group, values with standard deviation 1). A two-sample z-test gives a p-value: the probability of a difference at least this large if there were no real effect (the null hypothesis).
The “peek and stop” option checks after every 10 participants and stops as soon as p < α. That inflates false positives well above α, a common real-world error.
Normal data with known variance (z-test) for clarity. Real studies often use t-tests and face many other issues.
How many participants per group do you need for 80% power to detect d = 0.5 at α = 0.05 (two-sided)?
Need d√(n/2) ≈ 1.96 + 0.84 = 2.80, so √(n/2) = 5.6 and n ≈ 63 per group. Set d = 0.5 and n = 63 and check that the measured power is near 80%.