Survival Analysis in Python
Shae Wang
Senior Data Scientist
lifelines)model.baseline_hazard_.plot()
plt.show()

model.baseline_survival_.plot()
plt.show()

| Calculation | Example | |
|---|---|---|
| Coefficient | $x$ | $0.405$ |
| Hazard ratio | $e^x$ | $e^{0.405}=1.5$ |
| Hazards interpretation | $e^x-1$ | $1.5-1 = 0.5$ -> 50% increase in hazards |
| Survival time interpretation | $\frac{1}{e^x}-1$ | $\frac{1}{1.5}-1 = 0.67-1 = -0.23$ -> 23% decrease in survival time |
.plot_partial_effects_on_outcome()
covariates (string or list): name(s) of the covariate(s) in the original dataset that we wish to vary.values (1d or 2d iterable): values we wish the covariate to take on.The model has covariates A, B, C, and we wish to vary
A over 1, 2B over 3, 4model.plot_partial_effects_on_outcome(
covariates=["A","B"],
values=[[1,2],
[3,4]]
)
plt.show()

Wrong...
The model has covariates A, B, C, and we wish to vary
A over 1, 2B over 3, 4model.plot_partial_effects_on_outcome(
covariates=["A","B"],
values=[[1,3],
[1,4],
[2,3],
[2,4]]
)
plt.show()

Correct!
Survival Analysis in Python