rankhazardplot {rankhazard} | R Documentation |
rankhazardplot
creates a rank-hazard plot of the covariates of a proportional hazards model.
rankhazardplot(...) rankhazardplot.coxph(coxphobj,refvalues=NULL,x=NULL,legendtext=NULL,axistext=NULL,plottype="hazard",...) rankhazardplot.cph(cphobj,refvalues=NULL,x=NULL,legendtext=NULL,axistext=NULL,plottype="hazard",...) rankhazardplot.default(x,coefs=NULL,xp=NULL,refvalues=NULL,legendtext=NULL,axistext=NULL,plottype="hazard",col=NULL,pch=NULL,lwd=1,...)
coxphobj |
An object of class 'coxph' (survival). |
cphobj |
An object of class 'cph' (Design). |
refvalues |
A vector of reference values given in the same order as the covariates in the model. If NULL , the medians of each covariate are used. |
x |
A matrix or data frame of the covariate data. Needed if the coxphobj$x or cphobj$x does not exist. |
legendtext |
A vector of covariate names for the legend box. If NULL , the column names are from x , coxphobj$x or cphobj$x . |
axistext |
A vector of covariate names and units for the x-axis. If NULL , the column names are from x , coxphobj$x or cphobj$x . |
plottype |
Scaling for the y-axis. Either "hazard" for the relative hazard with log-scale or "loghazard" for the logarithm of the relative hazard with linear scale. |
coefs |
A vector of regression coefficients for the covariates. If NULL , xp is required. |
xp |
Predictions ("terms") for the covariates. If NULL , coefs is required and xp is calculated a product of coefs and x . |
col |
See documentation for par . |
pch |
See documentation for points . |
lwd |
See documentation for par . |
... |
Other arguments to passed to the plotting commands. |
The function receives a coxph (package survival) object or a cph (package Design) object as an argument and creates a rank-hazard plot of the covariates. The reference values 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
J. Karvanen, F. E. Harrell Jr., Visualizing covariates in proportional hazards model. Statistics in Medicine, 28:1957–1966, 2009.
coxph
and cph
library(survival) model <- coxph(Surv(time,status) ~ age + sex + ph.karno, data=cancer, x=TRUE) rankhazardplot(model)