Methods
Correlation structures and sampling
In a longitudinal cluster trial, the assumption you make about how correlation decays over time can change the required sample size by a factor of two. It deserves more thought than it usually gets.
The intracluster correlation
For a continuous outcome with a cluster random effect of variance \(\tau^2\) and residual variance \(\sigma^2\), the correlation between any two individuals in the same cluster is
$$\rho = \frac{\tau^2}{\tau^2 + \sigma^2}$$
This single number is what makes cluster trials less efficient than individually randomised ones: observations within a cluster carry partly redundant information. In a single-period parallel trial it is the only correlation parameter you need. As soon as there is more than one period, it is not enough — you must also say how correlation behaves across periods.
The four structures
Exchangeable
$$\operatorname{Cor}(Y_{ijt}, Y_{i'jt'}) = \rho \quad \text{for all } t, t'$$
Correlation is the same regardless of separation in time. The cluster effect is a single constant shift that persists undiminished for the whole trial. Simple, and the assumption underlying the original Hussey and Hughes calculations, but strong: it implies a practice measured in month 1 and month 36 is as similar to itself as it is between consecutive months.
Nested exchangeable
$$\operatorname{Cor} = \begin{cases}\rho & t = t' \\ \rho \times \text{CAC} & t \neq t'\end{cases}$$
Adds a cluster autocorrelation (CAC) that discounts all between-period correlation by a constant factor. Within-period correlation stays at \(\rho\); between-period correlation drops to \(\rho \times \text{CAC}\) regardless of how far apart the periods are. A CAC of 1 recovers exchangeability. Values of 0.7–0.95 are commonly reported.
This is a good default when you believe correlation decays but have no basis for specifying a rate. It is implemented as a second random effect nested within cluster-period.
Exponential decay
$$\operatorname{Cor}(Y_{ijt}, Y_{i'jt'}) = \rho\,\lambda^{|t - t'|}$$
Correlation decays geometrically with the number of periods separating the observations, at a rate governed by \(\lambda \in (0,1)\). More realistic for long trials where cluster composition, staffing, and case mix all drift. Sometimes called a discrete-time AR(1) structure for the cluster effect.
Exponential function
$$\operatorname{Cor}(Y_{ijt}, Y_{i'jt'}) = \rho \exp\!\left(-\frac{|t - t'|}{\ell}\right)$$
The same idea parameterised by a lengthscale \(\ell\) in period units, which is easier to elicit: a lengthscale of 4 means correlation falls to about 37% of its within-period value after four periods. Useful when periods are irregularly spaced or when you want to reason about decay in real time rather than period counts.
Structures are ordered from most to least favourable to longitudinal designs. A stepped wedge that looks comfortably powered under exchangeable correlation can fall well below 80% under exponential decay with a plausible rate. Because the assumption is rarely testable in advance, the defensible approach is to compute power under more than one structure and report the least favourable. The calculator lets you hold two designs side by side that differ only in this assumption.
Sampling structure
Who is measured in each period changes the correlation structure independently of the cluster effect.
| Structure | Meaning | Extra parameter |
|---|---|---|
| Cross-sectional | Different individuals measured each period | — |
| Closed cohort | The same individuals measured every period | IAC |
| Open cohort | A cohort with turnover between periods | IAC, replacement rate |
The individual autocorrelation (IAC) is the correlation between repeated measurements on the same person, over and above the correlation induced by shared cluster membership. Cohort designs are usually more efficient than cross-sectional ones, because each individual acts partly as their own control — but this depends on the IAC being substantial, and it comes at the cost of attrition risk.
The replacement rate in an open cohort is the proportion of individuals replaced between consecutive periods. Zero recovers a closed cohort; one recovers a cross-sectional design. Intermediate values interpolate, which is usually a better description of a real service population than either extreme.
Why binary outcomes make this hard
For a continuous outcome, ICC and IAC map directly onto variance components. For binary and count outcomes they do not, and this is a genuine difficulty rather than an implementation detail.
You specify correlations on the observed scale, because that is the scale on which they are reported and understood. But the model is fitted on the link scale, with random effects entering a logit or log linear predictor. Translating between the two requires solving for the random effect variances that induce the requested observed-scale correlations, given the baseline prevalence. That solution does not always exist, and when it does it is not always sensible.
The reason is that a binary outcome’s variance is bounded by its mean. To achieve a high correlation between repeated binary measurements on the same individual, the model needs a large individual-level random effect variance — and a large variance on the logit scale pushes individual response probabilities toward 0 and 1. In the limit, the model says every individual either always responds or never does, and the observed prevalence arises entirely from the mix of types in the population rather than from any within-person uncertainty. That is a coherent model, but it is rarely what anyone intends, and power under it can be very different from power under a moderate-variance model.
What the warnings mean
| Level | What the solver found | What to do |
|---|---|---|
| Moderate | A solution exists but requires high random effect variance | Usable. Compare conditional and marginal estimators — they may diverge noticeably. |
| Severe | A solution exists but requires extreme variance, implying near-deterministic individuals | Reconsider the parameters. Lower the IAC or raise the ICC toward a more plausible combination. |
| Failure | No valid parameters found | The requested combination is not achievable in this model. Power output is unreliable and should not be used. |
These warnings appear only for non-continuous outcomes with a cohort sampling structure and a non-zero IAC, which is where the problem arises.
Where to get correlation estimates
- Published ICC databases for primary care and hospital outcomes, which give plausible ranges by outcome type and cluster definition.
- Routine data for the same outcome in the same setting, which is usually the best available source and often already accessible.
- Previous trials in the same clusters, if any — but check the cluster definition matches, since ICCs at practice level and at ward level are not interchangeable.
Whatever the source, treat the estimate as uncertain and plot power across a range. An ICC point estimate from a study of thirty clusters has a wide confidence interval, and propagating that uncertainty into the sample size is more honest than picking the midpoint.