Counts and Rates
Sample-size calculation for comparing recurrent event rates with the Andersen-Gill model and robust Wald test (Tang & Fitzpatrick, 2019). Specify a Weibull baseline event-rate function, treatment event-rate ratio, overdispersion, dropout, treatment duration, allocation, and power. Runs entirely in your browser.
This calculator implements the sample-size procedure proposed by Yongqiang Tang and Ronan Fitzpatrick for the robust Wald test from the Andersen-Gill model. The method accommodates recurrent events whose baseline rate may vary over time and accounts for within-subject heterogeneity through a dispersion parameter.
The treatment effect is represented by the recurrent-event rate ratio exp(β). For a Weibull control-arm rate function, the calculator uses:
Here ψ controls the scale of the baseline event-rate function and ν controls its shape. The treatment arm has rate λ1(t) = exp(β)λ0(t).
Under equal dropout distributions in the two treatment groups, Tang and Fitzpatrick express the large-sample variance component as:
where p1 is the treatment allocation proportion, p0 = 1 − p1, and κ describes between-subject heterogeneity. With a common dispersion parameter κ, the second term uses the same κ in both groups.
The exposure-weighted quantities are:
For exponential loss to follow-up with rate δ and fixed treatment duration τc, the retention probability is π(t) = exp(−δt). The calculator evaluates the resulting integrals numerically, which is equivalent to the incomplete-gamma expressions given in the paper for the Weibull model.
For superiority or noninferiority testing, the required continuous sample size is:
For the one-sided option, the calculator uses z1−α for the critical value. For the two-sided option it uses z1−α/2. For a superiority calculation, M0 = 1, so the denominator becomes β2. The final sample size is rounded upward because fractional participants are not possible.
Design 2 allows enrollment over an accrual period τa, followed by an additional treatment period τc. For uniform accrual (η = 0), the retention probability after the recruitment period is:
The 2022 correction to Tang and Fitzpatrick specifically affects the staggered-entry calculation. This implementation uses the corrected retention expression rather than the original erroneous Appendix A4 expression. The correction does not affect Design 1.
The published CGD example uses ψ = 1.1, ν = 1.2, event-rate ratio = 0.6, κ = 0.8, δ = 0.25, τc = 1 year, 90% power, and a one-sided α = 0.025. With equal allocation, the calculated continuous sample size is approximately 364.61 and therefore rounds to 365 participants. With a 2:1 treatment:control allocation (p1 = 2/3), the continuous result is approximately 389.26 and therefore rounds to 390 participants. These reproduce the published Design 1 values.
Tang, Y. & Fitzpatrick, R. (2019). Sample size calculation for the Andersen-Gill model comparing rates of recurrent events. Statistics in Medicine, 38(24), 4819–4827. DOI: 10.1002/sim.8335.
Tang, Y. & Fitzpatrick, R. (2022). Sample size calculation for the Andersen-Gill model comparing rates of recurrent events. Correction. Statistics in Medicine, 41(20), 4079. DOI: 10.1002/sim.9518.
Andersen, P.K. & Gill, R.D. (1982). Cox's regression model for counting processes: a large sample study. The Annals of Statistics, 10, 1100–1120.