Statistical Calculators › Counts and Rates › Recurrent Event (Andersen-Gill) Sample Size Calculator
← All Calculators

Counts and Rates

Recurrent Event (Andersen-Gill) Sample Size Calculator

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.

Trial Design

The default values reproduce the published CGD Andersen-Gill example.
The treatment allocation is the proportion assigned to the experimental treatment. Thus 0.667 represents a 2:1 treatment:control ratio. Lower event rates are assumed to be favorable.

Sample Size

Calculated from the Andersen-Gill robust Wald variance and rounded up to the next whole participant.
Enter design assumptions and click Calculate Sample Size.

Methodology

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.

Andersen-Gill model

The treatment effect is represented by the recurrent-event rate ratio exp(β). For a Weibull control-arm rate function, the calculator uses:

λ0(t) = ψνtν−1
Λ0(t) = ψtν
exp(β) = event-rate ratio

Here ψ controls the scale of the baseline event-rate function and ν controls its shape. The treatment arm has rate λ1(t) = exp(β)λ0(t).

Robust variance

Under equal dropout distributions in the two treatment groups, Tang and Fitzpatrick express the large-sample variance component as:

Vβ = [1/(p1exp(β)) + 1/p0] / E0 + [(κ1/p1) + (κ0/p0)] × 2F0/E02

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:

E0 = ∫0τ π(t)dΛ0(t)

F0 = ∫0τ π(t)Λ0(t)dΛ0(t)

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.

Sample-size equation

For superiority or noninferiority testing, the required continuous sample size is:

n = [(z1−α*/2 + zP)2 Vβ] / [log(M0) − β]2

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.

Staggered-entry design

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:

π(t) = exp(−δt),    t ≤ τc
π(t) = exp(−δt) (τ−t)/τa,    τc < t ≤ τac

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.

Validation example

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.

Important limitations

References

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.