Algoria Methods Lab · Trial Planner 1.0.0

Clinical trial sample size, power and assumption sensitivity

Two independent groups · binary outcome at a fixed horizon · one final test

Method, assumptions and worked example

Prospective planning for an individually randomized parallel trial, one binary outcome, independent participants and no covariate adjustment. The hypothesis is equality of marginal risks. RD = treatment minus control; a clinical-importance threshold does not replace the null hypothesis.

Synthetic example: control risk 30%, treatment risk 20%, allocation treatment:control 1:1, two-sided alpha 0.05 and target power 90%. The minimum is 392 evaluable participants per arm, 784 total. With 12% commonly missing usable outcomes: randomize 446 per arm, 892 total.

Pooled null risk p̄ = (nT pT + nC pC)/(nT+nC). V0 = p̄(1−p̄)(1/nT+1/nC); V1 = pT(1−pT)/nT + pC(1−pC)/nC. With d=pT−pC and z=Φ⁻¹(1−α/2), two-sided power = Φ((d−z√V0)/√V1) + Φ((−d−z√V0)/√V1). One-sided tests use z=Φ⁻¹(1−α) and only the declared tail.

Counts use integer allocation blocks. For usable k blocks and common missing fraction q, randomize ceil(k/(1−q)) blocks. With an available randomized budget N, use floor(N/(aT+aC)) blocks and floor(kRandom(1−q)) usable blocks. The remainder is unassigned. This conditional convention preserves allocation; it is not marginal power over random dropout.

Normal approximation without continuity correction (two-proportion-pooled-z-v1). Risks strictly between 0 and 1; alpha 0.0001–0.20; target power 0.50–0.999; missing fraction 0–0.99; up to 1,000,000 per arm. Expected cells below 10 trigger caution, not a validity threshold. Finite-sample rejection may differ from the approximation. Trial Lab instead simulates Fisher tests and Newcombe intervals.

Independent numerical checks: R/stats 4.5.2 and statsmodels 0.15.0; 21 power cases, 8 sample sizes and 10 ordered-grid detectable differences. TypeScript power differs from references by at most 8.5×10⁻¹⁵ (tolerance 10⁻⁸). Exact binomial enumeration of 741 pooled-Z cases exposes finite-sample departures: with 20 per arm and risks 50%/50%, rejection is about 4.253%, even with all expected cells equal to 10. This evidence covers tested cases, not clinical validation or a universal power guarantee. Tool 1.0.0; schema 1; method two-proportion-pooled-z-v1; 15 October 2026.

R stats · power.prop.test (strict=TRUE) · statsmodels · power_proportions_2indep

Questions before using the result

Does 90% power mean a 90% chance of benefit?

No. Two-sided power is approximate rejection in either direction under the assumed risks. It is not probability that treatment works, clinical benefit or programme success.

What stays fixed when baseline risk changes?

Choose fixed RD or fixed RR. They define different alternatives and can produce different sample-size patterns. Scenarios are conditional assumptions, not confidence intervals or Bayesian assurance.

Does inflation solve missing data?

It only compensates planned information counts under a simple common retention assumption. It neither removes missing-data bias nor recommends a complete-case analysis. Define intercurrent events and the estimand separately.

What does the detectable difference mean?

The first absolute RD reaching target on a 0.01 percentage-point grid, in the declared direction. It is not a clinical-importance threshold or continuous-domain optimum. Sensitivity freezes the solved base effect.

In-memory calculation. No scientific inputs in storage, cookies, URLs, analytics, logs or automatic submissions. Downloads are explicit local actions. Reloading resets the example. Do not enter confidential or identifiable information.

Need survival, non-inferiority, clustering, interims, multiple endpoints, covariates or complex estimands? Discuss a separately specified design.

Request a study design review

Related tools

Effect Translator · Trial Lab