ComeçarComece de graça

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.

Este exercício faz parte do curso

Survival Analysis in Python

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Plot the survival function
____

# Show the plot
____
Editar e executar o código