Analyse de survie en Python
Shae Wang
Senior Data Scientist
$$\Large{S(t) = Pr(T>t)}$$
$$\Large{S(t) = Pr(T>t)}$$

$$\Large{S(t) = Pr(T>t)}$$

$$\Large{S(t) = Pr(T>t)}$$






Le paquet lifelines est une bibliothèque complète pour l'analyse de survie.
import lifelines
import matplotlib.pyplot as plt
.fit(durations, event_observed)
.plot_survival_function()
Nom du DataFrame : mortgage_df
| id | duration | paid_off |
|---|---|---|
| 1 | 25 | 0 |
| 2 | 17 | 1 |
| 3 | 5 | 0 |
| ... | ... | ... |
| 100 | 30 | 1 |
id : identifiant d'un prêt hypothécaireduration : nombre d'années où l'hypothèque n'est pas rembourséepaid_off : 1 si l'hypothèque est entièrement remboursée, 0 sinonimport lifelines
from matplotlib import pyplot as plt
kmf = lifelines.KaplanMeierFitter()
kmf.fit(duration=mortgage_df["duration"],
event_observed=mortgage_df["paid_off"])
kmf.plot_survival_function()
plt.show()

Analyse de survie en Python