R/ggadjustedcurves.average.R

Defines functions ggadjustedcurves.average

ggadjustedcurves.average <-
function(data, fit, variable) {
  time <- surv <- NULL
  
  lev <- sort(unique(data[,variable]))
  pred <- survexp(as.formula(paste("~", variable)), data = data,
                  ratetable = fit)
  
  curve <- data.frame(time = rep(c(0,pred$time), length(lev)),
                      variable = factor(rep(lev, each=1+length(pred$time))),
                      surv = c(rbind(1, pred$surv)))
  
}
kuppal2/xmsPANDA documentation built on May 15, 2021, 5:48 a.m.