Prompt and setting
You are analyzing time until an event such as cancellation, relapse, or machine failure. For users still active at the observation cutoff, the exact event time is unknown; their record is right-censored, not a zero or a failure.
What the interviewer tests
- Representing an observed time and an event indicator correctly.
- Explaining Kaplan–Meier risk sets and why censoring removes a subject only after its censor time.
- Knowing when a Cox proportional-hazards model or competing-risk analysis is appropriate.
Clarifying questions before answering
- What is the event, time origin, and administrative observation cutoff?
- Is censoring plausibly independent of future event time after observed covariates?
- Are there competing events, such as upgrade or death, that prevent cancellation?
- Is the goal descriptive retention, a cohort comparison, or a causal treatment effect?
30-second answer framework
I would store duration and an event flag, keep right-censored users in the risk set until their last observed time, and estimate a Kaplan–Meier survival curve. I would compare curves with a prespecified estimand and confidence intervals, then use a Cox model only after checking proportional-hazards assumptions. If competing events change what “survival” means, I would report a cause-specific or cumulative-incidence analysis instead of silently censoring the competing event.
Step-by-step deep dive
1. Encode the observation
For each subject, record the time from a common origin to either the event or the last known follow-up, plus event = 1 only when the event occurred. A user active at day 30 contributes information through day 30 and is censored there; the record does not claim cancellation after day 30.
2. Build the Kaplan–Meier estimate
At each event time, compute the fraction surviving as one minus events divided by the number at risk immediately before that time. Multiply those conditional fractions to obtain the stepwise survival estimate. Censored observations change later risk-set membership but do not create event steps. NIST describes this product-limit procedure for complete and censored samples.
3. State the censoring assumption
Right-censoring is informative when users who disappear have systematically different future risk. Kaplan–Meier is defensible when censoring is independent of the event time under the analysis assumptions, possibly conditional on measured covariates. Compare censoring rates and reasons by cohort and time; use inverse-probability-of-censoring weights or sensitivity scenarios when the assumption is doubtful.
4. Compare cohorts carefully
Use a prespecified horizon such as survival at 30 or 90 days, restricted mean survival time, or a median only when the curve reaches 0.5. A log-rank test emphasizes a broad difference across curves and may be misleading when hazards cross. Show numbers at risk, confidence bands, and absolute differences rather than reporting only a p-value.
5. Add covariates with Cox regression
The Cox model estimates a hazard ratio under a proportional-hazards assumption. Check time-varying effects and residual diagnostics; a single hazard ratio is not a constant difference in survival probability. If proportional hazards fail, use time interactions, stratification, accelerated-failure-time models, or report horizon-specific effects.
High-quality sample answer
“I would define cancellation, origin, cutoff, and the event flag before modeling. Active users are right-censored at their last observation, so they remain in each risk set until then. I would plot Kaplan–Meier curves with numbers at risk and confidence intervals, report 30- and 90-day survival or restricted mean survival time, and inspect whether censoring differs by cohort. I would use Cox regression only after checking proportional hazards. If upgrade prevents cancellation, I would treat it as a competing event and report cumulative incidence rather than censoring it as if follow-up simply stopped.”
Common mistakes
- Mark every active user as a failure → retention is biased downward → use an event indicator and right-censor at last follow-up.
- Drop censored users → risk sets become selection-biased → keep their observed contribution until censoring.
- Report a median that the curve never reaches → the statistic is undefined → use a fixed-horizon estimate or restricted mean survival time.
- Interpret a Cox hazard ratio as a probability ratio → hazards and survival probabilities differ → translate effects at concrete horizons.
Follow-up questions and responses
What does a censored user contribute?
The user contributes person-time and remains at risk through the censoring time. After that time, the analysis has no observed information about whether the event would have occurred.
When should a competing event not be censored?
If an upgrade permanently prevents cancellation, censoring upgrades can overstate the chance of cancellation. Use cause-specific hazards for etiologic questions and cumulative-incidence functions for the probability of each observed event.
What if hazards cross?
A log-rank test and one proportional-hazards ratio can obscure the pattern. Plot the curves, report restricted mean survival time or horizon-specific differences, and model time-varying effects.