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
for which to estimate hazard
ratios across time and make plots.
The default is to do so for all predictors. Whenever
one predictor is displayed, all other predictors in the
x
matrix
are adjusted for (with a separate adjustment form for each time interval).
times=c(1,2,3)
uses intervals
[0,1), [1,2), [2,3), [3+)
.
If times is omitted, uses intervals containing
e
events
subset=sex=="female"
"none"
for none,
"ll"
for lower left of graph, or actual x and y coordinates (e.g.
c(2,3)
)
FALSE
to suppress printing of individual Cox fits
TRUE
to plot results
y
-axis limits. Default is computed to include confidence bands.
x
-axis, default is
"t"
y
-axis, default is
"Log Hazard Ratio"
or
"Hazard Ratio"
,
depending on
antilog
.
FALSE
. Set to
TRUE
to plot anti-log, i.e., hazard ratio.
Frank Harrell
Department of Biostatistics, Vanderbilt University
f.harrell@vanderbilt.edu
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')