cfc.survreg.survprob: Survival probability function for 'survreg' models

Description Usage Arguments Value Author(s) See Also Examples

View source: R/cfc_survreg.R

Description

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.

Usage

1

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).

Value

Vector of survival probabilities at time(s) t.

Author(s)

Mansour T.A. Sharabiani, Alireza S. Mahani

See Also

cfc.survreg

Examples

 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
30
31
32
33
34
35
36
37
38
## 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)

Example output

Package: CFC, Version: 1.1.0
Cause-specific Framework for Competing-risk survival analysis
School of Public Heath, Imperial College London &
Scientific Computing Group, Sentrana Inc.

 randomForestSRC 2.5.0 
 
 Type rfsrc.news() to see new features, changes, and bug fixes. 
 

There were 50 or more warnings (use warnings() to see the first 50)

CFC documentation built on June 21, 2017, 5:03 p.m.