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

Custom Cox PH model

You have isolated three factors that are statistically significant at the 0.05 level in the previous exercise: fin, age, and prio.

  • fin: if the convict received financial assistance, hazards decrease by 31%;
  • age: for each age older than average, hazards decrease by 5%;
  • prio: for each prior arrest more than average, hazards increase by 9%.

Let's build a custom Cox PH model using these covariates.

The CoxPHFitter class has been imported for you, and the pandas and numpy libraries are imported as pd and np, respectively. Use the console to explore the DataFrame prison and its column names as needed.

Bu egzersiz

Survival Analysis in Python

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

Egzersiz talimatları

  • Instantiate a CoxPHFitter class called custom_cph.
  • Fit custom_cph with a custom regression model fin + age + prio using the formula parameter.
  • Get the model summary of cph and print it.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Instantiate CoxPHFitter class
custom_cph = ____

# Fit custom model
____

# Print model summary
print(____)
Kodu Düzenle ve Çalıştır