cfc.survreg.survprob | R Documentation |
survreg
models
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)
t |
Time from index. Must be non-negative, but can be a vector. |
args |
Regression object that is returned by |
n |
Observation index, must be between |
Vector of survival probabilities at time(s) t
.
Mansour T.A. Sharabiani, Alireza S. Mahani
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
cfc.survreg
## Not run: library("CFC") # for cfc data(bmt) library("randomForestSRC") # for rfsrc library("survival") # for survreg prep <- 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 1 reg1 <- survreg(f1, dat, x = TRUE) # must keep x for prediction # building a random forest survival model for cause 2 reg2 <- rfsrc(f2, dat) # implementing a continuous interface for the random forest # survival function rfsrc.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 list f.list <- list(cfc.survreg.survprob, rfsrc.survfunc) arg.list <- list(reg1, reg2) # competing-risk analysis tout <- seq(0.0, tmax, length.out = 10) # increase rel.tol for higher accuracy cfc.out <- cfc(f.list, arg.list, nrow(bmt), tout, rel.tol = 1e-3) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.