[R] basehaz error?
Powers, Daniel A
dpowers at austin.utexas.edu
Mon Nov 24 17:35:32 CET 2008
R-users--
I am wondering if the cumulative hazard is being correctly computed when evaluated using centered=FALSE. In the bazehaz code (from the survival package) (below), I think
H <- H * exp(-bz0) should be
H <- H * exp(bz0)
function (fit, centered = TRUE)
{
if (!inherits(fit, "coxph"))
stop("must be a coxph object")
sfit <- survfit(fit)
H <- -log(sfit$surv)
strata <- sfit$strata
if (!is.null(strata))
strata <- rep(names(strata), strata)
if (!centered) {
z0 <- fit$means
bz0 <- sum(z0 * coef(fit))
H <- H * exp(-bz0)
}
if (is.null(strata))
return(data.frame(hazard = H, time = sfit$time))
else return(data.frame(hazard = H, time = sfit$time, strata = strata))
}
Thanks,
Dan
More information about the R-help
mailing list