Why Covariate Timing Matters
A participant’s exposure or clinical status may change during follow-up, while recurrent events can occur more than once. A single baseline covariate value then fails to represent the information available at each event time. The analysis must link each event and each interval at risk to the covariate value that applied immediately before that time.
This is more than a data-management detail. Under an Andersen–Gill model, a time-varying covariate enters a subject-specific conditional event intensity. Under a marginal rate formulation, it describes a covariate-associated population rate. Those targets differ, particularly when the covariate is affected by prior events.
Let \(N_i(t)\) count the recurrent events experienced by subject \(i\) through time \(t\), and let \(Y_i(t)\) indicate whether the subject is under observation and at risk immediately before \(t\). Write \(\mathcal H_i(t-)\) for the observed history just before \(t\), including past events and covariate information. In practice, the value used at an event time must be available before that event; a value measured only afterward cannot be treated as a pre-event predictor.
Representing Changing Covariates on Event Records
A common format uses one row per subject per interval during which the covariate and at-risk status are constant. Each row records a start time, a stop time, the covariate value for that interval, and whether an event occurred at its stop. Split a record whenever the covariate changes, follow-up begins or ends, or an event occurs. At a covariate update, the new value applies to subsequent time, not retrospectively to the interval that just ended.
Worked Example: Coding an External Exposure Change
Suppose a hypothetical participant is followed from day 0 through day 12 and has recurrent events on days 4 and 10. A medication becomes available on day 6, and the participant starts it then. Define \(X_i(t)=1\) while taking the medication and \(0\) otherwise. Assume the medication status changes at day 6, and the event-time value is the value just before the event.
| Start | Stop | \(X_i(t)\) | Event at stop? |
|---|---|---|---|
| 0 | 4 | 0 | Yes |
| 4 | 6 | 0 | No |
| 6 | 10 | 1 | Yes |
| 10 | 12 | 1 | No |
The day-4 event is assigned \(X_i(4-)=0\), and the day-10 event is assigned \(X_i(10-)=1\). Splitting at day 6 ensures that the participant contributes unexposed risk time from day 0 to day 6 and exposed risk time from day 6 onward. The event on day 4 does not create a new medication value or erase subsequent follow-up.
For continuous covariates measured intermittently, the analysis needs an explicit rule for the value between measurements, such as carrying forward the most recently observed value. That rule is part of the analysis specification, not a fact supplied by the model. A lagged value may be more defensible when a measurement is not available at the instant an event occurs. The chosen rule should match how information would have been available in real time.
Worked Example: Updating an Internal Covariate After Recurrence
Consider a hypothetical study in which \(X_i(t)\) is the number of prior recurrences. One participant has events on days 3 and 8 and is followed through day 11. Define the covariate after each event as the updated prior-event count. The value immediately before day 3 is 0; immediately before day 8 it is 1.
| Start | Stop | Prior-event count during interval | Event at stop? |
|---|---|---|---|
| 0 | 3 | 0 | Yes |
| 3 | 8 | 1 | Yes |
| 8 | 11 | 2 | No |
The first event occurs while the prior-event count is 0. Only after that event does the covariate become 1; after the second event it becomes 2. If day 3 were coded with a count of 1, the covariate would use information from the event it is meant to predict. This example also shows why an internal covariate can encode event history and should not automatically be interpreted as an externally assigned exposure.
Andersen–Gill Model: A Conditional Event Intensity
The Andersen–Gill (AG) model extends a proportional-intensity model to recurrent events. Conditional on the subject’s observed history immediately before time \(t\), its specification is
Here \(\lambda_i(t\mid\mathcal H_i(t-))\) is the instantaneous event intensity, \(\lambda_0(t)\) is an unspecified baseline intensity, \(\mathbf X_i(t-)\) is the covariate vector available just before \(t\), and \(\boldsymbol{\beta}\) is a vector of log-intensity ratios. The factor \(Y_i(t)\) makes the intensity zero when the subject is not under observation or at risk.
The covariate process must be predictable: its value at time \(t\) is determined by information available just before \(t\). This is why a post-event measurement cannot be assigned to that event as though it preceded it. The model also requires an appropriate specification of the conditional intensity and observation process. As with other survival models, censoring or loss to follow-up must not be handled as if it were ordinary event-free time when the subject is no longer observed.
For a one-unit increase in a covariate, holding other modeled covariates and the prior history fixed, the AG intensity is multiplied by \(\exp(\beta)\). This is a conditional event-intensity ratio, not automatically a population-average rate ratio, and not a causal effect. With an internal covariate, the comparison is between histories having different current covariate values; that difference may reflect prior events, health changes, or other causes of both the covariate and future events.
Worked Example: Interpreting an AG Coefficient
Suppose a hypothetical AG analysis includes a time-varying indicator \(X_i(t)\) for a high symptom score, coded 1 for high and 0 for low using measurements available before each event. Assume the fitted coefficient is \(\hat\beta=0.60\). The model-based intensity ratio is
Under the fitted AG model, at a given time and among subjects with the same modeled covariates and relevant observed history, the estimated event intensity when the score is high is 1.822 times the intensity when it is low. Equivalently, this is an estimated 82.2% higher conditional intensity. It is not a claim that the high-score group will have 82.2% more events over the entire study, nor that raising the score would cause the increase. The score is internal, so its association can reflect the health process that also predicts recurrence.
Marginal Rate Formulation: A Population Rate Association
A marginal rate model instead describes the mean event rate associated with covariates, averaging over the dependence among repeated events within a person rather than specifying the full subject-specific conditional intensity. A useful schematic form for the mean event increment among observed subjects is
In this formulation, \(\exp(\gamma_j)\) is a marginal rate ratio for a one-unit contrast in covariate \(j\), subject to the stated mean model and covariate definition. Repeated events from the same person are dependent; inference therefore needs an approach that accounts for within-person clustering, such as robust variance estimation or an appropriate GEE. Accounting for correlation affects uncertainty estimates; it does not repair an incorrectly coded covariate, a misspecified mean, or bias from informative observation.
For an external covariate, the rate association can be interpreted as a population-average comparison across the covariate values represented in the data, subject to the model and observation scheme. For an internal covariate, “marginal” does not mean that feedback from prior events has disappeared. The association is still tied to a covariate history that may have been altered by earlier recurrences. A causal interpretation would require additional design and assumptions beyond fitting a rate model.
Worked Example: Calculating and Interpreting a Marginal Rate Ratio
In a hypothetical study, participants contribute 120 person-years while unexposed and experience 30 events during that time. They contribute 80 person-years while exposed and experience 28 events. For a simple descriptive comparison, calculate the event rates and their ratio.
The crude rate ratio is
The observed rate while exposed is 1.40 times the observed rate while unexposed, a crude difference of 0.100 events per person-year. This calculation is not an adjusted model estimate and does not account for within-person dependence or differences between exposed and unexposed risk time. A fitted marginal rate model can adjust for covariates, but its coefficient must still be interpreted according to the model and the exposure process. If exposure is internal, this crude comparison alone does not establish that exposure increases event rates.
Why Splitting Records Gives the Correct Time Alignment
The counting-process contribution to a covariate-weighted event analysis uses the covariate value at each event time and the covariate history over time at risk. Suppose follow-up is partitioned into intervals \((a_{ik},b_{ik}]\) on which the covariate is constant at \(\mathbf X_{ik}\). Then the cumulative covariate-weighted exposure over follow-up is the sum of its interval contributions:
Likewise, an event at \(t_{ij}\) contributes using \(\mathbf X_i(t_{ij}-)\). Splitting at every change point makes these values explicit in the data and prevents the model from assigning a single covariate value to risk time during which it was not constant. This representation does not make the model correct by itself; it only ensures that the supplied time-varying records match the specified covariate process.
Specify when each subject enters and leaves observation, and which times count as at risk.
For every update, state whether the value applies immediately, after a delay, or only after an event.
Use nonoverlapping start–stop intervals, assign each event once, and use the pre-event covariate value.
Use conditional-intensity language for AG coefficients and marginal-rate language for marginal model coefficients.
Choosing the Interpretation and Checking the Data
| Feature | Andersen–Gill | Marginal rate formulation |
|---|---|---|
| Primary target | Subject-specific conditional event intensity given observed history | Population mean event rate associated with covariates |
| Time-varying covariate value | Must be predictable and available just before the event time | Must be defined with a clear time rule; internal covariates remain history-dependent |
| Coefficient interpretation | Conditional intensity ratio | Marginal rate ratio under the specified mean model |
| Repeated-event dependence | Part of the conditional event process; robust inference is often used | Must be reflected in the variance or estimating procedure |
Several checks can reveal coding or interpretation problems. Confirm that intervals do not overlap, that an event is not counted twice, and that a covariate update does not create or remove risk time. Compare the coded value at each event with the dated measurement record. For internal covariates, check that values measured after an event are not used for that event. Summarize person-time and event counts by covariate value; impossible values or unexpectedly large shifts can expose data alignment errors.
A common mistake is to code an internal symptom measurement taken after a recurrence as the predictor for that same recurrence, then interpret its coefficient as evidence that symptoms predicted the event. The correction is to use only information available before the event, often the most recent earlier measurement or a prespecified lag. Even with correct timing, the coefficient is an association conditional on the model, not necessarily a causal effect.
Another limitation is that a single coefficient assumes the specified covariate effect is shared across the modeled times and event histories unless the model explicitly allows otherwise. Whether that assumption is plausible is a separate modeling question. Also, a marginal rate model’s robust variance does not eliminate confounding, informative censoring, or feedback between prior events and an internal covariate.
Check Your Understanding
Answer each question, then compare with the solutions.
- A participant has events on days 2 and 7. A covariate is measured on day 4, after the first event. Which event can that measurement be used to predict under a pre-event coding rule?
- An AG model estimates \(\hat\beta=-0.40\) for a binary time-varying exposure. Calculate and interpret the estimated intensity ratio.
- Why can a robust variance estimator not turn an internal-covariate association into a causal effect?
- What coding error occurs if an event is assigned to both adjacent start–stop intervals?
Solutions. (1) The measurement on day 4 cannot predict the day-2 event because it was not yet available. It may be used for the day-7 event if it remains the applicable value immediately before that event. (2) \(\exp(-0.40)=0.6703\). Under the AG model, the estimated conditional intensity is about 0.670 times as high at exposure value 1 as at value 0, holding the modeled comparison fixed; this is about a 33.0% lower conditional intensity, not necessarily a causal effect. (3) Robust variance estimation addresses uncertainty under within-person dependence; it does not remove confounding or feedback between prior events and the internal covariate. (4) The event is counted twice, inflating the event process and corrupting the likelihood or estimating equation. Each event must be assigned exactly once.