[R] basehaz error?

From: Powers, Daniel A <dpowers_at_austin.utexas.edu>
Date: Mon, 24 Nov 2008 10:35:32 -0600


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)) }


R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 24 Nov 2008 - 16:38:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 24 Nov 2008 - 17:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive