Function for predicting survival probability as a function of time for survreg regression objects in survival package. It can be used to mix survreg models with other survival models in competing-risk analysis, using CFC package. This function is used inside cfc.survreg.
cfc.survreg.survprob(t, args, n)
Arguments
t: Time from index. Must be non-negative, but can be a vector.
args: Regression object that is returned by survreg. If using newdata for prediction, the x field of this object must be updated accordingly.
n: Observation index, must be between 1 and nrow(args$x).
Returns
Vector of survival probabilities at time(s) t.
References
Mahani A.S. and Sharabiani M.T.A. (2019). Bayesian, and Non-Bayesian, Cause-Specific Competing-Risk Analysis for Parametric and Nonparametric Survival Functions: The R Package CFC. Journal of Statistical Software, 89(9), 1-29. doi:10.18637/jss.v089.i09
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
See Also
cfc.survreg
Examples
## Not run:library("CFC")# for cfcdata(bmt)library("randomForestSRC")# for rfsrclibrary("survival")# for survregprep <- cfc.prepdata(Surv(time, cause)~ platelet + age + tcell, bmt)f1 <- prep$formula.list[[1]]f2 <- prep$formula.list[[2]]dat <- prep$dat
tmax <- prep$tmax
# building a parametric Weibull regression model# for cause 1reg1 <- survreg(f1, dat, x =TRUE)# must keep x for prediction# building a random forest survival model for cause 2reg2 <- rfsrc(f2, dat)# implementing a continuous interface for the random forest# survival functionrfsrc.survfunc <-function(t, args, n){ which.zero <- which(t < .Machine$double.eps) ret <- approx(args$time.interest, args$survival[n,], t, rule =2)$y
ret[which.zero]<-1.0 return (ret)}# constructing function and argument listf.list <- list(cfc.survreg.survprob, rfsrc.survfunc)arg.list <- list(reg1, reg2)# competing-risk analysistout <- seq(0.0, tmax, length.out =10)# increase rel.tol for higher accuracycfc.out <- cfc(f.list, arg.list, nrow(bmt), tout, rel.tol =1e-3)## End(Not run)