Each simulated patient has a hidden true recovery probability: a shared baseline, plus the drug's real effect size if assigned to the treatment group, plus random individual variability (noise). Whether a given patient actually recovers is then one weighted coin flip per patient — the same two-layer randomness (individual heterogeneity + trial-outcome chance) that makes real trials noisy even when a drug truly works.
Randomization assigns each patient to treatment or control purely by chance, which is what makes the two groups comparable on everything except the drug. The trial then compares recovery proportions with a two-proportion z-test:
p̂ = (x₁+x₂)/(n₁+n₂) pooled proportion
SE = √( p̂(1−p̂)·(1/n₁ + 1/n₂) )
z = (p₁ − p₂) / SE
p-value = 2·(1 − Φ(|z|)) two-tailed, Φ = normal CDF
- Sample size (N) — total patients split ~evenly into the two arms; a bigger trial shrinks the standard error, narrowing the confidence interval and stabilizing the p-value run to run.
- True drug effect size — the real recovery-probability boost the drug gives, hidden from the "trial" — only the observed proportions are visible in the results.
- Patient variability — how much individual patients differ from the group average; more noise means more overlap between arms and a harder signal to detect at a given N.
- 95% CI — the observed effect ± 1.96·SE; if it excludes zero, the result matches p<0.05 significance.
Real-world relevance: this is the same statistical logic behind every Phase II/III randomized controlled trial — a real drug effect can still produce a non-significant result in an underpowered (too small) sample, which is why trial sample sizes are calculated in advance.