Tutorials › Econometrics (Graduate) › Immortal-Time Bias In Survival Data

Duration and Survival Models · Tutorial 587 of 952

Immortal-Time Bias In Survival Data

Learn to recognize immortal-time bias, calculate its effect on person-time comparisons, and represent treatment timing correctly in survival analyses.

Advanced 11 min read

What You'll Learn

  • Define immortal time and identify the future information that creates it
  • Calculate how assigning pre-treatment follow-up to an exposed group distorts rates
  • Code exposure as a time-dependent indicator that changes at treatment initiation
  • Construct Cox risk sets using each person’s exposure status at the event time
  • Choose a time origin that aligns eligibility, follow-up, and the question being studied
  • Distinguish correcting immortal-time bias from establishing a causal treatment effect

Why Treatment Timing Matters

In a survival analysis, exposure is not always fixed at the start of follow-up. A patient might begin a treatment weeks or months after becoming eligible for it. If researchers classify patients as “treated” because they receive treatment at any point during follow-up, they use future information to assign exposure at earlier times. That can put time before treatment into the treated group—even though a patient had to remain alive and free of the event long enough to receive treatment.

This problem is called immortal-time bias. It can make treatment appear protective because part of the treated group’s follow-up is guaranteed to be event-free by the way that group was defined. The remedy is to represent treatment status as it changes over time and to define a time origin that matches the population and follow-up period being studied. Neither step, by itself, removes other sources of bias or establishes a causal effect.

Definition: Immortal time is a period during which a person must remain free of a specified event in order to be classified into a group defined using later information. Immortal-time bias occurs when that period is misallocated—for example, counted as exposed follow-up for someone who was not yet exposed—thereby distorting comparisons of event rates, hazards, or survival.

“Immortal” refers to the event and classification rule, not to an absence of all possible risks. For example, if a person must survive without the study endpoint until treatment initiation to count as treated, the pre-treatment period is immortal with respect to that endpoint. The issue is especially direct when the endpoint itself prevents later treatment initiation.

How Future Classification Creates the Bias

Let time zero be the start of eligibility and follow-up. Write \(A_i\) for person \(i\)’s treatment initiation time, \(T_i\) for the event time, and \(C_i\) for the censoring time. A common but problematic baseline classification is “ever treated”: a person is labelled treated if \(A_i\) occurs before their observed follow-up ends, and untreated otherwise. If the endpoint prevents treatment, being classified as ever treated implies \(T_i>A_i\). In particular, such a person could not have had the endpoint before \(A_i\) and still subsequently entered the ever-treated group.

The error is not that treatment status changes. It is that the analysis assigns status at baseline using what happens later. For a person treated at day 30, days 0 through 30 are unexposed time. Counting them as exposed adds event-free time to the exposed denominator, while any event that prevents treatment during that period is necessarily excluded from the ever-treated group.

$$ \text{ever-treated classification: } Z_i(t)=I(A_i \leq \text{end of observed follow-up}) \qquad \text{time-dependent coding: } X_i(t)=I(t\geq A_i) $$

The second expression codes exposure at time \(t\): it is zero before treatment initiation and one from initiation onward. A person who never initiates treatment has \(X_i(t)=0\) throughout observed follow-up. If treatment can be stopped or restarted, the exposure history needs to represent those changes too; a single indicator that stays one after initiation would then not describe current treatment.

Worked Example: Allocating Follow-Up on Individual Timelines

Consider four hypothetical people, all eligible at day 0. Person A starts treatment on day 30 and has the event on day 60. Person B starts treatment on day 30 and is censored on day 90. Person C never starts treatment and has the event on day 45. Person D never starts treatment and is censored on day 90. Assume treatment is not started after the event, and all four enter the risk set at day 0.

With an ever-treated classification, A and B are both labelled treated from day 0. Their total observed time is \(60+90=150\) person-days, with one event. C and D are labelled untreated, contributing \(45+90=135\) person-days and one event. The crude rates are therefore:

$$ \widehat{\lambda}_{\text{ever treated}}=\frac{1}{150}=0.006667, \qquad \widehat{\lambda}_{\text{never treated}}=\frac{1}{135}=0.007407 \quad\text{events per person-day.} $$

This comparison makes the ever-treated group look as if it has the lower rate. But A and B each contribute 30 pre-treatment days to that group. Under time-dependent coding, their pre-treatment time contributes \(30+30=60\) unexposed person-days. A contributes 30 treated days before the event; B contributes \(90-30=60\) treated days before censoring. Thus treated follow-up is \(30+60=90\) person-days with one event, while untreated follow-up is \(60+45+90=195\) person-days with one event. The corresponding crude rates are \(1/90=0.01111\) and \(1/195=0.005128\) events per person-day. These tiny data are only an arithmetic illustration: neither comparison establishes a treatment effect.

Quantifying the Misallocated Person-Time

The following larger hypothetical example shows how the same classification error can alter a rate ratio. Rates are descriptive event counts divided by observed person-time; interpreting them as causal effects would require additional design and modeling assumptions.

Worked Example: Comparing Naive and Time-Dependent Rates

Suppose 100 people enter follow-up on day 0. Forty initiate treatment on day 30. Among those 40, 10 have the event on day 60 and 30 are censored on day 180. The other 60 never initiate treatment: 20 have the event on day 90 and 40 are censored on day 180. Assume no one has the event before treatment initiation and that everyone is observed from day 0 until their event or censoring.

First assign exposure by whether treatment is ever received. The 40 eventual initiators contribute \(10(60)+30(180)=6{,}000\) person-days and 10 events. The 60 never-initiators contribute \(20(90)+40(180)=9{,}000\) person-days and 20 events. Per 1,000 person-days, the crude rates and their ratio are:

$$ \widehat{\lambda}_{\text{ever treated}}=\frac{10}{6{,}000}(1{,}000)=1.667, \qquad \widehat{\lambda}_{\text{never treated}}=\frac{20}{9{,}000}(1{,}000)=2.222, \qquad \frac{\widehat{\lambda}_{\text{ever treated}}}{\widehat{\lambda}_{\text{never treated}}}=0.750. $$

Now allocate the first 30 days of the 40 initiators’ follow-up to the unexposed state. Their pre-treatment time is \(40(30)=1{,}200\) person-days. Their treated time is \(10(60-30)+30(180-30)=4{,}800\) person-days, with 10 events. Never-initiators add 9,000 unexposed person-days and 20 events. The time-dependent rates are therefore \(10/4{,}800 \times 1{,}000=2.083\) events per 1,000 treated person-days and \(20/(1{,}200+9{,}000)\times 1{,}000=1.961\) events per 1,000 untreated person-days. Their ratio is \(2.083/1.961=1.062\). The change from 0.750 to 1.062 shows how much the crude comparison depends on allocating the pre-treatment time; it does not show that treatment causes harm.

Time-Dependent Coding in a Cox Model

The same principle applies to a Cox proportional-hazards model. At each event time, the risk set contains people still under observation and event-free immediately before that time. Each person’s covariates in the risk-set comparison must represent their status at that time, not a later status. A simple model with a time-dependent treatment indicator is:

$$ h_i(t)=h_0(t)\exp\{\beta X_i(t)\}, \qquad X_i(t)=I(t\geq A_i). $$

Here \(h_i(t)\) is person \(i\)’s hazard at time \(t\), \(h_0(t)\) is the baseline hazard, and \(\beta\) is the log hazard ratio associated with treatment status under this model. This coding addresses the specific exposure-timing error; it does not guarantee that the model is otherwise correctly specified, that censoring is noninformative conditional on modeled variables, or that treatment groups are comparable. In particular, time-dependent confounding can remain.

Worked Example: Exposure Status in Cox Risk Sets

Suppose five hypothetical people begin follow-up at day 0. P starts treatment on day 30 and has the event on day 45. Q never starts and has the event on day 50. R starts on day 60 and is censored on day 90. S never starts and is censored on day 90. U has the event on day 20. Assume no other censoring or events before the times listed.

At day 20, all five people are at risk just before U’s event. Neither P nor R has yet started treatment, so all five have \(X_i(20)=0\). If \(\beta=\log 2\) simply for illustration, the Cox partial-likelihood contribution for U’s event is \(1/5\): the event subject’s relative hazard is 1, and the five risk-set relative hazards sum to 5. If P and R are wrongly labelled treated because they will start treatment later, the denominator becomes \(2+2+1+1+1=7\), and the contribution becomes \(1/7\). Future treatment has incorrectly altered a risk-set comparison made at day 20.

At day 45, P has the event; P, Q, R, and S are still at risk immediately before it. Correctly coded, P is treated, while Q, R, and S are untreated: R does not start until day 60. The partial-likelihood contribution for P’s event is:

$$ \frac{\exp(\beta)}{\exp(\beta)+1+1+1} = \frac{2}{2+3} =0.4000 \quad\text{when } \beta=\log 2. $$

Under ever-treated coding, R is also labelled treated at day 45, giving the incorrect contribution \(2/(2+2+1+1)=2/6=0.3333\). These are likelihood contributions at a specified coefficient, not estimates of \(\beta\). They demonstrate why event-time risk sets must use the exposure history available at each time.

Choose a Time Origin That Matches the Question

Correct exposure coding depends on a well-defined time scale. Time zero should mark the start of the risk period for the population and question under study—for example, the date of eligibility, diagnosis, or cohort entry—and should be applied consistently to people being compared. Starting treated patients’ clocks at treatment initiation while starting untreated patients’ clocks at eligibility creates different risk periods and can misalign comparisons. It may also omit the time required to reach treatment.

A landmark analysis is a different, sometimes appropriate design: choose a prespecified landmark, include only people still eligible and event-free at that time, classify their status using information available by the landmark, and begin the analysis at the landmark. Its estimand concerns that selected landmark population, not everyone eligible at the original time zero. The period before the landmark is not counted as follow-up for that analysis. This can avoid assigning pre-landmark time to a later-defined group, but it changes the target population and does not answer the same question as following the original cohort from eligibility.

If people enter observation after the chosen time origin, the analysis must also represent that they were not yet under observation before entry. The key principle remains the same: include a person in a risk set only when they are observed, event-free, and at risk, and use covariate values appropriate to that time.

A Short Justification

The source of the bias follows directly from the group definition. Suppose the endpoint prevents later treatment, and define the exposed group as people who eventually initiate treatment. For a person in that group, having the endpoint before initiation would make subsequent initiation impossible. Therefore:

$$ \{\text{eventual treatment}\}\subseteq\{T_i>A_i\}, \qquad P(T_i>A_i\mid\text{eventual treatment})=1. $$

That event-free time before \(A_i\) is then counted as exposed time by a baseline ever-treated classification, even though the person was not yet exposed. The untreated group, meanwhile, can include people who have an event before they would have initiated treatment. Thus, early events can accumulate in the untreated group while early event-free time accumulates in the treated group. Coding \(X_i(t)=0\) before \(A_i\) and \(X_i(t)=1\) afterward aligns person-time with actual exposure status, removing this particular misallocation.

Common Mistakes and Practical Checks

  • Classifying by eventual treatment at baseline. “They were treated” is not an adequate description of their status from the start of follow-up. Record when treatment begins and assign earlier time to the unexposed state.
  • Assuming time-dependent coding solves every problem. It corrects this timing misclassification, but confounding, selection, informative censoring, and model misspecification may still distort the estimate.
  • Mixing time origins. Comparing follow-up from diagnosis in one group with follow-up from treatment initiation in another creates unequal risk periods. Define eligibility and time zero consistently, or state why a different design targets a different population.
  • Calling all pre-treatment time “immortal” without qualification. The time is guaranteed event-free only when the event and the rule for later exposure classification make it so. Specify the endpoint and the classification rule.
Key takeaway: Exposure defined by future treatment can place guaranteed event-free time in the treated group. Start follow-up at a clearly defined and aligned time origin, and represent treatment at each time using the exposure history up to that time. These steps prevent immortal-time misallocation but do not, on their own, justify a causal interpretation.

Check Your Understanding

Use the timing and risk-set principles in these questions.

  1. A study labels everyone who starts a drug within six months as treated from the date of diagnosis. What interval may be misallocated, and why?
  2. A patient starts treatment on day 40 and has an event on day 70. Under time-dependent coding, how many days of this patient’s follow-up are unexposed and how many are treated?
  3. Why can an event before treatment initiation appear in the never-treated group but not among people classified as eventually treated when the event prevents treatment?
  4. At a Cox-model event time of day 25, a person scheduled to start treatment on day 40 is still at risk. What treatment value belongs in that person’s risk-set covariates?
  5. How does a landmark analysis change the population and follow-up period compared with following everyone from initial eligibility?
Clinical Biostats