Tutorials › Competing Risks and Multi-State Models › Likelihoods With Predictable Time-Varying Covariates

Counting Processes and Martingale Theory · Tutorial 457 of 699

Likelihoods With Predictable Time-Varying Covariates

Construct and check event-history likelihoods when covariates change over time, using predictable covariate values at jumps and integrating the intensity over the entire observed risk period.

Advanced 10 min read

What You'll Learn

  • Define predictable covariate histories and distinguish their event-time values from post-event values.
  • Write an event-history likelihood with a time-varying intensity.
  • Integrate intensity across changing risk and covariate intervals.
  • Calculate likelihoods for piecewise-constant and continuously varying covariates.
  • Identify assumptions, data checks, and common errors in likelihood construction.

Why the Covariate’s Timing Matters

When an event process has a time-varying covariate, its intensity at an event time depends on the covariate information available immediately before that event. The likelihood also accounts for every interval during which the subject was at risk, including intervals with no event. These are two distinct uses of the covariate history: its value at each observed jump and its path throughout the accumulated intensity.

This distinction is essential when covariates change during follow-up. A treatment may begin partway through observation, a laboratory measurement may be updated, or a subject’s state may change. Using a value recorded after an event to explain that event reverses the temporal order. Conversely, using only the covariate value at the event omits its contribution to the event-free periods.

Definition: A covariate process \(X(t)\) is predictable if its value at time \(t\) is determined by information available just before \(t\). For a covariate recorded as a right-continuous process, the value used at an event time \(t\) is its left limit, \(X(t-)\). A predictable intensity \(\lambda(t;\theta)\) is the instantaneous event rate at time \(t\), given the history available immediately before \(t\), under parameter \(\theta\).

Let \(N(t)\) count events observed from entry time \(a\) through an end time \(\tau\), and let \(t_1,\ldots,t_K\) be its event times. Let \(Y(t)\) indicate whether the subject is at risk immediately before \(t\). For a simple event process with a continuous-time intensity, the event-process likelihood contribution has the form

$$ L(\theta) = \left\{\prod_{j=1}^{K}\lambda(t_j;\theta)\right\} \exp\left\{-\int_a^\tau \lambda(t;\theta)\,dt\right\}. $$

When the intensity is zero outside the risk period, the integral automatically accrues only while \(Y(t)=1\). In the common specification \(\lambda(t;\theta)=Y(t)q(t;\theta,X(t))\), the event-time factor uses the predictable covariate value at that jump, while the integral uses the covariate path at every time in the risk period. For an individual with no observed events, the empty product equals 1, leaving only the exponential term.

This expression is the event-process likelihood contribution under the stated intensity model. If covariates are stochastic, it is not automatically the full likelihood for all observed data: a parameter-dependent model for their process may also need to be included. Likewise, censoring and entry mechanisms must be handled according to the observation design; the intensity integral begins at the actual start of observation and risk.

Why the Likelihood Has These Two Parts

The product records the event intensities at observed jumps. The exponential term records the likelihood contribution of not observing an event during the rest of the risk time. The following short derivation explains both parts. Over a small interval of width \(\Delta t\), conditional on the history just before the interval, the probability of one event is approximately \(\lambda(t;\theta)\Delta t\), and the probability of no event is approximately \(1-\lambda(t;\theta)\Delta t\). The log contribution for no event is therefore approximately \(-\lambda(t;\theta)\Delta t\), because \(\log(1-u)\approx-u\) for small \(u\). Adding these contributions across intervals gives the integrated negative intensity; at observed events, the corresponding event factors contribute \(\log\lambda(t_j;\theta)\).

$$ \ell(\theta) = \sum_{j=1}^{K}\log\lambda(t_j;\theta) - \int_a^\tau\lambda(t;\theta)\,dt, \qquad L(\theta)=\exp\{\ell(\theta)\}. $$

This argument assumes that the event process is simple, with no simultaneous jumps, and has a well-defined intensity with respect to the stated history. At each observed jump, the intensity must be positive; otherwise the likelihood is zero. The covariate values used in the intensity must be available predictably, and the intensity must be integrable over the observed risk period. These conditions make the event factors and cumulative-intensity term coherent parts of one path likelihood.

Worked Example: A Covariate Switch Before One Event

Suppose a hypothetical subject enters observation at time 0 and experiences an event at time 4. A treatment indicator is 0 from time 0 up to time 2 and 1 from time 2 onward. The subject is at risk through the event. Consider the illustrative intensity \(\lambda(t;\beta)=Y(t)\,0.1\exp\{\beta X(t)\}\) per day, with \(\beta=\log 2\). Assume the treatment switch is recorded predictably and there is no event before time 4.

Before time 2, the rate is \(0.1\exp\{(\log 2)0\}=0.1\) per day. From time 2 to the event at time 4, the rate is \(0.1\exp\{(\log 2)1\}=0.2\) per day. The event occurs while \(X(t)=1\), so its intensity factor is 0.2 per day. The integrated intensity includes both risk intervals:

$$ \int_0^4 \lambda(t;\beta)\,dt = (0.1)(2)+(0.2)(2) = 0.6. $$

Thus the event-time likelihood density is

$$ L(\beta) = 0.2\exp(-0.6) \approx 0.1098 \quad\text{per day}. $$

The treatment value at the event determines its event factor, but the earlier untreated time still contributes to the integral. The calculation assumes that the stated intensity applies throughout each interval, that the subject remains at risk until the event, and that the covariate history is known before the event it is used to describe.

Using the Whole Covariate Path

For a piecewise-constant covariate, split the cumulative-intensity integral at each covariate change, risk-set change, or other point where the intensity formula changes. On each resulting interval, multiply its duration by its constant intensity. This is an exact calculation when the intensity really is constant within each interval; it is not an approximation that permits ignoring intervals without events.

Worked Example: Recurrent Events Across a Covariate Change

Suppose a hypothetical subject remains under recurrent-event observation from time 0 to time 4. The covariate is 0 before time 2 and 1 from time 2 onward. The intensity is \(0.2\exp\{(\log 2)X(t)\}\) events per day, and events occur at times 1 and 3. Assume the process is simple, the subject remains at risk after each event, and the intensity specification applies between events.

The event intensities are \(0.2\) per day at time 1 and \(0.4\) per day at time 3. The cumulative intensity over the full observation period is

$$ \int_0^4\lambda(t)\,dt = (0.2)(2)+(0.4)(2) = 1.2. $$

The likelihood contribution for the two observed events is therefore

$$ L = (0.2)(0.4)\exp(-1.2) = 0.08\exp(-1.2) \approx 0.02410 \quad\text{per day}^{2}. $$

Both jumps contribute an event factor, and the no-event contribution is accumulated over the full four days, including the time between jumps. This calculation would not apply unchanged if an event ended follow-up or changed the risk indicator; in that case, \(Y(t)\) and the integration limits must reflect the actual observation and risk history.

The same principle applies when a predictable covariate varies continuously, though the integral may require calculus or numerical integration. For example, suppose a hypothetical subject is at risk from time 0 until an event at time 1.5, with deterministic predictable covariate \(X(t)=t\) and intensity \(\lambda(t)=0.05\exp\{0.3X(t)\}\) per day. At the event, the intensity is \(0.05\exp(0.45)\approx0.07842\) per day, and the cumulative intensity is

$$ \int_0^{1.5}0.05\exp(0.3t)\,dt = \frac{0.05}{0.3}\left\{\exp(0.45)-1\right\} \approx 0.09472. $$

The event-time likelihood density is \(0.07842\exp(-0.09472)\approx0.07133\) per day. The integration ends at the event, not at an arbitrary later time, because the subject is no longer at risk after this event in the stated single-event setting.

Checks, Alternatives, and Limitations

Before evaluating a likelihood, check that each event-time covariate value was available just before that event; that risk intervals begin at entry and end at the correct censoring or event time; and that the integral covers every at-risk interval. For piecewise-constant covariates, verify that the interval durations sum to the observed risk time. For continuously varying covariates, verify that the integration uses the stated time scale and the same covariate process as the event factors.

A useful implementation strategy is to split records at covariate changes and calculate event and exposure contributions separately. Splitting records does not itself alter the likelihood if the resulting intervals preserve the original covariate and risk histories. If the covariate changes continuously, arbitrarily coarse intervals instead approximate the integral and may introduce numerical error; use a sufficiently accurate integration method and check its stability.

ApproachWhat it usesMain caution
Full intensity likelihoodEvent intensities at jumps and integrated intensity over risk timeRequires a correctly specified intensity and observation history
Baseline-only covariate analysisCovariate measured at entryDoes not represent changes after entry
Piecewise interval calculationSeparate contributions over intervals of constant covariates or riskIntervals must preserve the observed history; coarse approximations can distort a changing intensity

A common mistake is to insert the covariate value recorded after an event into that event’s intensity, reasoning that it is the latest available measurement in the data file. That value may reflect information arising after the event and is not the predictable value for the event-time factor. Use information available immediately before the jump; if the recorded process is right-continuous, use its left limit. A second mistake is to multiply event intensities but omit the integrated-intensity term. That ignores the information in event-free risk time and is not the event-history likelihood.

The likelihood also depends on the adequacy of the intensity model and the recorded event, covariate, entry, and censoring histories. It does not, by itself, establish a causal effect of a time-varying covariate. If covariate evolution is informative or its distribution depends on model parameters, a joint modeling strategy may be needed. The displayed product assumes no simultaneous jumps; tied or simultaneous events require additional treatment rather than an arbitrary ordering of jumps.

Key takeaway: For a predictable time-varying covariate, use its pre-event value in each event factor and its full predictable path in the cumulative-intensity integral. Both parts must reflect the actual risk and observation intervals.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. At an event time, a right-continuous covariate process jumps from 0 to 1. Which value enters the event intensity?
  2. A subject has no events while at risk for three days, with constant intensity 0.2 per day. What is the likelihood contribution?
  3. A subject is at risk for one day at intensity 0.1 per day, then for two days at intensity 0.3 per day, and has one event in the second interval. Write the likelihood contribution using only the stated information.
  4. When is the event-process likelihood contribution alone not necessarily the full likelihood for the observed data?

Solutions. (1) Use the left limit, \(X(t-)=0\), because the value must be predictable at the event. (2) With no event, the empty product is 1, so \(L=\exp\{-(0.2)(3)\}=\exp(-0.6)\approx0.5488\). (3) The event factor is 0.3 per day and the integrated intensity is \((0.1)(1)+(0.3)(2)=0.7\), giving \(L=0.3\exp(-0.7)\approx0.1490\) per day. (4) If the covariate process is stochastic and its distribution depends on parameters, its likelihood contribution may also be required for the full observed-data likelihood.

Clinical Biostats