View source: R/hazard.ratio.plot.s
hazard.ratio.plot | R Documentation |
The hazard.ratio.plot
function repeatedly estimates Cox
regression coefficients and confidence limits within time intervals.
The log hazard ratios are plotted against the mean failure/censoring
time within the interval. Unless times
is specified, the number of
time intervals will be \max(round(d/e),2)
, where d
is the
total number
of events in the sample. Efron's likelihood is used for estimating
Cox regression coefficients (using coxph.fit
). In the case of
tied failure times, some intervals may have a point in common.
hazard.ratio.plot(x, Srv, which, times=, e=30, subset,
conf.int=.95, legendloc=NULL, smooth=TRUE, pr=FALSE, pl=TRUE,
add=FALSE, ylim, cex=.5, xlab="t", ylab, antilog=FALSE, ...)
x |
a vector or matrix of predictors |
Srv |
a |
which |
a vector of column numbers of |
times |
optional vector of time interval endpoints.
Example: |
e |
number of events per time interval if times not given |
subset |
vector used for subsetting the entire analysis,
e.g. |
conf.int |
confidence interval coverage |
legendloc |
location for legend. Omit to use mouse, |
smooth |
also plot the super–smoothed version of the log hazard ratios |
pr |
defaults to |
pl |
defaults to |
add |
add this plot to an already existing plot |
ylim |
vector of |
cex |
character size for legend information, default is 0.5 |
xlab |
label for |
ylab |
label for |
antilog |
default is |
... |
optional graphical parameters |
Frank Harrell
Department of Biostatistics, Vanderbilt University
fh@fharrell.com
cox.zph
, residuals.cph
,
survival-internal
, cph
,
coxph
, Surv
require(survival)
n <- 500
set.seed(1)
age <- 50 + 12*rnorm(n)
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50))
d.time <- -log(runif(n))/h
label(d.time) <- 'Follow-up Time'
e <- ifelse(d.time <= cens,1,0)
d.time <- pmin(d.time, cens)
units(d.time) <- "Year"
hazard.ratio.plot(age, Surv(d.time,e), e=20, legendloc='ll')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.