Exercise

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.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Instantiate a CoxPHFitter class and call it cph.
  • Fit cph to the DataFrame prison with all columns as covariates, except columns week and arrest.