Statistical Models Interactive
Survival Analysis
Model time-to-event data. How long until a customer churns? When will an injured player return? Handle censored observations properly.
๐ Key Concepts
Survival Function S(t)
P(T > t)
Probability of surviving past time t
Hazard Function h(t)
P(event at t | survived to t)
Instantaneous risk of event
Censoring
Event hasn't happened yetโbut we know they survived at least this long
Parameters
0.01 0.15
0.3 1
0 50
๐ Results
Hazard Ratio 0.60
40% lower risk
12-mo Survival (Control) 54%
12-mo Survival (Treatment) 69%
Median (Control) 14 mo
Median (Treatment) 23 mo
Kaplan-Meier Survival Curves
Control group (no intervention)
Treatment group (with intervention)
Cox Proportional Hazards
The Model
h(t|X) = hโ(t) ร exp(ฮฒX)
Hazard depends on baseline and covariates
Interpretation
HR = exp(ฮฒ)
- โข HR < 1: Treatment reduces risk
- โข HR = 1: No effect
- โข HR > 1: Treatment increases risk
๐ฐ Betting Applications
Churn
Time until customer stops betting
Metric: Retention rate
First Deposit
Time from signup to first bet
Metric: Conversion time
VIP Upgrade
Time until tier promotion
Metric: Upgrade rate
Injury Recovery
Time until player returns
Metric: Games missed
R Code Equivalent
# Survival analysis
library(survival)
library(survminer)
# Create survival object
surv_obj <- Surv(time = df$time, event = df$churned)
# Kaplan-Meier curves
km_fit <- survfit(surv_obj ~ treatment, data = df)
ggsurvplot(km_fit, data = df,
pval = TRUE,
risk.table = TRUE)
# Cox proportional hazards model
cox_model <- coxph(surv_obj ~ treatment + age + deposit_amount, data = df)
summary(cox_model)
# Hazard ratios
exp(coef(cox_model))
# Check proportional hazards assumption
cox.zph(cox_model)โ Key Takeaways
- โข Survival analysis models time-to-event
- โข Handles censoring (incomplete observation)
- โข Kaplan-Meier for curves, Cox for covariates
- โข Hazard Ratio = relative risk
- โข Use for churn, conversion, injury recovery
- โข Check proportional hazards assumption