Get startedGet started for free

The proportional hazards assumption

1. The proportional hazards assumption

Violating model assumptions when fitting models often results in suboptimal analyses. How do we check the proportional hazards assumption? And how important is it?

2. Use the Kaplan-Meier curves

The proportional hazards assumption means that hazard ratios are time-invariant. When the covariates in question only have a few values, the simplest way to check the assumption is by plotting each group's Kaplan-Meier survival function. If they intersect, it means the covariate value has different effects on survival depending on time. The assumption is violated.

3. Use the Kaplan-Meier curves

If the curves have different shapes, for example, one tail of the curve flattens out and the other one drops to 0, it also means the covariate value has different effects on survival depending on time. The assumption is violated.

4. Use the Kaplan-Meier curves

What we look for are curves that have similar shapes and seem parallel to each other. In this case, the assumption is satisfied.

5. .check_assumptions()

Lifelines conveniently provides a check_assumptions method to check whether the proportional hazards assumption holds by covariate pairs. When Kaplan-Meier curves cannot be used, this is a comprehensive method. check_assumptions needs only one parameter, which is training_df, the original DataFrame used in the dot-fit call to fit the model. To specify the significance threshold to use for alerting violations, use the p_value_threshold parameter. Lifelines sets it to 0-point-01 by default, making the test quite stringent. 0-point-05 is a more commonly used threshold.

6. .check_assumptions()

To run the assumption check, we call the check_assumptions function on the fitted CoxPHFitter class. The parameter training_df specifies the DataFrame to test, and the p_value_threshold specifies the significance level to compare against. check_assumptions is a unique function as it returns verbal alerts and advice on how to handle violations. Interpreting the test output is quite intuitive.

7. When the proportional hazards assumption fails

The proportional hazards assumption is usually a reasonable one. But when it fails, it's best practice to try other modeling frameworks without such model assumptions such as the Accelerated Failure time model. We learned that the AIC score could help us compare the models' fit.

8. Let's practice!

Now, let's practice testing the assumption!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.