1. Learn
  2. /
  3. Courses
  4. /
  5. Survival Analysis in Python

Exercise

Log-rank test

After comparing the median survival times of patients with and without pericardial effusion, you also inspected their survival curves visually. To your surprise, the curves actually seem quite similar to each other. Before you finalize your conclusion, it's important to scientifically test this hypothesis. You will use the log-rank test and inspect the p-value to make a decision.

The pandas package is loaded as pd. DataFrames for patients with and without pericardial effusion are loaded and stored as has_pericardial_effusion and none_pericardial_effusion, respectively.

Instructions 1/3

undefined XP
    1
    2
    3
  • Import the logrank_test function from lifelines.statistics.
  • Run the log-rank test with the appropriate columns from your data to compare patients with and without pericardial effusion.