coxphHaz {biostat3} | R Documentation |
Smoothed hazard estimates for coxph
Description
Smoothed hazard estimates for coxph
Usage
coxphHaz(object, newdata, n.grid = 300, kernel = "epanechnikov", from,
to, ...)
## S3 method for class 'coxphHaz'
print(x, digits=NULL, ...)
## S3 method for class 'coxphHaz'
plot(x, xlab="Time", ylab="Hazard", type="l", ...)
## S3 method for class 'coxphHazList'
plot(x, xlab="Time", ylab="Hazard", type="l",
col=1:length(x), lty=1, legend.args=list(), ...)
## S3 method for class 'coxphHazList'
lines(x, ...)
## S3 method for class 'coxphHaz'
as.data.frame(x, row.names=NULL, optional=FALSE, level=0.95, ...)
## S3 method for class 'coxphHazList'
as.data.frame(x, row.names=NULL, optional=FALSE, ...)
Arguments
object |
|
newdata |
data-frame with covariates for prediction |
n.grid |
the number of grid values for which the hazard is calculated |
kernel |
the kernel used for smoothing |
from |
argument for |
to |
argument for |
x |
object |
digits |
argument passed to |
col |
graphics argument |
lty |
graphics argument |
xlab |
graphics argument |
ylab |
graphics argument |
type |
graphics argument |
level |
level for confidence intervals (default=0.95) |
row.names |
|
optional |
logical. If |
legend.args |
a list of options that are passed to the legend call. Defaults are
|
... |
other arguments. For |
Details
Smooth hazard estimates from a Cox model using kernel smoothing of the Nelson-Aalen estimator.
Value
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")
.
See Also
Examples
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)")