cfc {CFC} | R Documentation |

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

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

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

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

```
## 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)
```

[Package *CFC* version 1.2.0 Index]