Tutorials › Marginal Structural Models › Aligning Treatment Histories, Weights, and Event Intervals

Fitting MSMs for Survival Outcomes · Tutorial 164 of 501

Aligning Treatment Histories, Weights, and Event Intervals

Learn to assign each event interval the treatment history and supplied weight appropriate to its timing, including when treatment changes during follow-up.

Advanced 12 min read

What You'll Learn

  • Define interval boundaries and the treatment history in force during each interval.
  • Match supplied cumulative weights to the outcomes they are intended to weight.
  • Split intervals when treatment or weight-relevant timing changes.
  • Distinguish treatment-weight timing from censoring-weight timing.
  • Diagnose future-information leakage, stale weights, and boundary-time errors.
  • Check alignment using worked treatment-update and censoring examples.

Why alignment matters

In survival data arranged as person-period records, one person may contribute several rows. Each row represents a period at risk, with an event indicator, a treatment history, and often a supplied weight. These fields must describe the same portion of follow-up. A correct weight attached to the wrong interval can produce an incorrect analysis just as surely as an incorrectly calculated weight.

The essential question is temporal: what treatment information was in force for this interval, and which supplied weight was constructed for its outcome record? A column called “weight at visit 3” does not answer that question by itself. The record’s time definition and the weight construction determine whether that value belongs on the interval before or after visit 3.

We use visit times \(t_0<t_1<\cdots<t_K\), with interval \(k\) defined as \((t_{k-1},t_k]\). Let \(A_{ik}\) denote the treatment assigned or known at \(t_{k-1}\) and in force over interval \(k\), for person \(i\). Thus, the treatment history for that interval is \(\bar A_{ik}=(A_{i1},\ldots,A_{ik})\). An event indicator \(D_{ik}\) is one if the event occurs in interval \(k\), and zero otherwise.

Definition: An aligned person-period record for person \(i\) and interval \(k\) contains the interval outcome \(D_{ik}\), the treatment history \(\bar A_{ik}\) in force for that interval, and the supplied weight \(W_{ik}\) designated for that interval’s outcome contribution. The interval’s weight is not chosen by its column label alone: it must match the time point and information used in the weight construction.

The convention above treats a treatment recorded at \(t_{k-1}\) as applying immediately after that time. It also assigns an event occurring exactly at \(t_k\) to interval \(k\), so the treatment in force just before \(t_k\) governs that event. A dataset may use another boundary convention; it is valid if specified consistently. What matters is that treatment, outcome, and weight all follow the same convention.

How to map histories and weights to intervals

First establish the timeline, then map each row. The treatment history for interval \(k\) includes treatment decisions made by its start, not decisions made later. The supplied weight should be attached according to its construction. For example, a cumulative treatment weight through the decision at \(t_{k-1}\) can be used for the following interval’s outcome record. A censoring-weight factor may instead represent remaining observed over that interval. The combined supplied weight may incorporate both.

These cases need not have the same index convention. The analyst should use the weight specification to determine which decision factors are included, rather than inferring the answer from whether the weight is stored at a start or end visit. In particular, a treatment decision made after an event cannot be part of the history for that event. Nor should an event itself be used to select a weight intended to represent treatment or observation probabilities.

1
Write down the interval boundaries.
Specify whether each interval includes its left or right endpoint, and use that rule for events and treatment updates.
2
Locate each treatment update.
For every interval, record the treatment decisions known by its start. If treatment changes inside an interval, split the interval at that change.
3
Identify the weight’s time meaning.
Check which treatment decisions and observation/censoring factors the supplied weight includes, and which interval outcome it is intended to weight.
4
Check the event and follow-up status.
Retain only intervals actually contributed while the person is under observation and event-free at their start, applying the dataset’s boundary rules.

Worked Example: Updating Treatment Across Three Intervals

A study records follow-up at days 0, 30, 60, and 90. Treatment is known at the beginning of each interval, and the supplied cumulative weight is intended for that interval’s outcome record. A participant starts untreated, begins treatment at day 30, and remains treated at day 60. The supplied weights are 1.20, 1.80, and 1.62. An event occurs on day 75.

The event lies in \((60,90]\), so the relevant row is interval 3. At its start, the participant has received treatment decisions \(A_{i1}=0\), \(A_{i2}=1\), and \(A_{i3}=1\), giving history \(\bar A_{i3}=(0,1,1)\). The corresponding supplied weight is \(W_{i3}=1.62\). If the event indicator is \(D_{i3}=1\), the weighted event contribution for this row is \(W_{i3}D_{i3}=1.62(1)=1.62\).

The earlier rows carry histories \((0)\) and \((0,1)\), with weights 1.20 and 1.80. They have \(D_{i1}=D_{i2}=0\), since the event had not yet occurred. The participant does not contribute a later event-free interval after day 75. Assigning weight 1.80 to the day-75 event would use the weight for the preceding interval, not the supplied weight designated for interval 3.

Formal alignment results

The first result states the bookkeeping requirement precisely. It assumes a fixed partition of follow-up, one event at most, and a supplied weight defined for every interval that contributes an outcome. It does not assert that the weight model is correct; it says how correctly supplied interval weights must be used.

Theorem: Suppose a participant contributes event-free, observed follow-up over intervals \(1,\ldots,m\), with at most one event. For each interval \(k\), let \(D_{ik}\) be its event indicator, \(\bar A_{ik}\) the treatment history in force during it, and \(W_{ik}\) the weight designated for that interval. The weighted event contribution for the participant is $$ \sum_{k=1}^{m} W_{ik}D_{ik}. $$ If the event occurs in interval \(r\), this sum equals \(W_{ir}\); if no event occurs in the contributed intervals, it equals zero. Replacing \(W_{ir}\) by a weight designated for another interval does not preserve this contribution in general.

Proof. If the event occurs in interval \(r\), then \(D_{ir}=1\), while \(D_{ik}=0\) for every \(k\ne r\), because the participant has at most one event. Therefore $$ \sum_{k=1}^{m} W_{ik}D_{ik} = W_{ir}(1)+\sum_{k\ne r}W_{ik}(0) = W_{ir}. $$ If no event occurs, every \(D_{ik}=0\), so the sum is zero. For the final statement, consider two possible interval weights \(W_{ir}\ne W_{is}\), where \(s\ne r\). The correct event contribution is \(W_{ir}\), whereas substituting the other interval’s weight gives \(W_{is}\). These are unequal. Thus, using a weight from another interval is not generally equivalent. \(\square\)

The next result makes the treatment-history timing explicit. It relies only on the interval convention: a treatment update at a boundary affects the interval after that boundary, not the interval that has just ended.

Result: If an event occurs in interval \(r=(t_{r-1},t_r]\), its interval history is \(\bar A_{ir}=(A_{i1},\ldots,A_{ir})\), where each treatment decision is known by the start of its corresponding interval. Treatment decisions first made after the event cannot be included in that event’s history.

Derivation. By definition, interval \(r\) starts at \(t_{r-1}\), and \(A_{ir}\) is assigned or known then. The preceding decisions \(A_{i1},\ldots,A_{i,r-1}\) were made at earlier interval starts. Hence all entries of \(\bar A_{ir}\) are determined by the start of interval \(r\). Any decision first made after the event occurs later than the event time, so it is not among these decisions and cannot be part of \(\bar A_{ir}\). If treatment changes during an interval, the original interval does not satisfy the constant-treatment convention; splitting it at the change restores the stated mapping. \(\square\)

Worked applications and edge cases

Worked Example: Splitting an Interval at a Treatment Update

Suppose a record initially has one interval, \((0,30]\). Treatment is 0 from day 0 through day 12 and changes to 1 at day 12. An event occurs on day 20. The supplied weights intended for the two treatment periods are 1.10 and 2.20, respectively.

Because treatment changes at day 12, the single interval must be split into \((0,12]\) and \((12,30]\). On the first interval the history is \((0)\), the event indicator is 0, and the weighted event contribution is \(1.10(0)=0\). On the second interval the history is \((0,1)\), the event indicator is 1, and the weighted event contribution is \(2.20(1)=2.20\). The event is not assigned the first interval’s weight merely because both periods were originally stored in one row.

If the event had occurred exactly on day 12, the stated right-closed convention would assign it to \((0,12]\), with treatment 0 and weight 1.10. If the study instead defines treatment to change before outcomes recorded at day 12, its boundary convention would place the event under treatment 1. Either convention can be implemented, but it must be applied consistently to the outcome and weight.

Worked Example: Separating Treatment and Censoring Weight Timing

For interval 2, suppose a supplied combined weight is the product of a cumulative treatment weight through the treatment decision at the start of interval 2 and a censoring weight for remaining observed through that interval. The treatment component is 2.00 and the censoring component is 1.25. Thus $$ W_{i2}=2.00\times1.25=2.50. $$

If the participant is observed through interval 2 and has an event in it, the designated interval-2 outcome record receives the combined weight 2.50. The treatment history includes the decision in force at the start of interval 2. The censoring factor is included because the supplied combined weight was explicitly defined for the interval-2 outcome record and its observation status.

Now suppose a new treatment decision is recorded at the end of interval 2. It belongs to interval 3 under this convention; it must not be added to the treatment history for an event that occurred during interval 2. Nor should the analyst multiply 2.50 by the censoring factor again: that factor is already part of the supplied combined weight. The weight specification, rather than a general rule that all factors are measured at the start or end, determines the appropriate attachment.

Diagnostics, alternatives, and limitations

Several checks can reveal a mismatch before fitting a model. Inspect the first and last rows for a participant: does the initial treatment history agree with baseline timing, and does follow-up stop at the event or censoring time? For each treatment change, verify that the first row carrying the new treatment starts at the change time. Confirm that the weight attached to each row is the supplied value intended for that interval, and check that the component factors have not been omitted or multiplied twice.

  • Future-information leakage: an interval’s history or weight uses a treatment update that occurs after the interval outcome. Reconstruct the timeline and exclude later decisions.
  • Stale values: a new treatment history is recorded, but the earlier interval’s weight is carried forward without checking its intended index. Re-map the supplied weights to the outcome intervals.
  • Unsplit updates: one row spans periods with different treatment. Split it at the update and assign each subinterval its own history and corresponding supplied weight.
  • Boundary disagreement: an event at a visit is assigned to one interval, while treatment or weight timing follows the opposite convention. State and apply one boundary rule throughout.
  • Duplicate censoring adjustment: a supplied weight already includes a censoring factor, but the factor is multiplied in again. Check the supplied weight’s definition before combining components.

A start-stop representation and an expanded person-period table can encode the same timing if both use the same boundaries and attach each interval’s history and weight to the same outcome contribution. A single row per person, or a carry-forward rule that ignores treatment changes, may be simpler to store but cannot represent distinct treatment histories and weights across intervals without additional structure. Neither format repairs a weight whose time meaning is unknown.

Correct alignment is necessary but not sufficient for a valid analysis. It does not establish that the supplied weights were estimated appropriately, that the causal assumptions hold, or that the outcome model is suitable. Extreme or irregular weights may also signal problems, but alignment checks alone cannot determine their cause. When weight construction and record timing cannot be reconciled, the analysis should pause until the weight definition or data layout is clarified.

Check Your Understanding

Answer each question using the interval convention in this tutorial. Solutions follow the questions.

  1. An event occurs in interval 4. Which treatment decisions belong in its history?
  2. Treatment changes halfway through a stored interval, and the event occurs after the change. What should happen to the record?
  3. A supplied combined weight for interval 2 is 1.50, including all designated components. Should an analyst multiply it by the same censoring factor again?
  4. An event occurs exactly at the right endpoint of interval 1. Under the convention used here, which interval and treatment history apply?

Solutions. (1) The history is \(\bar A_{i4}=(A_{i1},A_{i2},A_{i3},A_{i4})\), with each decision known by the start of its interval. (2) Split the stored interval at the treatment change; assign the post-change event to the second subinterval with the updated history and its designated weight. (3) No. The censoring factor is already included, so multiplying it again would duplicate that component. (4) The event belongs to interval 1 because intervals are right-closed; use the treatment history in force during interval 1.

Clinical Biostats