MulaiMulai sekarang secara gratis

Comparing patient soreness treatments

There is an experiment for a new soreness treatment, and you want to compare patients that received the new treatment versus the old one. You will fit a Kaplan-Meier estimator to each set of patient data and visualize their survival curves side-by-side.

The DataFrame is called recur and contains columns

  • age: the age of the patient;
  • treat: the treatment that the patient received (0 if new, 1 if old);
  • duration: the duration post treatment in hours;
  • censor: whether the event is censored;

The pandas package is loaded as pd, the KaplanMeierFitter class is imported from lifelines, and the pyplot module has been import from matplotlib as plt.

Additionally, a KaplanMeierFitter instance called kmf and a subplot figure called ax have been created for you.

Latihan ini adalah bagian dari kursus

Survival Analysis in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Mask for new treatment
new = (____)
Edit dan Jalankan Kode