Tutorials › Exam ASTAM - Advanced Short-Term Actuarial Mathematics › Building A Risk Set Table By Hand

Exam ASTAM · Empirical Loss and Survival · Tutorial 213 of 979

Building A Risk Set Table By Hand

Build and check a risk set table by organizing observed times and counting the records still under observation immediately before each event time.

Beginner 11 min read

What You'll Learn

  • Distinguish an observed event from a right-censored record in a table.
  • Sort records by observed time without losing their event indicators.
  • Count the risk set immediately before each distinct event time.
  • Record the number of events at each event time.
  • Check risk-set counts against the original records and avoid common boundary errors.

Why Build a Risk Set Table?

When event times are incomplete because some observations are right-censored, a list of observed times is not enough to show how many observations could have experienced an event at each time. A risk set table organizes the records so that this count can be read directly. The task is practical: sort the observed records, keep each event indicator attached to its time, and count who is still under observation immediately before each event time.

The examples use hypothetical portfolios of service contracts. The event is a first covered repair, and a contract is right-censored if observation ends before a repair is recorded. The same table-building method applies to other event-time settings. At this stage, the goal is to construct the counts accurately, not to estimate a survival curve.

Definition: For observation \(i\), let \(T_i\) be its event time and \(C_i\) its censoring time. The observed time is \(U_i=\min(T_i,C_i)\), and the event indicator is \(\delta_i=1\) if the event is observed at \(U_i\), and \(\delta_i=0\) if the record is right-censored at \(U_i\). At an event time \(t\), the risk set consists of observations still under observation immediately before \(t\). Its size is \(Y(t)\), and the number of observed events at \(t\) is \(d(t)\).

For a cohort with no delayed entry, an observation is in the risk set immediately before \(t\) exactly when its observed time is at least \(t\). Thus, an event recorded at \(t\) is included in \(Y(t)\): that observation was under observation just before the event occurred. The event count \(d(t)\), by contrast, counts only records with an event indicator of 1 at that time.

$$ Y(t)=\sum_i \mathbf{1}(U_i\ge t), \qquad d(t)=\sum_i \mathbf{1}(U_i=t,\ \delta_i=1) $$

These expressions are counting rules. Each observation contributes one to \(Y(t)\) if its record has not ended before \(t\), and contributes one to \(d(t)\) only if it has an observed event exactly at \(t\). A right-censored observation can belong to an earlier risk set, but it does not count as an event. The table is usually displayed at distinct event times; censoring records are still shown in time order because they affect which observations remain at risk later.

A Reliable Hand-Building Procedure

Begin with one row per observation. Preserve both the observed time and its event indicator while sorting. Then make a chronological record table and calculate \(Y(t)\) and \(d(t)\) at each distinct event time. In the examples below, no event and censoring records share a time, so no tie convention is needed.

1
Keep each record intact.
Write its identifier, observed time, and status together. Do not sort times separately from event indicators.
2
Sort by observed time.
List every event and censoring record in chronological order, including censoring records that occur before later events.
3
Count at each event time.
Count records with observed times at or after that event time for \(Y(t)\), and count the event records at that time for \(d(t)\).
4
Check the counts.
Confirm that the initial risk set equals the cohort size and that every later risk count can be verified from the sorted records.

Worked Tables

Worked Example: Sorting Events and Censoring Records

A hypothetical group of seven service contracts is followed from time zero. The records are: A, event at time 2; B, censored at time 3; C, event at time 4; D, censored at time 5; E, event at time 6; F, censored at time 7; and G, event at time 8. Construct the time-ordered table, giving the risk-set size and event count at each event time.

Method. Sort all seven records by observed time, then count the records whose observed times are at least each event time. The cohort starts with seven observations.

Observed timeRecordStatusRisk-set size \(Y(t)\)Event count \(d(t)\)
2AEvent71
3BCensored——
4CEvent51
5DCensored——
6EEvent31
7FCensored——
8GEvent11

At time 2, all seven records have observed times at least 2, so \(Y(2)=7\). At time 4, A and B have already ended at times 2 and 3; C, D, E, F, and G remain, so \(Y(4)=5\). At time 6, only E, F, and G have observed times at least 6, giving \(Y(6)=3\). At time 8, only G remains, giving \(Y(8)=1\). Each event time has one event, so \(d(t)=1\) at each of the four event times.

Check. The event-time risk-set sizes are \(7,5,3,1\), and each is verified by counting the sorted records at or after that time. A common mistake is to leave the risk set at 7 for every event. That would incorrectly include contracts B and D after they were censored. The correction is to exclude any record whose observed time is strictly earlier than the event time being assessed.

Worked Example: Constructing Counts from an Unsorted List

For a hypothetical second portfolio, the records are provided in this order: P, event at 7; Q, event at 1; R, censored at 4; S, event at 5; T, censored at 6; U, event at 9; V, censored at 8; and W, event at 3. Build the time-ordered table and report \(Y(t)\) and \(d(t)\) at each event time.

Method. First sort the records, retaining each status: Q (event, 1), W (event, 3), R (censored, 4), S (event, 5), T (censored, 6), P (event, 7), V (censored, 8), U (event, 9). There are eight observations initially.

Observed timeRecordStatusRisk-set size \(Y(t)\)Event count \(d(t)\)
1QEvent81
3WEvent71
4RCensored——
5SEvent51
6TCensored——
7PEvent31
8VCensored——
9UEvent11

At time 1, all eight records are at risk. At time 3, only Q has ended before 3, so \(Y(3)=7\). At time 5, Q, W, and R have ended before 5; the remaining records are S, T, P, V, and U, so \(Y(5)=5\). At time 7, the records at or after 7 are P, V, and U, giving \(Y(7)=3\). At time 9, only U is at risk, so \(Y(9)=1\). Each event occurs once, giving \(d(t)=1\) at each event time.

Check. There are five event records and three censored records, accounting for all eight observations. The risk count at time 5 is not 6: R was censored at time 4 and is no longer under observation at time 5. Sorting first avoids the common mistake of counting from the original, unsorted list without tracking which records ended earlier.

Worked Example: Verifying Risk Counts Directly from the Records

A hypothetical third cohort has nine records: A is censored at time 2; B has an event at time 3; C is censored at time 4; D has an event at time 5; E has an event at time 6; F is censored at time 7; G has an event at time 8; H is censored at time 9; and I has an event at time 10. Construct the risk-set table at the event times and verify the count at time 6 in two ways.

Method. The records are already in time order. At time 6, count records with observed time at least 6: E, F, G, H, and I. Therefore, \(Y(6)=5\). Equivalently, the records A, B, C, and D all have observed times earlier than 6, leaving \(9-4=5\) at risk.

Observed timeRecordStatusRisk-set size \(Y(t)\)Event count \(d(t)\)
2ACensored——
3BEvent81
4CCensored——
5DEvent61
6EEvent51
7FCensored——
8GEvent31
9HCensored——
10IEvent11

The risk counts are \(Y(3)=8\), \(Y(5)=6\), \(Y(6)=5\), \(Y(8)=3\), and \(Y(10)=1\). The event count is one at each of those times. In particular, E is included in \(Y(6)\) even though E has an event at time 6: E was under observation immediately before that event. F, censored later at time 7, is also included at time 6.

Check. The nine records comprise five events and four censorings. A frequent boundary error is to count only records with observed times strictly greater than 6, which would omit E and give 4. The risk set is defined immediately before the event time, so the correct condition is \(U_i\ge 6\), giving \(Y(6)=5\).

Why the Counting Rule Works

The risk-set count is a direct consequence of the timeline. If an observation has \(U_i<t\), its record ended before \(t\), either because the event occurred or because observation was censored. It cannot still be under observation immediately before \(t\). If \(U_i>t\), its record extends beyond \(t\), so it is under observation immediately before \(t\). If \(U_i=t\), the record reaches the event time and is still present immediately before that time. These cases give the criterion \(U_i\ge t\).

To see why the event count is different, consider the status indicator as well as the time. A record with \(U_i=t\) might be an event or a censoring record; only the former contributes to the number of events at \(t\). Hence the event count requires both \(U_i=t\) and \(\delta_i=1\). This distinction prevents a censoring record from being mistaken for an event merely because its observed time appears in the table.

The table should show the risk-set size and event count at event times. A dash in those columns on a censoring row means that the row is included to show the chronology, not that a risk-set count or event count is being reported at that censoring time. Keeping all censoring rows visible makes it easier to audit later risk-set counts.

Common Table-Building Errors

  • Counting only event records in the risk set. An observation censored after \(t\) is still at risk immediately before \(t\), even though it will not later contribute an event.
  • Counting records whose times are strictly greater than \(t\). An event at \(t\) is included in the risk set just before \(t\); use \(U_i\ge t\), not \(U_i>t\).
  • Treating censoring as an event. A censoring row has \(\delta_i=0\), so it does not add to \(d(t)\).
  • Sorting times but not statuses. A status accidentally paired with another observation’s time can change both the event count and subsequent risk-set counts. Move each record as a unit.
  • Forgetting early censoring records. A censored observation leaves the risk set for later event times, even though its time is not itself an event time.
Key takeaway: At a distinct event time \(t\), count every record with \(U_i\ge t\) to obtain \(Y(t)\), and count only records with \(U_i=t\) and \(\delta_i=1\) to obtain \(d(t)\). A sorted table that preserves each record’s status makes both counts auditable.

Check Your Understanding

For each hypothetical cohort, identify the event-time risk-set sizes and event counts. Assume no delayed entry and no tied event and censoring times.

  1. A five-contract cohort has an event at time 2, censoring at time 4, an event at time 5, censoring at time 7, and an event at time 9. Give \(Y(t)\) and \(d(t)\) at each event time. (Answer: \(Y(2)=5,\ d(2)=1;\ Y(5)=3,\ d(5)=1;\ Y(9)=1,\ d(9)=1\).)
  2. Six records are: censored at 1, event at 2, censored at 3, event at 4, event at 6, and censored at 8. Give the event-time risk-set sizes and event counts. (Answer: \(Y(2)=5,\ d(2)=1;\ Y(4)=3,\ d(4)=1;\ Y(6)=2,\ d(6)=1\).)
  3. Seven records are: event at 1, censoring at 2, censoring at 5, event at 4, event at 6, censoring at 7, and event at 8. Sort the records and give the event-time counts. (Answer: Sorted times are event 1, censor 2, event 4, censor 5, event 6, censor 7, event 8; \(Y(1)=7,\ Y(4)=5,\ Y(6)=3,\ Y(8)=1\), with \(d(t)=1\) at each event time.)
  4. Eight records are: censoring at 1, event at 2, event at 4, censoring at 5, event at 7, censoring at 8, event at 9, and censoring at 10. What are the risk-set sizes and event counts at event times? (Answer: \(Y(2)=7,\ d(2)=1;\ Y(4)=6,\ d(4)=1;\ Y(7)=4,\ d(7)=1;\ Y(9)=2,\ d(9)=1\).)
  5. A cohort has nine records: events at 2, 5, 8, and 11; censorings at 1, 3, 6, 9, and 12. Find the risk set at each event time, including the event occurring at that time. (Answer: \(Y(2)=8,\ d(2)=1;\ Y(5)=6,\ d(5)=1;\ Y(8)=4,\ d(8)=1;\ Y(11)=2,\ d(11)=1\).)
Clinical Biostats