Tutorials › Competing Risks and Multi-State Models › Common Errors in Compensator and Likelihood Calculations

Counting Processes and Martingale Theory · Tutorial 474 of 699

Common Errors in Compensator and Likelihood Calculations

Diagnose common compensator and likelihood errors using event-time tables, predictable covariates, risk indicators, and piecewise intensity calculations.

Advanced 12 min read

What You'll Learn

  • Check that risk indicators and covariates are specified with the correct time convention at each event.
  • Separate event-time jump contributions from the integrated intensity in a likelihood.
  • Compute compensators by integrating the intensity only over intervals when a subject is at risk.
  • Audit event-process likelihoods by comparing event factors, cumulative hazards, and log-likelihood terms.
  • Identify when a likelihood omits censoring or uses an intensity value inconsistent with the observed history.

Why Small Bookkeeping Errors Matter

In event-history calculations, a likelihood can look plausible while encoding the wrong history. A risk indicator may include time after a subject has left observation, a covariate may be evaluated using information unavailable just before an event, or an event jump may be treated as though it were spread over an interval. Each mistake changes either the event contribution, the compensator, or both.

The safest approach is to audit the likelihood in two separate parts: first list the intensity at every observed event; then integrate the intensity over every interval during which the process is at risk. This tutorial focuses on those checks. It uses a single event process with unit jumps and an absolutely continuous compensator, so simultaneous jumps and more general multitype constructions are not needed here.

Definition: Let \(N(t)\) count events through time \(t\), and let \(Y(t)\) indicate whether the subject is at risk at time \(t\). An intensity \(\lambda(t\mid\mathcal{F}_{t-})\) is the event rate conditional on the observed history just before \(t\). Its compensator is \(A(t)=\int_0^t \lambda(u\mid\mathcal{F}_{u-})\,du\). The compensated process \(N(t)-A(t)\) is a martingale under the model's intensity assumptions.

For a common regression specification, the intensity is \(\lambda(t\mid\mathcal{F}_{t-})=Y(t)\lambda_0(t)\exp\{\beta Z(t)\}\), where \(\lambda_0(t)\) is a baseline rate and \(Z(t)\) is a covariate available from the history just before time \(t\). Both \(Y\) and \(Z\) must be specified as processes, not just as informal descriptions. In particular, an observed event contributes only if the subject is at risk at that event time.

Separate the Jump Terms From the Compensator

Suppose the observed event times are \(t_1,\ldots,t_m\), each with a unit jump, and observation ends at \(\tau\). Conditional on the specified initial information, the event-process log-likelihood, up to terms not involving the model parameters, is

$$ \ell = \int_0^\tau \log\{\lambda(t\mid\mathcal{F}_{t-})\}\,dN(t) - \int_0^\tau \lambda(t\mid\mathcal{F}_{t-})\,dt = \sum_{j=1}^{m}\log\{\lambda(t_j\mid\mathcal{F}_{t_j-})\} - A(\tau). $$

The first integral is with respect to the counting process: it adds a term at each jump, not continuously between jumps. The second is an ordinary time integral and accumulates wherever the intensity is positive. If there is no event, the sum is zero and the likelihood contribution is \(\exp\{-A(\tau)\}\). If there is one event, its density contribution is the intensity at that event multiplied by the probability of surviving event-free up to that time.

This expression assumes a correctly specified conditional intensity, a well-defined finite integrated intensity over the observation interval, and unit jumps with no simultaneous events in this single-process setup. An event assigned zero intensity has zero likelihood under the model. Censoring mechanisms are not represented by this event-process likelihood; omitting a censoring contribution is appropriate only when the analysis conditions on the observation scheme or otherwise treats censoring as noninformative for the event-process likelihood.

Worked Audits

Worked Example: A Risk Indicator and a Censored Subject

Two hypothetical subjects have a constant event rate of \(0.20\) per day while at risk. Subject A has an event at day 1. Subject B is observed event-free until administrative censoring at day 2. Assume the censoring times are fixed by design and do not add an event-process likelihood term. Calculate the event-process likelihood.

For A, \(Y_A(t)=1\) through the event at day 1, and follow-up for the event process ends at that event. For B, \(Y_B(t)=1\) through day 2 and there is no event jump. Thus the total compensator is

$$ A(2)=\int_0^1 0.20\,dt+\int_0^2 0.20\,dt =0.20+0.40=0.60. $$

There is one event, at which the intensity is \(0.20\) per day. Therefore

$$ L=0.20\exp(-0.60)=0.1098. $$

The units are consistent: the event factor is a rate per day, while the exponent is dimensionless because the rate is multiplied by days. A common error is to stop accumulating B's compensator at A's event time. That would incorrectly use \(A=0.40\) and give \(0.20\exp(-0.40)=0.1341\). Each subject's risk interval must be followed separately.

Worked Example: A Predictable Covariate Updated After the Event

Consider one hypothetical subject with baseline rate \(0.10\) per day, regression coefficient \(\beta=\log 2\), and an event at day 2. The subject is at risk up to and including the event. Specify the covariate path as \(Z(t)=0\) for \(t\leq 2\), and \(Z(t)=1\) only for \(t>2\); the covariate update occurs after the event. This deterministic path is predictable: its value at the event time is already specified by the history available just before that time.

At the event, \(Y(2)=1\) and \(Z(2)=0\), so the event intensity is

$$ \lambda(2\mid\mathcal{F}_{2-}) =1(0.10)\exp\{(\log 2)(0)\} =0.10\ \text{per day}. $$

The compensator up to the event is

$$ A(2)=\int_0^2 0.10\exp\{(\log 2)(0)\}\,dt =0.10(2)=0.20. $$

The event-time likelihood density is consequently

$$ L=0.10\exp(-0.20)=0.08187\ \text{per day}. $$

Now consider the different path \(Z(t)=0\) for \(t<2\) and \(Z(t)=1\) for \(t\geq2\). Its specified value at the event is 1, so the event factor is \(0.10\exp(\log 2)=0.20\) per day. The compensator through day 2 is still \(0.20\), because changing an integrand at one time does not change its ordinary time integral. The resulting density using that version is \(0.20\exp(-0.20)=0.1637\) per day. The key audit is not to substitute \(Z(2-)\) automatically: use the specified predictable version at the event. For a genuinely random event, a covariate updated in response to that event is post-event information and cannot be used as a pre-event predictor.

Worked Example: One Jump and a Piecewise Intensity

A hypothetical subject is at risk until an event at day 1.5. The baseline rate is \(0.10\) per day, \(\beta=\log 2\), and the covariate is \(Z(t)=0\) through day 1 and \(Z(t)=1\) after day 1. The covariate change at day 1 is scheduled in advance. Calculate the log-likelihood.

The intensity is \(0.10\) per day from day 0 through day 1, and \(0.20\) per day after day 1. Since the event occurs at day 1.5, its jump contribution is \(\log(0.20)\). The compensator is the area under the intensity while at risk:

$$ A(1.5) = \int_0^1 0.10\,dt+\int_1^{1.5}0.20\,dt =0.10+0.10=0.20. $$

Thus

$$ \ell=\log(0.20)-0.20=-1.6094-0.20=-1.8094, \qquad L=0.20\exp(-0.20)=0.1637\ \text{per day}. $$

The jump term is not \(\int_0^{1.5}\log\lambda(t)\,dt\). The integral against \(dN(t)\) has one jump, so it evaluates the log intensity at day 1.5. The compensator, by contrast, uses both time intervals and their respective rates.

A Short Derivation and a Practical Audit

For a single subject with a continuous event-time distribution and conditional intensity \(\lambda(t)\), let \(S(t)\) be the conditional probability of no event by time \(t\), given event-free status at the start of the interval. Over a short interval of length \(dt\), the conditional event probability is \(\lambda(t)dt+o(dt)\). Therefore \(S(t+dt)=S(t)\{1-\lambda(t)dt+o(dt)\}\), which gives the differential equation \(S'(t)=-\lambda(t)S(t)\). Solving it with \(S(0)=1\) yields \(S(t)=\exp\{-\int_0^t\lambda(u)\,du\}\). The event-time density is \(f(t)=\lambda(t)S(t)\), giving the event factor times the exponential of negative integrated intensity. For multiple observed jumps, the corresponding likelihood multiplies one intensity factor per jump and retains the same negative compensator term.

This derivation also explains why the compensator is not a count of events and why an event contributes a rate at a time rather than a rate multiplied by an arbitrary interval. For practical calculations, make an interval table before simplifying the likelihood:

1
Mark the observed history.
List each event time, censoring or exit time, and any covariate update. Record which subjects are at risk on each interval.
2
Evaluate event factors.
At each event, check that the subject is at risk and substitute the covariate value in the specified predictable version of the intensity.
3
Integrate by intervals.
Split at every risk-set or intensity change. Add rate times interval length only while the process is at risk.
4
Reconcile the likelihood.
Check that each event yields one log-intensity term and that the total compensator is subtracted once. Verify that the exponent is dimensionless.

Failure Modes, Alternatives, and Limits

Several checks catch many errors before any inference is attempted. An event factor should use a positive intensity and a subject at risk; the compensator should be nonnegative and should not accrue after exit; and each event should contribute its jump size to the integral against \(dN\). For unit jumps, that means one log-intensity term per event. If calculations are piecewise constant, recompute the compensator as a sum of rate-times-duration terms and compare it with direct integration.

  • Using the wrong risk interval. A subject who is censored contributes event-free exposure up to censoring, but no exposure afterward. A subject who has had the event is no longer at risk for that same first-event process after the event.
  • Confusing predictability with “always use the left limit.” Predictability concerns availability from the past. A process can have a deterministic, known update at a scheduled time. Use its specified value at an event; do not replace it with a left-limit value without checking the process definition.
  • Putting the compensator in the event term. The event factor is \(\lambda(t_j)\), whereas the compensator is \(\int\lambda(t)\,dt\). They are different contributions with different roles and units.
  • Forgetting the observation scheme. The event-process likelihood does not automatically model informative censoring. If the censoring mechanism carries information about the event process, conditioning on it may not be justified.

A full event-process likelihood retains the integrated intensity. A partial likelihood, where appropriate, conditions on event times or risk sets to remove nuisance components; it is a different likelihood and does not license dropping compensator terms from the full likelihood calculation. Likewise, the event-process formula here is conditional on the specified initial information. It does not supply a distribution for an initial state or a censoring process that has not been modeled. Detailed multitype event likelihoods require tracking event types and their corresponding intensities, but the same bookkeeping principle remains: event jumps and integrated intensities must be accounted for consistently.

Key takeaway: Audit an event-process likelihood in two passes. At each jump, verify risk status and the predictable intensity value; across time, integrate that intensity only over the intervals represented in the observed history.

Check Your Understanding

Try each calculation, then compare your reasoning with the solutions below.

  1. A subject has constant rate \(0.30\) per hour, an event at hour 2, and is at risk until that event. What are the compensator and event-time likelihood density?
  2. A subject is censored event-free at day 4 under a constant rate of \(0.05\) per day. What is the event-process likelihood contribution, assuming the censoring time is fixed by design?
  3. A covariate is 0 through day 3 and changes to 1 only after day 3. An event occurs at day 3, with baseline rate \(0.08\) and coefficient \(\beta=\log 3\). What event intensity should be used at day 3?
  4. For one event at day 2, a calculation uses \(\int_0^2\log\{\lambda(t)\}\,dt\) as the event term. Identify the error and state the correct form.

Solutions. (1) \(A(2)=0.30(2)=0.60\) and the density is \(0.30\exp(-0.60)=0.1646\) per hour. (2) There is no event factor, so the contribution is \(\exp\{-0.05(4)\}=\exp(-0.20)=0.8187\). (3) The specified value is \(Z(3)=0\), so the event intensity is \(0.08\exp\{(\log 3)(0)\}=0.08\) per day. (4) The event term is an integral with respect to \(dN(t)\), not ordinary time. With one unit jump at day 2 it equals \(\log\{\lambda(2)\}\); the separate compensator term is \(-\int_0^2\lambda(t)\,dt\).

Clinical Biostats