R/kapmeier.R

"kapmeier" <-
function (time, status) 
{
    stime <- sort(time)
    status <- status[order(time)]
    nj <- length(time):1
    nj <- nj[!duplicated(stime)]
    dj <- tapply(status, stime, sum)
    tj <- unique(stime)
    sj <- (nj - dj)/nj
    cumsj <- cumprod(sj)
    cumrj <- 1 - cumsj
    results <- cbind(time = tj, n.risk = nj, n.events = dj, condsurv = sj, 
        survival = cumsj, risk = cumrj)
    dimnames(results)[1] <- list(NULL)
    results[dj != 0, ]
}

Try the epitools package in your browser

Any scripts or data that you put into this service are public.

epitools documentation built on March 26, 2020, 9:14 p.m.