The proportional hazards assumption

Survival Analysis in Python

Shae Wang

Senior Data Scientist

Use the Kaplan-Meier curves

If the covariate only has a few values, inspect each group's Kaplan-Meier curve.

  • Curves intersect: fails the proportional hazards assumption.

failed ph assumption due to intersecting curves

Survival Analysis in Python

Use the Kaplan-Meier curves

If the covariate only has a few values, inspect each group's Kaplan-Meier curve.

  • Curves have different shapes: fails the proportional hazards assumption.

failed ph assumption due to intersecting curves

Survival Analysis in Python

Use the Kaplan-Meier curves

If the covariate only has a few values, inspect each group's Kaplan-Meier curve.

  • Curves have similar shapes and are parallel: satisfies the proportional hazards assumption.

successful proportional hazard assumption km curve

Survival Analysis in Python

.check_assumptions()

If the covariates are continuous, use the .check_assumptions() method.

  • Parameters
    • training_df: the original DataFrame used in the call to fit the model.
    • p_value_threshold: the threshold to use to alert the user of violations (default: 0.01, recommended: 0.05).
Survival Analysis in Python

.check_assumptions()

model.check_assumptions(training_df, p_value_threshold=0.05)
1. Variable 'A' failed the non-proportional test: p-value is 0.0007.
Advice 1: ...
Advice 2: ...
2. Variable 'B' failed the non-proportional test: p-value is 0.0063.
Advice 1: ...
Advice 2: ...
Survival Analysis in Python

When the proportional hazards assumption fails

  • Usually, it's a reasonable assumption and violations do not impact model performance significantly.
  • If it fails, try other modeling frameworks, such as the Weibull AFT model, and compare their AIC scores.
Survival Analysis in Python

Let's practice!

Survival Analysis in Python

Preparing Video For Download...