Cox Regression

Cox Regression is suitable for time-to-event data. See the examples below –

1. Time from customer opened the account until attrition.
2. Time after cancer treatment until death.
3. Time from first heart attack to the second.

Logistic regression uses a binary dependent variable but ignores the timing of events.

As well as estimating the time it takes to reach a certain event, survival analysis can also be used to compare time-to-event for multiple groups.

Dual targets are set for the survival model
1. A continuous variable representing the time to event.
2. A binary variable representing the status whether event occurred or not.

# Lung Cancer Data
# status: 2=death
lung$SurvObj <- with(lung, Surv(time, status == 2)) cox.reg <- coxph(SurvObj ~ age + sex + ph.karno + wt.loss, data = lung) cox.reg