Get startedGet started for free

Cox PH model survival time

You used both the Weibull AFT model and the Cox PH model to model time-to-arrest for convicts. Using the Weibull AFT model, you estimated the impact on survival time from changes in the covariates.

Could you do the same with the Cox PH model? Fit the Cox PH model to the prison data and calculate the impact on survival time from a one unit increase in prio (number of prior arrests).

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 and its column names as needed.

This exercise is part of the course

Survival Analysis in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Instantiate CoxPHFitter class
cph = ____

# Fit cph to data using all columns
____
Edit and Run Code