Sample size and power
Set the assumptions; the sample size, the power curve and a protocol-ready paragraph update as you type.
If the true effect is smaller
A starting point for your protocol or study proposal. Agree the assumptions with your statistician before you rely on them.
Run the trial thousands of times
Every virtual trial enrols patients, draws their outcomes at random and runs the planned test. The share that succeeds is your real power.
Observed effects
Power, trial by trial
Read a published result
Turn a hazard ratio, risk ratio, odds ratio or raw event counts into absolute numbers you can say out loud.
100 patients like those in the trial
NNT depends on baseline risk
Test performance in the real world
Sensitivity and specificity describe the test. Predictive values describe what a result means for the person in front of you, and they move with prevalence.
1,000 people tested
Predictive values by prevalence
Methods and validation
Every number comes from a published method. On this device, right now, the app re-checks itself against reference values computed with independent statistical software.
The full suite (88 checks, including random-number generators and simulated versus planned power for eight designs) ships with the source code: tests/validate.js.
Methods
- Two proportions: normal approximation with pooled variance under the null (Fleiss 1981). Non-inferiority: unpooled variance, one-sided test (Blackwelder 1982).
- Two means: equal-variance t-test; power from the shifted central t approximation to the noncentral t, smallest whole sample reaching the target.
- Time to event: required events from Schoenfeld (1981), with Freedman (1982) shown for comparison. Patients from exponential survival, uniform accrual, extra follow-up and exponential dropout.
- Simulation: each trial draws every patient (time to event) or the sufficient statistics (binomial counts; sample means and pooled variance). Binary: pooled z-test. Continuous: t-test. Time to event: log-rank test, hazard ratio by the Peto method, analysis when the target number of events is reached.
- Uncertain effect (assurance): each simulated trial draws its true effect from a normal distribution (log scale for hazard ratios) matching the plausible range you enter (O'Hagan, Stevens & Campbell 2005).
- Absolute effects: treated-arm risk from a hazard ratio as 1 − (1 − control risk)HR (Altman & Andersen 1999); NNT confidence intervals as NNTB/NNTH (Altman 1998); p from a confidence interval (Altman & Bland 2011).
- Event counts: risk ratio (log method), odds ratio (Woolf), risk difference with the Newcombe hybrid score interval, Fisher's exact test, fragility index (Walsh et al. 2014).
- Random numbers: xoshiro128** seeded by splitmix32, so a seed reproduces a run exactly. Binomial draws by inversion or BTRS (Hörmann 1993); gamma by Marsaglia & Tsang (2000).
Limits
- Designs cover two-arm, fixed-sample trials. No interim analyses, multiplicity adjustment, clustering, crossover or adaptive designs.
- Time-to-event designs assume proportional hazards and exponential survival. Real survival curves often bend; the simulation shows how the formula behaves under its own assumptions, not under yours.
- The Schoenfeld formula is known to be slightly optimistic for strong effects: the simulation usually lands a point or so below the planned power. That is the method, not a bug.
- Interpret uses the trial's own control-arm risk unless you change it. Absolute numbers are only as good as that baseline.
- A planning and teaching aid. Final sample sizes belong to a qualified statistician; anything used externally goes through Medical, Legal and Regulatory review.
Nothing you type leaves this device. Inputs are kept in this browser's local storage so they survive a reload; "Copy link" puts them in the link itself, after the #, which browsers never send to a server.