Features
What this calculator does that others don’t
Most cluster trial sample size tools implement one design and one variance formula. This one lets you draw an arbitrary allocation schedule, compare designs side by side, choose among ten inference methods, and export a full audit of the computation.
Design
Draw the trial instead of picking from a menu
Click a cell to cycle it between control, intervention and not enrolled. Right-click a row or column header to insert, delete, or set a whole sequence or period at once. Presets give you the standard shapes — parallel, parallel with baseline, stepped wedge, stepped wedge with an implementation period, cross-over, cross-over with washout, staircase — but they are starting points, not constraints.
This matters because real trials rarely match a textbook diagram. Sites join late, a period is lost to a service reorganisation, one arm has a transition phase where data aren’t analysable. A tool that only knows “stepped wedge” cannot cost those designs. Here you draw the schedule that will actually happen, set the number of clusters per sequence independently, and, if cluster-period sizes differ, set each cell size individually.
Inference
Ten estimators, not one
Power depends on how you will analyse the trial, and the difference is not small. A mixed model with a normal approximation and a GEE with a robust sandwich variance can disagree by twenty percentage points of power on the same design with fifteen clusters. Reporting only the optimistic one is how underpowered trials get funded.
The calculator offers model-based inference with a z- or t-test, Satterthwaite and Kenward–Roger small-sample corrections, GEE with independence or exchangeable working correlation and robust variance, and a classical design-effect calculation for comparison. Switching estimator recomputes immediately, so you can see the spread rather than guess at it.
Comparison
Up to three designs open at once
Sample size decisions are comparative. Is it cheaper to add clusters or to recruit more people per cluster? Does a baseline period buy back enough precision to justify the extra year? Does the staircase design lose much against the full stepped wedge?
You can hold three designs in the same session, each with its own allocation grid and its own parameters, and see power, degrees of freedom, standard error, and minimum detectable effect for all three in one table. Plots overlay the designs on the same axes. Duplicating a design and changing one thing is a two-click operation.
Optimal design
Optimal weights, shown on the grid
Given a design and a correlation structure, some cluster-periods carry far more information about the treatment effect than others. The calculator solves for the optimal allocation weights and renders them directly onto the grid: cells shrink in proportion to how little they contribute.
Cell weights show where individual observations are most valuable. Row weights show how clusters should be distributed across sequences — often strikingly non-uniform in a stepped wedge, where the middle sequences are worth more than the first and last. You can use this to reallocate recruitment effort, or simply as a diagnostic for whether a design is wasting data.
Diagnostics
Warnings when the numbers should not be trusted
Two failure modes are common enough that the calculator watches for them.
Optimistic inference. If your selected estimator reports power more than ten percentage points above the most conservative alternative, you get a warning naming the gap and suggesting a small-sample correction or a robust variance. This is almost always a signal that the cluster count is too small for the asymptotics you have chosen.
Incompatible correlation parameters. For binary and count outcomes, an ICC and individual autocorrelation specified on the observed scale must be translated into random effect variances on the link scale, and not every combination is achievable. Some require a latent variance so extreme that individuals are effectively deterministic. The solver reports when this happens, distinguishing “high but usable” from “implausible” from “no solution found”, so you know whether the power figure means anything.
Export
A verification bundle you can hand to a reviewer
This is the feature with no equivalent anywhere else. One click exports an archive containing the design matrix, the assumed covariance matrix, the information matrix and its inverse, the bread and meat of the sandwich estimator, the fitted parameter vectors, the resulting standard error and degrees of freedom — plus an R script that recomputes the standard error from those matrices and checks it against the reported value.
The point is that nobody has to take the calculator’s word for anything. A statistical reviewer, a CTU quality process, or a regulator can reproduce the number independently in a few minutes. If your trials unit will not accept a sample size from a web app, this is the answer to that objection.
Export
Publication-ready diagrams and plots
Export the allocation grid as a PNG for your protocol or grant application. Export power curves and power surfaces as PNG or SVG at publication resolution. Plot power or minimum detectable effect against ICC, cluster-period size, treatment effect, baseline prevalence, or total clusters, over a range you set, with a target power reference line. Heatmap and contour views show power across cluster count and cluster size simultaneously.
Sessions
Save the session, come back to it
Export all open designs, with their parameters and results, to a JSON file, and import it later to resume exactly where you stopped. Sample size calculations get revisited — when a reviewer questions an assumption, when funding changes the number of sites, when the ICC estimate is updated from pilot data. Keeping the file alongside the protocol means the next revision takes minutes.
Privacy
Everything runs in your browser
The statistical engine is compiled to WebAssembly and executes locally. No design, parameter, or result is transmitted anywhere. There is no account, no login, and nothing to install.
Start here
Your first calculation
A ten-minute walkthrough from empty grid to exported bundle.
Stepped wedge sample size
The model, the parameters, and a worked example.
Choosing an estimator
What each method assumes and when it misleads.