coxphSmoothed hazard estimates for coxph
coxphHaz(object, newdata, n.grid = 300, kernel = "epanechnikov", from,
to, ...)
# S3 method for coxphHaz
print(x, digits=NULL, ...)
# S3 method for coxphHaz
plot(x, xlab="Time", ylab="Hazard", type="l", ...)
# S3 method for coxphHazList
plot(x, xlab="Time", ylab="Hazard", type="l",
col=1:length(x), lty=1, legend.args=list(), ...)
# S3 method for coxphHazList
lines(x, ...)
# S3 method for coxphHaz
as.data.frame(x, row.names=NULL, optional=FALSE, level=0.95, ...)
# S3 method for coxphHazList
as.data.frame(x, row.names=NULL, optional=FALSE, ...)The coxphHaz function returns either a class of type
c("coxphHaz","density") when newdata has one row or, for multiple rows in
newdata, a class of type "coxphHazList", which is a list of
type c("coxphHaz","density").
coxph object
data-frame with covariates for prediction
the number of grid values for which the hazard is calculated
the kernel used for smoothing
argument for density. Defaults to the minimum time.
argument for density. Defaults to the maximum time.
object
argument passed to print.density
graphics argument
graphics argument
graphics argument
graphics argument
graphics argument
level for confidence intervals (default=0.95)
NULL or a character vector giving the row names for the
data frame. Missing values are not allowed.
logical. If TRUE, setting row names and converting column
names (to syntactic names: see make.names) is optional.
Note that all of R's base package as.data.frame() methods
use optional only for column names treatment, basically
with the meaning of data.frame(*, check.names = !optional).
See also the make.names argument of the matrix method.
a list of options that are passed to the legend call. Defaults are
list(x="topright",legend=strata(attr(x,"newdata")),col=col,lty=lty).
other arguments. For coxphHaz, these arguments are passed to
density. For the plot and lines methods, these are
passed to the relevant plot, matplot and matlines functions.
Smooth hazard estimates from a Cox model using kernel smoothing of the Nelson-Aalen estimator.
fit <- coxph(Surv(surv_mm/12,status=="Dead: cancer")~agegrp, data=colon)
newdata <- data.frame(agegrp=levels(colon$agegrp))
haz <- suppressWarnings(coxphHaz(fit,newdata))
plot(haz, xlab="Time since diagnosis (years)")
Run the code above in your browser using DataLab