Description Usage Arguments Details Author(s) References Examples
Get survprob from pec packages
1  | getsurvprob(obj, times)
 | 
obj | 
 survfit object  | 
times | 
Get survprob from pec packages
pec
from pec packages
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  | ##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
## The function is currently defined as
function (obj, times) 
{
    if (!inherits(obj, "survfit")) 
        stop("obj is not of class survfit")
    class(obj) <- NULL
    lt <- length(times)
    nsurv <- times
    if (length(times) == length(obj$time)) {
        if (all(times == obj$time)) 
            return(obj$surv)
    }
    inside <- times %in% obj$time
    for (i in (1:lt)) {
        if (inside[i]) 
            nsurv[i] <- obj$surv[obj$time == times[i]]
        else {
            less <- obj$time[obj$time < times[i]]
            if (length(less) == 0) 
                nsurv[i] <- 1
            else nsurv[i] <- obj$surv[obj$time == max(less)]
        }
    }
    nsurv
  }
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.