Exercise

Model prison data with Cox PH

The DataFrame prison contains information from 432 convicts who were released and followed up for one year after release. You have modeled their time-to-arrest and studied what factors increase or decrease their risk of re-arrest using the Weibull AFT model.

CoxPHFitter class of lifelines implements a Cox Proportional Hazards model for survival regression that models the baseline hazard function and hazard ratios that define hazard proportions. Let's try using CoxPHFitter to explore the factors!

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
  • Import the CoxPHFitter class from lifelines.
  • Create an instance of CoxPHFitter called cph.