Description Usage Arguments Value Author(s) References See Also Examples

Using adaptive generalized Newton-Cotes for calculating cumulative incidence functions.

1 | ```
cfc(f.list, args.list, n, tout, Nmax = 100L, rel.tol = 1e-05, ncores = 1)
``` |

`f.list` |
In |

`args.list` |
List of arguments (each one a list), one per cause, to be supplied to the survival functions in |

`n` |
Range of iterator (starting at |

`tout` |
Vector of time points for which cumulative incidence functions are requested. |

`Nmax` |
Maximum number of subdivisions in the interval [ |

`rel.tol` |
Threshold for relative integration error, used as stoppage criterion. It is calculated as the maximum relative error at time point |

`ncores` |
Number of parallel threads to use. This is currrently only implemented in |

An object of class `cfc`

, which is a list with the following elements:

`ci` |
Array of dimensions |

`s` |
Array of same dimensions as |

`is.maxiter` |
Binary Array of length |

`n.maxiter` |
Number of iterations that did not converge, i.e., |

Mansour T.A. Sharabiani, Alireza S. Mahani

Haller, B., Schmidt, G., & Ulm, K. (2013). Applying competing risks regression models: an overview. Lifetime data analysis, 1-26.

Prentice et al (1978). The analysis of failure times in the presence of competing risks. Biometrics, 541-554.

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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | ```
## Not run:
library("survival") # used for constructing survival formulas
library("BSGW") # used for Bayesian survival regression
data("bmt")
# splitting data into training and prediction sets
idx.train <- sample(1:nrow(bmt), size = 0.7 * nrow(bmt))
idx.pred <- setdiff(1:nrow(bmt), idx.train)
nobs.train <- length(idx.train)
nobs.pred <- length(idx.pred)
# prepare data and formula for Bayesian cause-specific survival regression
# using R package BSGW
out.prep <- cfc.prepdata(Surv(time, cause) ~ platelet + age + tcell, bmt)
f1 <- out.prep$formula.list[[1]]
f2 <- out.prep$formula.list[[2]]
dat <- out.prep$dat
tmax <- out.prep$tmax
# estimating cause-specific models
# set nsmp to larger number in real-world applications
nsmp <- 10
reg1 <- bsgw(f1, dat[idx.train, ], control = bsgw.control(iter = nsmp)
, ordweib = T, print.level = 0)
reg2 <- bsgw(f2, dat[idx.train, ], control = bsgw.control(iter = nsmp)
, ordweib = T, print.level = 0)
# defining survival function for this model
survfunc <- function(t, args, n) {
nobs <- args$nobs; natt <- args$natt; nsmp <- args$nsmp
alpha <- args$alpha; beta <- args$beta; X <- args$X
idx.smp <- floor((n - 1) / nobs) + 1
idx.obs <- n - (idx.smp - 1) * nobs
return (exp(- t ^ alpha[idx.smp] *
exp(sum(X[idx.obs, ] * beta[idx.smp, ]))));
}
# preparing function and argument lists
X.pred <- as.matrix(cbind(1, bmt[idx.pred, c("platelet", "age", "tcell")]))
arg.1 <- list(nobs = nobs.pred, natt = 4, nsmp = nsmp
, alpha = exp(reg1$smp$betas), beta = reg1$smp$beta, X = X.pred)
arg.2 <- list(nobs = nobs.pred, natt = 4, nsmp = nsmp
, alpha = exp(reg2$smp$betas), beta = reg2$smp$beta, X = X.pred)
arg.list <- list(arg.1, arg.2)
f.list <- list(survfunc, survfunc)
# cause-specific competing-risk
# set rel.tol to smaller number in real-world applications
tout <- seq(from = 0.0, to = tmax, length.out = 10)
out.cfc <- cfc(f.list, arg.list, nobs.pred * nsmp, tout, rel.tol = 1e-2)
## End(Not run)
``` |

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.