Tutorials › Competing Risks and Multi-State Models › Andersen-Gill Model Specification

Recurrent-Event Estimands and Models · Tutorial 574 of 699

Andersen-Gill Model Specification

Learn to write an Andersen–Gill model precisely, define who is at risk at each time, and assess whether the model’s shared-baseline assumptions fit a recurrent-event question.

Advanced 12 min read

What You'll Learn

  • Write the Andersen–Gill conditional intensity using a common baseline hazard.
  • Define the counting-process risk indicator, including entry, censoring and continued follow-up after recurrence.
  • Distinguish the total-time clock from a clock that resets after each event.
  • Specify fixed and time-varying covariates using information available just before each time.
  • Check the model’s assumptions and recognize risk-set or clock choices that change the model.

Why Specify the Model Before Fitting It?

A recurrent-event model is defined not only by a formula for event rates, but also by when the subject is considered at risk, which clock determines baseline risk, and which information may enter the covariates. The Andersen–Gill model combines these choices in a counting-process formulation. Its defining feature is a common baseline hazard for all recurrences on a shared total-time scale, with covariate effects applying to the subject’s conditional event intensity.

The specification matters because the same observed event history can support different scientific questions. A model that keeps a person at risk after a recurrence asks about the intensity of further events during ongoing follow-up. Removing that person after the first recurrence would instead describe a first-event process. Likewise, resetting the time origin after each event changes the role of the baseline hazard.

Definition: For subject \(i=1,\ldots,n\), let \(N_i(t)\) be the number of recurrent events observed by total time \(t\), and let \(Y_i(t)\) indicate whether subject \(i\) is observed and eligible to have an event immediately before \(t\). Let \(X_i(t)\) be a vector of covariates available immediately before \(t\), and let \(\mathcal{F}_{i}(t-)\) denote the subject’s observed history just before \(t\). The Andersen–Gill model specifies the conditional intensity as $$ \lambda_i(t\mid\mathcal{F}_{i}(t-)) = Y_i(t)\lambda_0(t)\exp\{\boldsymbol{\beta}^{\mathsf T}X_i(t)\}. $$ Here \(\lambda_0(t)\) is a common, otherwise unspecified baseline hazard on the total-time scale, and \(\boldsymbol{\beta}\) is a vector of regression coefficients. The intensity is zero when \(Y_i(t)=0\).

The counting process \(N_i(t)\) increases by one at each observed recurrence. In the usual simple-process formulation, it has no multiple jumps for the same subject at exactly the same time. The risk indicator is defined just before time \(t\), so a subject who has an event at \(t\) must be at risk immediately before that event. Follow-up entry, censoring, death, or another terminal loss of eligibility can make \(Y_i(t)=0\). A recurrence by itself does not: the subject remains at risk afterward if follow-up continues and another event is possible.

The covariate vector may contain fixed characteristics, such as treatment assignment, and time-varying characteristics. A time-varying value used at \(t\) must be known from information available before \(t\); using a value measured only after the event would condition on future information. The history \(\mathcal{F}_{i}(t-)\) can include past events, but the model does not automatically give past event count a direct effect. Such a dependence must be represented, for example, by including a predictable function of past event history in \(X_i(t)\).

Risk Indicator and Clock

For a subject entering observation at \(L_i\) and followed until censoring or loss of eligibility at \(C_i\), a basic risk indicator is \(Y_i(t)=I\{L_i\leq t<C_i\}\), provided the subject is otherwise eligible throughout that interval. More complicated eligibility rules can be included in \(Y_i(t)\). The interval endpoints must match the study’s event and censoring conventions; in particular, an event recorded at a time must not be excluded from the risk set merely because the observation interval was coded inconsistently.

The Andersen–Gill model uses total time: all subjects share the study’s time origin, and the baseline hazard is indexed by that time. An event does not reset the baseline clock. Thus, if the baseline hazard rises with time since study entry, the model allows a subject’s baseline intensity to rise over follow-up even if the subject has already experienced several recurrences. A different clock or event-order-specific baseline structure is a different model specification.

Worked Example: Constructing the Risk Set

Suppose three hypothetical participants are followed on a total-time scale. Participant A enters at time 0, has recurrences at times 2 and 6, and is censored at time 9. Participant B enters at time 1, has a recurrence at time 3, and is censored at time 7. Participant C enters at time 0 and is censored at time 4 without a recurrence. Assume recurrence does not end eligibility, and use the risk status immediately before each time.

For A, \(Y_A(t)=1\) from entry until censoring; the recurrence at time 2 does not remove A from the risk set. For B, \(Y_B(t)=1\) from time 1 until time 7. For C, \(Y_C(t)=1\) from time 0 until time 4.

Immediately before time 3, all three are under observation and eligible, so \((Y_A(3),Y_B(3),Y_C(3))=(1,1,1)\). Immediately before time 6, C has already been censored, but A and B remain under observation, so \((Y_A(6),Y_B(6),Y_C(6))=(1,1,0)\). A’s event at time 6 is counted because A was at risk immediately before it. Immediately before time 8, A is still at risk but B has been censored, giving \((1,0,0)\).

This construction uses one shared total-time scale. It does not restart A’s clock at times 2 or 6. If the study instead made a recurrence a terminal event, A would leave the risk set at time 2; that rule would describe a different outcome process, not the Andersen–Gill recurrent-event specification above.

What the Intensity Assumption Says

An intensity is a conditional instantaneous event rate. Under the model, for a small interval of length \(dt\), while subject \(i\) is at risk, $$ P\{dN_i(t)=1\mid\mathcal{F}_{i}(t-)\} = \lambda_0(t)\exp\{\boldsymbol{\beta}^{\mathsf T}X_i(t)\}\,dt+o(dt). $$ When \(Y_i(t)=0\), the conditional event probability over that interval is zero under the observed-process definition. This local statement is not a claim that events occur at a constant rate over a long interval. The baseline may vary freely with total time, and the covariate vector may change over time.

The specification makes several substantive and data requirements. First, the event type and recurrence process must be defined consistently: \(N_i(t)\) counts the events the analysis intends to model. Second, the risk indicator must reflect actual observation and eligibility, and censoring must not selectively hide event histories in a way left unaccounted for by the analysis. Third, covariates must be measured and coded on a time scale aligned with the event process, and time-varying covariates must be predictable. Fourth, conditional on the recorded history and covariates, the intensity must have the stated multiplicative form with a common baseline and common coefficient vector.

The common baseline does not mean every participant has the same intensity. At a given time, covariates multiply the shared baseline by \(\exp\{\boldsymbol{\beta}^{\mathsf T}X_i(t)\}\). Nor does the formula, by itself, require event times to be independent within a person. The conditional intensity is defined relative to history; whether that history and the chosen covariates adequately describe how the event process changes over recurrences is a modeling question. Unmeasured subject-level heterogeneity or a changing recurrence pattern not captured by the specification can make the model inadequate.

Worked Example: Writing a Covariate Model and Evaluating Its Intensity

Consider a hypothetical study in which \(Z_i=1\) denotes assignment to a treatment group and \(Z_i=0\) denotes the comparison group. Suppose the analyst specifies $$ \lambda_i(t\mid\mathcal{F}_{i}(t-)) = Y_i(t)\lambda_0(t)\exp\{\beta Z_i\}. $$ The baseline hazard is shared across groups and indexed by total time.

For a numerical illustration, suppose at a particular time the baseline hazard is \(0.04\) events per person-year, the subject is at risk, and the fitted coefficient used for illustration is \(\beta=\log(1.5)\). For a treated participant, \(Y_i(t)=1\) and \(Z_i=1\), so $$ \lambda_i(t)=1(0.04)\exp\{\log(1.5)\} =0.04(1.5) =0.0600 $$ events per person-year at that time. For a comparison participant at risk at the same time, \(Z_i=0\), and the intensity is \(1(0.04)\exp(0)=0.0400\) events per person-year. If either participant is no longer observed and eligible, \(Y_i(t)=0\), and the observed-process intensity is zero. These calculations illustrate the model’s specification; they do not establish that the assumed shared-baseline form is appropriate for a particular data set.

Worked Example: Allowing the Intensity to Depend on Event History

Suppose investigators hypothesize that the instantaneous event intensity changes with the number of previous recurrences. A possible hypothetical specification is $$ \lambda_i(t\mid\mathcal{F}_{i}(t-)) = Y_i(t)\lambda_0(t) \exp\{\beta Z_i+\gamma N_i(t-)\}, $$ where \(N_i(t-)\) is the number of events before \(t\). Because it uses only past events, \(N_i(t-)\) is available immediately before \(t\).

Assume \(Y_i(t)=1\), \(Z_i=1\), \(N_i(t-)=2\), \(\lambda_0(t)=0.03\) events per person-year, \(\beta=\log(1.2)\), and \(\gamma=\log(0.8)\). Then $$ \lambda_i(t) = 0.03\exp\{\log(1.2)+2\log(0.8)\} = 0.03(1.2)(0.8^2) = 0.02304 $$ events per person-year. The common baseline remains \(\lambda_0(t)\); the history term changes the covariate multiplier. Omitting \(N_i(t-)\) would instead assert that, conditional on the included covariates, the model has no direct event-count effect on the intensity. Whether that simpler specification is scientifically plausible must be considered before fitting.

Justification Through the Compensator

The model’s intensity also determines the expected accumulation of events, conditional on the modeled history. Define the cumulative intensity, or compensator, by integrating the instantaneous intensity over time:

$$ A_i(t) = \int_0^t Y_i(u)\lambda_0(u) \exp\{\boldsymbol{\beta}^{\mathsf T}X_i(u)\}\,du. $$

Under the stated intensity model and regularity conditions, the difference \(M_i(t)=N_i(t)-A_i(t)\) is a martingale with respect to the modeled history: its conditional expected future increment, given the history up to the present, is zero. The justification is local. Over a short interval, the expected increment of \(N_i\), conditional on the past, is the intensity times the interval length to first order. Summing these conditional expectations across short intervals and taking the limit yields the integrated intensity \(A_i(t)\). Thus the model says that observed event accumulation fluctuates around the accumulation predicted by the at-risk time, baseline hazard, and covariate multiplier.

This result is a specification check, not a guarantee that the model fits. If recurrent events cluster more than the recorded history and covariates predict, or if the common-baseline form is wrong, the observed event process may depart systematically from the proposed intensity. Inference must also account for the dependence structure appropriate to the study; specifying an intensity alone does not settle every standard-error question.

Diagnostics, Alternatives, and Limitations

Before analysis, inspect the event histories and risk intervals. Verify that each recurrence is counted once, entry and censoring times are represented consistently, and recurrence does not accidentally terminate follow-up in the data structure. Check whether covariate values are available before the events they are meant to predict. Plotting event timing and event counts against total time and event order can reveal patterns that a common baseline and fixed covariate effects may not capture.

The Andersen–Gill specification is useful when the target is a conditional recurrent-event intensity and a common total-time baseline is scientifically defensible. It is not interchangeable with every recurrent-event summary. The mean cumulative function targets the mean number of events accumulated over time; marginal event rates summarize events per unit of person-time. Those approaches answer different questions and do not require the same individual-level intensity specification. Event-specific intensity models can allow the event order to play a more explicit role. The choice should follow the estimand, not just the convenience of a software option.

A common mistake is to reset time to zero after each recurrence while continuing to call the resulting model Andersen–Gill. That changes the clock: the baseline then describes time since the most recent event, rather than total time since the shared origin. Another mistake is to remove a subject from the risk set after every recurrence, even though subsequent events remain observable and eligible. The correction is to write the risk indicator and clock explicitly before fitting, then verify that the data intervals implement those definitions.

Other limitations arise if censoring depends on unobserved event propensity, if eligibility changes in ways not recorded, or if a shared-baseline model cannot represent important event-order or subject heterogeneity. The formula should be understood as a conditional model for the observed recurrent-event process under its assumptions, not as proof of a causal effect or a universal description of recurrence.

Key takeaway: An Andersen–Gill model combines a counting process, a risk indicator that usually retains a person after recurrence, a common baseline hazard on total time, and a multiplicative covariate effect. Correct specification requires all four components to match the study’s event process and scientific question.

Check Your Understanding

Answer each question, then compare with the concise solutions below.

  1. A participant enters at time 0, has events at times 2 and 5, and is censored at time 8. Under an Andersen–Gill risk rule with continued eligibility, what is the risk status immediately before time 6?
  2. Write the Andersen–Gill intensity for a binary covariate \(Z_i\), and identify which part is shared across subjects.
  3. Why must a time-varying covariate value used at time \(t\) be available just before \(t\)?
  4. An analyst resets the time origin after every recurrence. Is this still the total-time Andersen–Gill clock? Explain.

Solutions. (1) \(Y_i(6)=1\): the participant is still under observation and eligible, since recurrence alone does not end follow-up. (2) \(\lambda_i(t\mid\mathcal{F}_i(t-))=Y_i(t)\lambda_0(t)\exp\{\beta Z_i\}\); \(\lambda_0(t)\) is the common baseline hazard. (3) The model conditions on history immediately before \(t\), so using information observed only afterward would introduce future information into the covariate. (4) No. Resetting the origin uses time since the preceding recurrence, whereas the Andersen–Gill specification here indexes its common baseline by total time.

Clinical Biostats