Skip to Content
Practical Predictive Analytics
book

Practical Predictive Analytics

by Ralph Winters
June 2017
Beginner to intermediate
576 pages
15h 22m
English
Packt Publishing
Content preview from Practical Predictive Analytics

Proportional hazards test

Some follow up tests are needed after a cox regression is run. One assumption of cox regression that needs to be tested is that the hazard for an event is purely dependent upon the variables, and not dependent upon time. If it was, time could not be treated as an independent variable. So, we need to test for what is known as proportional hazards. This can be done using the cox.zph function.

Run the following portion of the code, which is listed under the label #coxproptext====

It will do the following:

  • Assign the output of the proportional hazard test to the temp object
  • Print the results of the test to the console
  • Loop through all of the model variables contained in the temp object and plot the proportional hazards: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Superstream: Analytics Engineering

Data Superstream: Analytics Engineering

Alistair Croll, Anna Filippova, Emilie Schario, Lewis Davies, Jacob Frackson, Benn Stancil, Nick Acosta, Elizabeth Caley
R: Predictive Analysis

R: Predictive Analysis

Tony Fischetti, Eric Mayor, Rui Miguel Forte
Python: Advanced Predictive Analytics

Python: Advanced Predictive Analytics

Ashish Kumar, Joseph Babcock

Publisher Resources

ISBN: 9781785886188Supplemental Content