BaşlayınÜcretsiz Başlayın

Test the PH assumption with KM curves

After learning about the proportional hazards assumption, you realize that the Cox PH model you built using prison DataFrame has not been tested. You will test the proportional hazards assumption for the categorical variable fin using Kaplan-Meier curves.

cph is the fitted Cox PH model using all columns, and it has been loaded. A KaplanMeierFitter class kmf has also been instantiated.

The CoxPHFitter class, the KaplanMeierFitter class, and the matplotlib.pyplot module have been imported. The pandas and numpy libraries are imported as pd and np, respectively.

Bu egzersiz

Survival Analysis in Python

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Fit to fin == 0
____

# Plot survival curve for fin == 0
ax = ____
Kodu Düzenle ve Çalıştır