Survival Analysis
Modeling time-to-event outcomes while handling censored observations in medical and customer churn analysis.
What is Survival Analysis?
Traditional classification predicts IF an event happens ($1$ or $0$).
Traditional regression predicts WHEN a continuous outcome happens.
Neither works when modeling Time-to-Event data (customer churn, medical patient survival, machine equipment failure):
Why? Because of Right Censoring.
Patient A: Entered study ──► Experienced Relapse at Month 6 (Event Observed: t = 6, Event = 1)
Patient B: Entered study ──► Study Ended at Month 12 (No Relapse Yet! Censored: t = 12, Event = 0)
For Patient B, we know they survived at least 12 months, but we do not know their true event time.
Dropping censored subjects causes severe selection bias. Treating 12 months as their true event time is false.
Survival Analysis incorporates both event times and censored observations cleanly.
┌──────────────────────────┬──────────────────────────┬──────────────────────────┐
│ 1. SURVIVAL FUNCTION S(t)│ 2. HAZARD RATE h(t) │ 3. COX MODEL │
├──────────────────────────┼──────────────────────────┼──────────────────────────┤
│ Probability of surviving │ Instantaneous event rate │ Semi-parametric model │
│ past time t: P(T > t). │ at time t given survival │ evaluating how features │
│ Decreases over time. │ up to time t. │ scale hazard rates. │
└──────────────────────────┴──────────────────────────┴──────────────────────────┘
Key Mathematical Functions
1. Survival Function $S(t)$
Probability that an individual survives longer than time $t$:
$$S(t) = P(T > t)$$
$S(0) = 1.0$, and $S(t)$ decreases monotonically toward $0.0$ over time.
2. Hazard Function $h(t)$
Instantaneous rate at which events occur at time $t$, given survival up to time $t$:
$$h(t) = \lim_{\Delta t \to 0} \frac{P(t \le T < t + \Delta t \mid T \ge t)}{\Delta t}$$
1. Kaplan-Meier Estimator (Non-Parametric)
The Kaplan-Meier Estimator estimates the survival curve $S(t)$ from raw data containing censored records:
$$\hat{S}(t) = \prod_{t_i \le t} \left( 1 - \frac{d_i}{n_i} \right)$$
- $d_i$: Number of events (deaths/churns) at time $t_i$.
- $n_i$: Number of subjects at risk just before time $t_i$.
Generates step-function survival curves comparing groups (e.g. Treatment A vs Treatment B).
2. Cox Proportional Hazards Model (Semi-Parametric)
Evaluates how feature covariates $x$ (age, contract type, dosage) scale risk:
$$h(t \mid x) = h_0(t) \cdot \exp\left( \beta_1 x_1 + \beta_2 x_2 + \dots + \beta_p x_p \right)$$
- $h_0(t)$: Unspecified baseline hazard function over time.
- $\exp(\beta^T x)$: Hazard ratio scaling factor.
If $\beta_1 = 0.5 \implies \exp(0.5) \approx 1.65$ (Feature $x_1$ increases event hazard rate by 65 percent!).
Say this out loud
Survival Analysis models time to event outcomes while handling right censored observations. The Survival Function S(t) represents the probability of surviving past time t. Kaplan Meier provides non parametric survival curves. The Cox Proportional Hazards Model evaluates how covariate features scale baseline hazard rates exponentially, assuming hazard ratios between individuals stay constant over time.
Followups to expect
- What metric evaluates Survival Models? Concordance Index (C-Index), measuring the proportion of sample pairs where predicted risk orders match true event time orders (0.5 = random guessing, 1.0 = perfect prediction).
- What is DeepSurv? A deep neural network extension of the Cox model that replaces linear term $\beta^T x$ with non linear deep layers $g_\theta(x)$ to capture non linear feature interactions.
Check yourself
What is Right Censoring in Survival Analysis datasets?