cfc.survreg.survprob {CFC}R Documentation

Survival probability function for 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)



Time from index. Must be non-negative, but can be a vector.


Regression object that is returned by survreg. If using newdata for prediction, the x field of this object must be updated accordingly.


Observation index, must be between 1 and nrow(args$x).


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

See Also



## Not run: 
library("CFC") # for cfc
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(t < .Machine$double.eps)
  ret <- approx(args$time.interest, args$survival[n, ], t, rule = 2)$y
  ret[] <- 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)

[Package CFC version 1.2.0 Index]