Classical ML

Survival Analysis

Modeling time-to-event outcomes while handling censored observations in medical and customer churn analysis.

🔴 advanced5 min readstatistics
Survival Analysis models time to event data (such as customer churn, hardware failure, or patient relapse). Standard regression algorithms fail on survival data due to Right Censoring, where study periods end before an event occurs for some subjects. Kaplan Meier Estimator provides non parametric survival probability curves S(t), while Cox Proportional Hazards Model evaluates how covariate features scale hazard rates h(t) linearly.

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)$$

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)$$

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

  1. 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).
  2. 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

Question 1 of 3

What is Right Censoring in Survival Analysis datasets?

More in Classical ML

See all →
Bias–Variance Tradeoff4 minOverfitting vs Underfitting3 minLinear Regression4 min