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.
This exercise is part of the course
Survival Analysis in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import logrank_test
from ____ import ____
# Run log-rank test to compare patients with and without pericardial effusion
patient_results = logrank_test(____)