Exercise

Draw a survival curve

You are a sociologist studying how convicts behave after their release. The DataFrame prison contains the information from 432 convicts who were released from Maryland state prisons in the 1970s and who were followed up with one year after release. There are two main columns of interest:

  • week: the number of weeks elapsed since release
  • arrest: whether the convict has been re-arrested within one year after release

A Kaplan Meier survival function has been fitted for you and the model object is called prison_kmf. Can you visualize the survival curve of prison_kmf?

The matplotlib.pyplot library is imported as plt and the lifelines module has also been imported for you.

Instructions 1/2

undefined XP
    1
    2
  • Plot the survival curve of prison_kmf.
  • Display the survival curve plot.