Why Risk-Set Construction Matters
A risk set specifies which individuals are eligible to experience an event at a given time. In recurrent-event analyses, eligibility depends on the formulation: a previous event may leave someone eligible for another event, be required before they enter the next event-order risk set, or be treated as part of a marginal time-to-event outcome. The same observed event history can therefore generate different risk sets without any arithmetic error.
This tutorial focuses on constructing those sets, not on fitting or interpreting the models that use them. Keep the clock and the event-order definition explicit: both determine which individuals contribute at a given event time.
Let \(C_i\) be individual \(i\)'s end of observation, and let \(T_{ik}\) be their time of the \(k\)th recurrent event, when observed. Write \(T_{i0}=0\). If event \(k\) is not observed during follow-up, treat its time as beyond follow-up for risk-set construction; do not treat censoring as an event. For clarity, examples below have no tied events or censoring times.
Andersen–Gill: Prior Events Do Not End Eligibility
In the Andersen–Gill formulation, a recurrent event does not, by itself, remove an individual from the risk set. Provided observation continues, that individual can contribute risk time before and after any number of recurrent events. If follow-up ends at \(C_i\), the indicator is
This simple expression assumes the person is under observation throughout the interval represented by \(C_i\), and that no other event permanently ends eligibility. If a terminal event does end follow-up, incorporate it into the end-of-observation time. At an event time \(t=T_{ik}\le C_i\), the indicator is 1 immediately before the event; the recurrent event does not make the indicator 0 afterward.
Worked Example: Andersen–Gill Membership After Previous Events
Suppose four hypothetical participants have the following event and censoring times: A has events at 2 and 5 and is observed through 12; B has an event at 3 and is observed through 12; C has an event at 4 and is observed through 7; D has no event and is censored at 6. Find the Andersen–Gill risk sets immediately before \(t=4.5\) and \(t=6.5\).
At \(t=4.5\), compare each censoring time with 4.5. All four satisfy \(4.5\le C_i\): A, B, C, and D remain under observation. Thus \(R^{AG}(4.5)=\{A,B,C,D\}\). A, B, and C have already had events, but those events do not end their Andersen–Gill eligibility.
At \(t=6.5\), A, B, and C satisfy \(6.5\le C_i\), while D does not because \(6.5>6\). Therefore \(R^{AG}(6.5)=\{A,B,C\}\). C remains eligible because observation continues through 7, and A remains eligible despite having experienced two events.
PWP: Eligibility Depends on Event Order
The Prentice–Williams–Peterson (PWP) formulation creates a separate risk set for each event order. An individual can enter the risk set for event \(k\) only after experiencing event \(k-1\). They leave that event-\(k\) risk set when event \(k\) occurs or observation ends. For event 1, everyone starts at time zero and leaves at their first event or censoring.
With a total-time clock, all event times are measured from the common study origin. The indicator, including the first event by taking \(T_{i0}=0\), is
The entry condition \(T_{i,k-1}<t\) requires the preceding event to have occurred before \(t\). The exit condition \(t\le T_{ik}\) removes the person after the event of interest, while retaining them immediately before it. The censoring condition keeps them eligible only while observed. If \(T_{ik}\) is unobserved, it is treated as beyond follow-up, so censoring determines the exit. For \(k=1\), the condition \(T_{i0}=0<t\) gives the ordinary initial risk set, but the \(T_{i1}\) condition still removes someone after their first event.
Worked Example: PWP Risk Sets at Two Total Times
Use the hypothetical histories from the previous example. Calculate the PWP event-1 and event-2 risk sets immediately before 4.5 and 6.5. For event 1, a participant must not yet have experienced their first event and must still be observed.
At \(t=4.5\), A, B, and C have experienced their first events at 2, 3, and 4, respectively. They have exited the event-1 risk set. D has not had a first event and is observed through 6. Thus \(R_1^{PWP-TT}(4.5)=\{D\}\).
At \(t=6.5\), A, B, and C have each already experienced event 1, and D was censored at 6. No one is eligible: \(R_1^{PWP-TT}(6.5)=\varnothing\).
For event 2 at \(t=4.5\), a participant must have had event 1 before 4.5, must not yet have had event 2, and must still be observed. A has had event 1 at 2 but not event 2 until 5; B has had event 1 at 3 and no observed event 2; C has had event 1 at 4 and no observed event 2. All three remain under observation, so \(R_2^{PWP-TT}(4.5)=\{A,B,C\}\). D has not had event 1 and cannot enter.
At \(t=6.5\), A has experienced event 2 at 5 and has exited the event-2 risk set. B and C have had event 1 but not event 2, and both remain observed at 6.5. D cannot enter because they have not had event 1 and are censored. Hence \(R_2^{PWP-TT}(6.5)=\{B,C\}\).
The gap-time PWP formulation changes the time scale, not the event-order eligibility rule. For \(k\ge2\), define the gap from event \(k-1\) to event \(k\) as \(G_{ik}=T_{ik}-T_{i,k-1}\). A person enters the event-\(k\) risk period only after event \(k-1\), with elapsed gap time \(u\) starting at zero. Their observed time available on that clock is \(C_i-T_{i,k-1}\). The indicator at positive gap time is
and this indicator applies only when event \(k-1\) was observed. For event 1, use time since the study origin and the event-1 indicator above. The gap-time version still requires the preceding event, and still removes someone after the event being modeled. It compares elapsed times since the previous event rather than times since study entry; it does not make a person eligible for event \(k\) before event \(k-1\).
WLW: Marginal Event-Order Outcomes
The Wei–Lin–Weissfeld (WLW) formulation treats time to each event order as a separate marginal outcome. Each participant is assigned an outcome for each \(k\), and each such outcome starts at the common origin. Thus, for event \(k>1\), participants can be in the WLW risk set before they have experienced event \(k-1\). This differs from PWP's conditional entry requirement.
Operationally, let \(\widetilde T_{ik}\) be the observed time to event \(k\) if that event occurs before censoring; otherwise, let \(\widetilde T_{ik}=C_i\) and mark the outcome as censored. The risk indicator for the event-\(k\) marginal outcome is
An event of order \(k\) removes the individual from the risk set for that outcome, but a previous event of a different order does not. A higher-order event can only be observed after the lower-order events in the actual history. Consequently, a participant censored before reaching event \(k\) contributes censored follow-up—not an event—to that outcome. WLW risk sets are marginal outcome risk sets; their construction does not assert that a person can physically experience event \(k\) before the earlier events.
Worked Example: Comparing PWP and WLW for Event 2
Return to the same hypothetical cohort and construct the event-2 risk sets immediately before 4.5 and 6.5. A has event 2 at 5; B and C do not experience a second event during observed follow-up; D is censored at 6 without a first event.
For PWP, event 2 requires an observed first event before the time being considered. At 4.5, A, B, and C meet that entry condition and have not yet had event 2, so \(R_2^{PWP-TT}(4.5)=\{A,B,C\}\). D is excluded because event 1 has not occurred.
For WLW event 2, all four participants entered the marginal event-2 outcome at the origin. At 4.5, none has had event 2, and all remain under observation. Therefore \(R_2^{WLW}(4.5)=\{A,B,C,D\}\). D contributes follow-up to the event-2 outcome even though D has not experienced event 1.
At 6.5, A has had event 2 and exits that outcome's risk set. B and C have not had event 2 and remain observed. D was censored at 6. Thus \(R_2^{WLW}(6.5)=\{B,C\}\), the same membership as the PWP event-2 set at this time, but for a different reason: PWP excludes D for not reaching event 1, while WLW excludes D because follow-up ended before 6.5.
A General Check on Entry and Exit
The PWP total-time indicator follows directly from intersecting three requirements: entry after event \(k-1\), no event \(k\) yet, and continued observation. Each requirement contributes one condition. Their intersection gives the indicator, and dropping any one condition changes the risk set.
This construction also makes the before-event convention explicit. At \(t=T_{ik}\), the person remains in the risk set immediately before event \(k\); immediately after \(T_{ik}\), the condition \(t\le T_{ik}\) fails. At \(t=T_{i,k-1}\), the person has not yet entered the next event-order risk set under the strict entry condition; they become eligible after that preceding event.
Diagnostics, Alternatives, and Limits
A practical check is to calculate membership from individual histories at event times rather than infer it from a generic phrase such as “still followed.” For each person and event order, ask three questions: Have they met the formulation's entry condition? Has the event being modeled already occurred? Are they still observed? Then apply the clock specified by the analysis.
- Andersen–Gill: recurrent events do not end eligibility while follow-up continues. A participant exits at the end of observation or another specified terminal event.
- PWP: event order governs entry. A participant must have reached the preceding event, and the event of interest ends that event-order risk period.
- WLW: each event-order outcome starts from the common origin. Previous events do not impose PWP-style delayed entry, but the event of interest or censoring ends that outcome's risk period.
For PWP, total time and gap time give different numerical time coordinates even though both condition on reaching the preceding event. With total time, two people who reach event \(k-1\) at different study times can be compared at a common study time. With gap time, their event-\(k\) follow-up is indexed by elapsed time since their own preceding event. Choosing between them is a choice of clock and target comparison, not a reason to omit the event-\(k\) exit condition.
Risk-set construction alone does not guarantee valid inference. The event history and observation times must be recorded correctly, and censoring assumptions must be appropriate for the intended analysis. Informative loss to follow-up can distort who remains observed. In PWP, later event-order analyses concern people who reach the preceding event, so their population is selected by that history. In WLW, the separate outcomes from one person are dependent; defining marginal risk sets does not make those outcomes independent. These are limitations to account for when specifying an analysis, not changes to the membership rules above.
Common Mistakes
- Leaving someone in a risk set after its event. A person who experienced event \(k\) has exited the event-\(k\) risk set. Include the condition \(t\le T_{ik}\) under the before-event convention.
- Using PWP entry for WLW. PWP requires event \(k-1\) before entry; WLW assigns each event-order outcome from the common origin.
- Treating every recurrent event like a terminal event. In Andersen–Gill, a recurrent event does not by itself end eligibility.
- Confusing time scales with eligibility. Changing PWP from total time to gap time changes the clock, not the requirement to reach event \(k-1\) or the exit at event \(k\).
Check Your Understanding
Use the hypothetical cohort above. Give your reasoning as well as each risk set.
- Immediately before time 5, which participants are in the Andersen–Gill risk set?
- Immediately before time 5, who is in the PWP event-2 total-time risk set?
- Immediately before time 6.5, who is in the PWP event-1 risk set?
- Why is D in the WLW event-2 risk set at time 4.5 but not the PWP event-2 risk set?
- For PWP gap time, does reaching event 1 at time 4 make C eligible for event 2 before time 4?
Solutions. (1) A, B, C, and D are all observed at time 5; A's event at 5 has not yet removed A immediately before that event. (2) A, B, and C have had event 1, have not yet had event 2 immediately before 5, and remain observed, so the set is \(\{A,B,C\}\). (3) The set is empty: A, B, and C have already had event 1, and D was censored at 6. (4) WLW starts D's event-2 marginal outcome at the origin; PWP requires a preceding first event, which D has not had. (5) No. C enters the event-2 gap-time risk period only after event 1; time 4 is the start of that gap clock, not eligible time before event 1.