Rank-hazard plots visualize the relative importance of covariates in a proportional hazards model. The key idea is to rank the covariate values and plot the relative hazard as a function of ranks scaled to interval [0,1]. The relative hazard is the hazard plotted in respect to the reference hazard, which can be e.g. the hazard related to the median of the covariate. Transformation to scaled ranks allows plotting of covariates measured in different units in the same graph, which helps in the interpretation of the epidemiological relevance of the covariates. Rank-hazard plots show the difference of hazards between the extremes of the covariate values present in the data and can be used as a tool to check if the proportional hazards assumption leads to reasonable estimates for individuals with extreme covariate values. Alternative covariate definitions or different transformations applied to covariates can be also compared using rank-hazard plots.
rankhazardplot receives a
survival) object or a
rms) object as an argument and creates a rank-hazard plot of the covariates.
The reference points for the relative hazards and legend texts can be provided as optional arguments.
Plotting parameters such as, lwd, lty, col and pch are passed to the plotting commands.
Juha Karvanen <firstname.lastname@example.org> , Nanni Koski <email@example.com>
Karvanen J., Harrell F. E., Jr. 2009 Visualizing covariates in proportional hazards model. Statistics in Medicine, 28, 1957–1966.
1 2 3 4 5 6 7 8
library(survival) model <- coxph(Surv(time,status) ~ age + sex + ph.karno, data = cancer, x=TRUE) rankhazardplot(model, data=cancer) library(rms) model2 <- cph(Surv(time,status) ~ age + sex + ph.karno, data = cancer, x=TRUE) dd <- datadist(cancer) options(datadist="dd") rankhazardplot(model2, data=cancer)
Y-axis range: 0.608 1.49 Relative hazards for each covarite: Min. 1st Qu. Median 3rd Qu. Max. age 0.743 0.917 1 1.08 1.27 sex 0.608 0.608 1 1.00 1.00 ph.karno 0.766 0.875 1 1.07 1.49 Loading required package: Hmisc Loading required package: lattice Loading required package: Formula Loading required package: ggplot2 Attaching package: 'Hmisc' The following objects are masked from 'package:base': format.pval, units Loading required package: SparseM Attaching package: 'SparseM' The following object is masked from 'package:base': backsolve Y-axis range: 0.608 1.49 Relative hazards for each covarite: Min. 1st Qu. Median 3rd Qu. Max. age 0.743 0.917 1 1.08 1.27 sex 0.608 0.608 1 1.00 1.00 ph.karno 0.766 0.875 1 1.07 1.49
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.