Tutorials › Competing Risks and Multi-State Models › A Complete Cumulative Incidence Analysis by Hand

Cumulative Incidence Functions · Tutorial 75 of 699

A Complete Cumulative Incidence Analysis by Hand

Work through a small right-censored, two-cause dataset by hand and check its cumulative incidence estimates and uncertainty.

Intermediate 12 min read

What You'll Learn

  • Translate event codes into mutually exclusive causes and right censoring.
  • Construct event-time risk sets and audit their changes.
  • Calculate Aalen–Johansen cumulative incidence estimates for two causes.
  • Check that cause-specific incidence and event-free probability sum to one.
  • Estimate pointwise uncertainty and interpret a confidence interval appropriately.
  • Recognize when sparse late risk sets or censoring threaten interpretation.

From Recorded Outcomes to Cumulative Incidence

A complete cumulative incidence analysis is a chain of connected tasks: define what each event code means, establish who is at risk just before each event time, calculate the event-free probability and each cause-specific increment, then report uncertainty and interpret the result at a stated horizon. An arithmetic error at the coding or risk-set stage can change every estimate that follows.

The analysis below uses a small hypothetical cohort with two mutually exclusive causes of failure and right censoring. The target is the observed-world probability of having experienced a particular cause by a specified time, in the presence of the other cause as a competing event. The estimator is the Aalen–Johansen estimator for this one initial state and absorbing failure causes.

Definition: At an event time \(t_j\), let \(Y_j\) be the number at risk immediately before that time, \(d_{kj}\) the number of events from cause \(k\), and \(d_j=\sum_k d_{kj}\) the total number of events. Let \(\widehat S(t)\) be the estimated probability of remaining event-free through time \(t\), and let \(\widehat F_k(t)\) be the estimated cumulative incidence of cause \(k\) by time \(t\). At an event time,

\(\widehat S(t_j)=\widehat S(t_j-)(1-d_j/Y_j)\), and \(\widehat F_k(t_j)=\widehat F_k(t_j-)+\widehat S(t_j-)d_{kj}/Y_j\).

Here \(t_j-\) denotes just before \(t_j\). Censorings do not directly add to a cause-specific incidence estimate, but they reduce the risk set at later times.

For these calculations, assume individuals enter at time zero, event causes are coded correctly and are mutually exclusive, follow-up times are observed as recorded, and censoring is independent of the future failure process for the analysis being made. The cohort is analyzed as one group, without stratification or covariate adjustment. At tied times, all subjects with an event or censoring recorded at that time are counted in the risk set immediately before that time; events are then used in the update. These assumptions make the risk-set calculations interpretable, but they cannot be verified by arithmetic alone.

Worked Analysis: Coding, Risk Sets, and Incidence

Worked Example: Two Causes With Right Censoring

Suppose a hypothetical cohort of 12 people is followed from time zero. The recorded status is 1 for cause A, 2 for cause B, and 0 for right censoring. The data, ordered by observed time, are:

PersonTimeStatus
0111 (cause A)
0211 (cause A)
0312 (cause B)
0410 (censored)
0521 (cause A)
0622 (cause B)
0720 (censored)
0832 (cause B)
0932 (cause B)
1030 (censored)
1141 (cause A)
1240 (censored)

Step 1: Audit the codes and counts. There are three cause A events, four cause B events, and four censorings in this table? Count the rows carefully: cause A occurs for people 01, 02, 05, and 11, so there are four cause A events; cause B occurs for 03, 06, 08, and 09, so there are four cause B events; people 04, 07, 10, and 12 are censored, so there are four censorings. The totals are \(4+4+4=12\), agreeing with the cohort size.

Step 2: Construct the risk sets. At time 1, all 12 people are at risk. Four leave observation at that time, so 8 remain at risk at time 2. Three leave at time 2, leaving 5 at risk at time 3. Three leave at time 3, leaving 2 at risk at time 4. Thus the event-time counts are:

Time \(t_j\)At risk \(Y_j\)Cause A \(d_{Aj}\)Cause B \(d_{Bj}\)Censored
112211
28111
35021
42101

The count leaving observation at each time is \(d_{Aj}+d_{Bj}+\text{censored}\), giving 4, 3, 3, and 2. Each count matches the risk-set decrease to the next time. In particular, censored individuals are included in the risk set at their recorded censoring time, but do not count as failures.

Step 3: Update event-free probability and both incidences. At time 1, \(\widehat S(1-)=1\), so the cause A increment is \(1(2/12)=0.1667\), and the cause B increment is \(1(1/12)=0.08333\). The updated event-free probability is \(1(1-3/12)=0.7500\). At time 2, the increments are \(0.7500(1/8)=0.09375\) for each cause, and event-free probability becomes \(0.7500(1-2/8)=0.5625\).

At time 3, the cause A increment is zero and the cause B increment is \(0.5625(2/5)=0.2250\); event-free probability becomes \(0.5625(1-2/5)=0.3375\). At time 4, cause A adds \(0.3375(1/2)=0.16875\), cause B adds zero, and event-free probability becomes \(0.3375(1-1/2)=0.16875\).

Therefore, by time 2, \(\widehat F_A(2)=0.1667+0.09375=0.2604\) and \(\widehat F_B(2)=0.08333+0.09375=0.1771\). By time 3, \(\widehat F_A(3)=0.2604\) and \(\widehat F_B(3)=0.1771+0.2250=0.4021\). By time 4, \(\widehat F_A(4)=0.2604+0.16875=0.4292\) and \(\widehat F_B(4)=0.4021\).

Why the Updates Work and How to Check Them

The incidence increment at \(t_j\) is the estimated probability of being event-free just before \(t_j\), multiplied by the fraction of the risk set that fails from cause \(k\) at \(t_j\). This separates two ingredients: being able to experience the cause at that time, and the cause-specific fraction among those still at risk. A competing event removes a person from future risk of every cause, rather than being treated as ordinary censoring.

The calculation can be checked directly from its recursion. At each event time, the fraction \(d_j/Y_j\) leaves the event-free group; the remaining fraction is \(1-d_j/Y_j\). The cause-specific incidence increments sum to \(\widehat S(t_j-)d_j/Y_j\). Consequently, \(\widehat S(t_j)+\sum_k\widehat F_k(t_j)=\widehat S(t_j-)+\sum_k\widehat F_k(t_j-)\). Since the left-hand total begins at one, it remains one at every update.

$$ \widehat S(t_j)+\sum_k\widehat F_k(t_j)=1. $$

For this example, at time 2 the check is \(0.5625+0.2604+0.1771=1.0000\). At time 4 it is \(0.16875+0.4292+0.4021=1.0000\), up to rounding. A failure of this check usually signals a mismatch in the cause counts, risk set, or update arithmetic.

The step-function estimate is constant between observed event times and changes at event times; censoring alone produces no jump. Thus the estimate at a fixed horizon \(t\) includes event updates at or before \(t\), and no updates after \(t\). The earlier material on reading cumulative incidence at a fixed horizon gives the corresponding interpretation: for example, \(0.2604\) at time 2 estimates the cohort probability of having experienced cause A by time 2, before any competing cause.

Pointwise Uncertainty at a Chosen Horizon

A point estimate should not be presented as if it had no sampling uncertainty. One hand-calculable first-order variance estimate follows from the influence-function representation. For cause \(k\), define the derivative contribution at time \(t_j\) for cause \(l\) as \(g_{lj}=I(l=k)\widehat S(t_j-)-\{\widehat F_k(t)-\widehat F_k(t_j)\}\), where \(I(l=k)\) is one if \(l=k\), and zero otherwise. Because the event times here are grouped and have tied failures, use the multinomial covariance of the cause-specific event fractions: the diagonal terms are \(d_{lj}/Y_j^2\), and the covariance terms are \(-d_{lj}d_{mj}/Y_j^3\). The resulting estimated variance is:

$$ \widehat{\operatorname{Var}}\{\widehat F_k(t)\} = \sum_{t_j\le t} \left\{ \sum_l g_{lj}^{\,2}\frac{d_{lj}}{Y_j^2} - \frac{\left(\sum_l g_{lj}d_{lj}\right)^2}{Y_j^3} \right\}. $$

This is an asymptotic, pointwise variance approximation. It accounts for uncertainty in the cause-specific event increments and their effect on later survival. A normal interval based on it can be poor with very small risk sets; it is not a guarantee of good finite-sample coverage.

Worked Example: A Cause A Interval at Time 2

Use the same hypothetical data to calculate a pointwise standard error and a simple 95% normal interval for \(\widehat F_A(2)=0.2604\). The only event times included are 1 and 2.

At time 1, \(\widehat S(1-)=1\) and \(\widehat F_A(2)-\widehat F_A(1)=0.2604167-0.1666667=0.09375\). Thus \(g_{A,1}=1-0.09375=0.90625\) and \(g_{B,1}=0-0.09375=-0.09375\). The time-1 variance contribution, including the multinomial covariance correction, is \(\{2(0.90625^2)+1(0.09375^2)\}/12^2-\{2(0.90625)+1(-0.09375)\}^2/12^3=0.009758\).

At time 2, \(\widehat F_A(2)-\widehat F_A(2)=0\), so \(g_{A,2}=\widehat S(2-)=0.75\) and \(g_{B,2}=0\). The time-2 contribution, including the multinomial covariance correction, is \(0.75^2(1)/8^2-\{0.75(1)\}^2/8^3=0.007690\). Hence the estimated variance is \(0.009758+0.007690=0.017449\), and \(SE=\sqrt{0.017449}=0.1321\).

The untransformed interval is \(0.2604\pm1.96(0.1321)=(0.0015,0.5193)\). This is a 95% pointwise confidence interval under the large-sample approximation, not a statement that there is a 95% probability the fixed parameter lies in this realized interval. Its width warns that the small cohort gives imprecise information.

Diagnostics, Alternatives, and Limits

Before interpreting results, check both the data structure and the arithmetic. Confirm that every status code has one intended meaning, that every person contributes to the risk set until an event or censoring time, and that the risk-set decrement agrees with the event and censoring counts. Then check that estimates are nondecreasing, remain between zero and one, and satisfy the sum-to-one identity with event-free probability. Inspect the number at risk at the horizon: in the example, only two people remain at risk just before time 4, so the final estimate is especially sensitive to a single observed outcome and the censoring assumption.

A common mistake is to treat cause B events as censoring when estimating cause A and report one minus a Kaplan–Meier estimate as the actual probability of cause A. That calculation instead targets a net-risk quantity under a hypothetical removal of the competing cause; it does not give the observed-world probability when cause B can occur. For actual cause-specific cumulative incidence, competing events reduce future event-free probability and therefore must enter the survival update. Another mistake is to interpret a large estimate near the end of follow-up as precise merely because it is a numerical probability; the risk-set size and uncertainty matter.

Cause-specific hazard estimates describe instantaneous event rates among those still event-free, whereas cumulative incidence describes probability by a horizon in the presence of competing events. The cumulative incidence function is therefore the direct summary for this absolute-risk question. A net-risk estimate answers a different hypothetical question. This hand analysis is useful for transparent auditing and small examples, but large datasets, many event times, delayed entry, covariate adjustment, or complex censoring patterns generally require validated software and careful diagnostics. Independent censoring is a substantive assumption; the arithmetic does not establish that it holds.

1
Decode and count.
List the mutually exclusive causes and the censoring code; verify that counts total the cohort size.
2
Build the risk sets.
For each event time, count individuals under observation immediately before that time and reconcile exits.
3
Update all outcomes together.
Use total failures to update event-free probability and each cause-specific failure count for its incidence increment.
4
Report and audit.
State the horizon, event-free probability, cause-specific estimates, uncertainty, and the number at risk.

Worked Example: A Brief Audit of a New Risk-Set Row

Suppose a hypothetical analysis has 20 people at risk at time 5, with two cause A events, one cause B event, and one censoring at that time. The total event count is \(d=2+1=3\). The estimated cause A increment is \(\widehat S(5-)(2/20)=0.1000\widehat S(5-)\); the event-free probability is multiplied by \(1-3/20=0.8500\). Four people leave observation, so 16 remain for the next event time. The censoring is not included in \(d\), but it is included in the risk-set decrement. These counts satisfy the stated event-time convention.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. At an event time, \(Y=10\), with one event from each of two causes and two censorings. What fraction is used to update event-free probability, and how many remain at risk afterward?
  2. Why does censoring at a time affect later risk sets but not directly increase either cause-specific cumulative incidence?
  3. In the worked cohort, what are the estimated cause A and cause B incidences and event-free probability at time 3?
  4. What does a sum of estimated cause-specific incidences greater than one indicate if the event-free probability is also positive?
  5. Why is treating a competing event as ordinary censoring not a valid way to estimate actual cause-specific cumulative incidence?

Solutions. (1) The total event fraction is \(d/Y=2/10=0.20\), so event-free probability is multiplied by \(0.80\); the two events and two censorings leave \(10-4=6\) at risk. (2) A censored person is still at risk just before the censoring time, but has no observed event of either cause; after censoring, that person contributes no further risk time. (3) At time 3, the estimates are \(0.2604\) for cause A, \(0.4021\) for cause B, and \(0.3375\) event-free; they sum to one. (4) The sum-to-one identity is violated, indicating an error in counts, risk sets, or arithmetic, apart from negligible rounding. (5) A competing event prevents a later event of the target cause, so it reduces the event-free probability; censoring it as though its future cause were unobserved removes that competing-risk effect and changes the target quantity.

Clinical Biostats