| Type: | Package |
| Title: | Cause-Specific Framework for Competing-Risk Analysis |
| Version: | 1.2.1 |
| Date: | 2025-09-23 |
| Description: | Numerical integration of cause-specific survival curves to arrive at cause-specific cumulative incidence functions, with three usage modes: 1) Convenient API for parametric survival regression followed by competing-risk analysis, 2) API for CFC, accepting user-specified survival functions in R, and 3) Same as 2, but accepting survival functions in C++. For mathematical details and software tutorial, see Mahani and Sharabiani (2019) <doi:10.18637/jss.v089.i09>. |
| License: | GPL-2 |GPL-3 [expanded from: GPL (≥ 2)] |
| Imports: | Rcpp (≥ 0.12.1), abind, survival, doParallel, foreach |
| LinkingTo: | Rcpp, RcppArmadillo, RcppProgress |
| NeedsCompilation: | yes |
| Packaged: | 2025-09-24 04:31:26 UTC; root |
| Author: | Mansour T.A. Sharabiani [aut], Alireza S. Mahani [aut, cre] |
| Maintainer: | Alireza S. Mahani <alireza.s.mahani@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-09-24 05:11:41 UTC |
The Bone Marrow Transplant Data
Description
Bone marrow transplant data with 408 rows and 5 columns.
Format
The data has 408 rows and 5 columns.
- cause
a numeric vector code. Survival status. 1: dead from treatment related causes, 2: relapse , 0: censored.
- time
a numeric vector. Survival time.
- platelet
a numeric vector code. Plalelet 1: more than 100 x
10^9per L, 0: less.- tcell
a numeric vector. T-cell depleted BMT 1:yes,0:no.
- age
a numeric vector code. Age of patient, scaled andcentered ((age-35)/15).
Source
Simulated data (taken from R package 'timereg')
Cause-specific competing-risk survival analysis
Description
Using adaptive generalized Newton-Cotes for calculating cumulative incidence functions.
Usage
cfc(f.list, args.list, n, tout, Nmax = 100L, rel.tol = 1e-05, ncores = 1)Arguments
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 |
Value
An object of classcfc, 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., |
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
References
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.
See Also
Examples
## Not run: library("survival") # used for constructing survival formulaslibrary("BSGW") # used for Bayesian survival regressiondata("bmt")# splitting data into training and prediction setsidx.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 BSGWout.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$dattmax <- out.prep$tmax# estimating cause-specific models# set nsmp to larger number in real-world applicationsnsmp <- 10reg1 <- 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 modelsurvfunc <- 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 listsX.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 applicationstout <- 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)Cause-specific competing-risk survival analysis in probability denomination
Description
Constructing cumulative incidence and event-free probability functions from cause-specific survival times give for a fixed set of probabilities.
Usage
cfc.pbasis(t1, t2, probs, unity.tol = 1e-06, diff.tol = 0.01, diff.tol.policy = c("all", "mean"))Arguments
t1 | Multi-dimensional array containing survival times for cause 1 (i.e. exponential of the negative integral of hazard function). First dimension must correspond to probabilities at which times are calculated. Elements with same time, but distributed in the space of remaining dimensions, are treated independently. These diemensions can correspond, e.g., to observations or samples (in Bayesian frameworks). Survival times must be increasing along the first dimension. |
t2 | Multi-dimensional array containing survival times for cause 2. See note for |
probs | Probabilities for which survival times are provided in |
unity.tol | Tolerance for difference of survival probability from 1.0 at time=0.0. In other words, we require that |
diff.tol | Tolerance for change in survival probabilities from one time point to the next. Large changes lead to higher errors during numerical integration. |
diff.tol.policy | If |
Details
For each 'row' oft1, andt2, all elements are processed independently. To combine the survival curves from corresponding elements oft1 andt2, we first form a 'comon denominator' time vector by combining the two time vectors and sorting the results (after removing duplicates). We limit the maximum value in the combined time vector to minimum of the the two maxima from each cause. Next, we use interpolation to find survival probabilities of each cause at all the time points in the combined time vector. Finally, we call the functioncfc.tbasis.
Value
Ift1 andt2 are one-dimensional, a matrix with columns named"time","ci1","ci2" and"efp" is returned. For multi-dimensional arrays, a list is returned with one such matrix for each element of the consolidated dimension representing all but the first dimension oft1 andt2.
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
References
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.
See Also
Examples
## Not run: # prepare data for cause-specific competing-risk analysisdata(bmt)bmt$status1 <- 1*(bmt$cause==1)bmt$status2 <- 1*(bmt$cause==2)f1 <- Surv(time, status1) ~ platelet + age + tcellf2 <- Surv(time, status2) ~ platelet + age + tcell# perform weibull regression on each cause independentlylibrary(survival)reg1 <- survreg(f1, bmt)reg2 <- survreg(f2, bmt)# predict times for given probabilities# transpose predictions so that first dimension# is time/probability (use first 50 observations for speed)pvec <- seq(from=1.0, to = 0.1, length.out = 100)pred1 <- t(predict(reg1, newdata = bmt[1:50,], p = 1-pvec, type = "quantile"))pred2 <- t(predict(reg2, newdata = bmt[1:50,], p = 1-pvec, type = "quantile"))# cause-specific competing risk analysis - probability modemy.cfc <- cfc.pbasis(pred1, pred2, probs = pvec)# calculating averages across observations (e.g. patients in the study)my.summ <- summary(my.cfc)# plotting average CI and event-free probability curvesplot(my.summ)## End(Not run)Utility function for CFC data preparation
Description
Preparing a data frame and formulas for cause-specific competing-risk survival analysis. It expands the multi-state status column into a series of binary columns by treating an event for a cause as censoring for all other causes.
Usage
cfc.prepdata(formul, dat)Arguments
formul | Original survival formula. |
dat | Original data frame, with |
Details
The output data frame will haveK new binary status columns. TheK new status columns will be named"status_1","status_2" through"status_<K>". Each of the output formulas informula.list field will have the correspondingstatus. Column "status_1" will be1 whereverstatus equals1 in original data frame, and0 elsewhere, and similarly for the remainingK-1 newly-added status columns.
Value
A list with the following elements:
K | Number of causes. |
dat | Expanded data frame. |
formula.list | A list of |
formula.noresp | A formula with no left-hand side (time and status variables). This can be used for preparing the model matrix for prediction data sets, which can possibly have no response. |
tmax | Maximum time to event/censoring extracted from original data frame. This can be used, e.g., during competing-risk analysis. |
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
References
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
Examples
data(bmt)prep.out <- cfc.prepdata(Surv(time, cause) ~ platelet + age + tcell, bmt)Cause-specific competing-risk survival analysis, using parametric survival regression models
Description
Convenient function to build cause-specific, parametric survival models using thesurvival package. This is followed by application ofcfc function to produce cumulative incidence functions.
Usage
cfc.survreg(formula, data, newdata = NULL, dist = "weibull" , control = survreg.control(), tout, Nmax = 100L , rel.tol = 1e-05)Arguments
formula | Survival formula with a multi-state status variable. See |
data | Data frame containing variables listed in |
newdata | Data frame of structure similar to |
dist | One of |
control | List of |
tout | Time points, along which to produce the cumulative incidence curves. |
Nmax | Maximum number of subdivisions to be used in the |
rel.tol | Threshold for relative error in |
Value
A list with the following elements:
K | Number of causes. |
formulas | List of formulas used in each of the |
regs | List of all cause-specific regression objects returned by |
tout | Same as input. |
cfc | An object of class |
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
References
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
Examples
data(bmt)formul <- Surv(time, cause) ~ platelet + age + tcellret <- cfc.survreg(formul, bmt[1:300, ], bmt[-(1:300), ] , Nmax = 300, rel.tol = 1e-3)Survival probability function forsurvreg models
Description
Function for predicting survival probability as a function of time forsurvreg regression objects insurvival package. It can be used to mixsurvreg models with other survival models in competing-risk analysis, usingCFC package. This function is used insidecfc.survreg.
Usage
cfc.survreg.survprob(t, args, n)Arguments
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 |
Value
Vector of survival probabilities at time(s)t.
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
References
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
Examples
## Not run: library("CFC") # for cfcdata(bmt)library("randomForestSRC") # for rfsrclibrary("survival") # for survregprep <- cfc.prepdata(Surv(time, cause) ~ platelet + age + tcell, bmt)f1 <- prep$formula.list[[1]]f2 <- prep$formula.list[[2]]dat <- prep$dattmax <- prep$tmax# building a parametric Weibull regression model# for cause 1reg1 <- survreg(f1, dat, x = TRUE) # must keep x for prediction# building a random forest survival model for cause 2reg2 <- rfsrc(f2, dat)# implementing a continuous interface for the random forest# survival functionrfsrc.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 listf.list <- list(cfc.survreg.survprob, rfsrc.survfunc)arg.list <- list(reg1, reg2)# competing-risk analysistout <- seq(0.0, tmax, length.out = 10)# increase rel.tol for higher accuracycfc.out <- cfc(f.list, arg.list, nrow(bmt), tout, rel.tol = 1e-3)## End(Not run)Cause-specific competing-risk survival analysis in time denomination
Description
Constructing cumulative incidence and event-free probability functions from cause-specific survival probabilities evaluated at fixed time points.
Usage
cfc.tbasis(p1, p2, unity.tol = 1e-06, diff.tol = 0.01, diff.tol.policy = c("mean", "all"), check = TRUE)Arguments
p1 | Multi-dimensional array containing survival probabilities for cause 1 (i.e. exponential of the negative integral of hazard function). First dimension must correspond to time points at which probabilities are calculated. Elements with same time, but distributed in the space of remaining dimensions, are treated independently. These diemensions can correspond, e.g., to observations or samples (in Bayesian frameworks). |
p2 | Multi-dimensional array containing survival probabilities for cause 2. See note for |
unity.tol | Tolerance for difference of survival probabilities from 1.0 at time=0.0, which is the first 'row' of arrays |
diff.tol | Tolerance for change in survival probabilities from one time point to the next. Large changes lead to higher errors during numerical integration. |
diff.tol.policy | If |
check | Boolean flag indicating whether or not to check probability arrays for validity. Current validity checks are: 1) ensuring all probabilities are between 0.0 and 1.0, 2) all probabilities at time=0.0 are equal to 1.0 (see |
Details
Assuming one-dimensionalp1 andp2 for clarity, the algorithm calculates cumulative incidence function for cuase 1 using a recursive formula:ci1[n+1] = ci1[n] + dci1[n], wheredci1[n] = 0.5*(p2[n] + p2[n+1])*(p1[n] - p1[n+1]). The increment in cumulative incidence function for cause 2 is similarly calculated,dci2[n] = 0.5*(p1[n] + p1[n+1])*(p2[n] - p2[n+1]). These equations guarantee thatdci1[n] + dci2[n] = p1[n]*p2[n] - p1[n+1]*p2[n+1]. Event-free probability is simply calculated asefp[n] = p1[n]*p2[n]. Taken together, this numerical integration ensures thatefp[n+1] - efp[n] + dci1[n] + dci2[n] = 0.
Value
Ifp1 andp2 are one-dimensional arrays (i.e. vectors), a matrix with columns named"ci1","ci2" and"efp" is returned, representing the cummulative incidence functions for cause 1 and cause 2 and the event-free probability, evaluated at same time points asp1 andp2 are provided. Ifp1 andp2 are multi-dimensional arrays, a list is returned with elements"ci1","ci2" and"efp", each one with the same interpretation, and all of the same dimensions asp1 andp2.
Note
The integration algorithm described above does not require knowledge of time step. (Alternatively, using hazard functions for integration would have required specification of time step.) Sincep1 andp2 are integrals (followed by exponentiation) of cause-specific hazard functions, using them directly adds to robustness of numerical integration and avoids error accumulation. The returned cumulative incidence and event-free probabilities correspond to the same time points assumed for input cause-specific probabilities.
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
References
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.
See Also
Examples
## Not run: # prepare data for cause-specific competing-risk analysisdata(bmt)bmt$status1 <- 1*(bmt$cause==1)bmt$status2 <- 1*(bmt$cause==2)f1 <- Surv(time, status1) ~ platelet + age + tcellf2 <- Surv(time, status2) ~ platelet + age + tcell# sample-based bayesian weibull regressionlibrary(BSGW)reg1 <- bsgw(f1, bmt, ordweib = TRUE, control = bsgw.control(iter = 500, burnin = 100, nskip = 50))reg2 <- bsgw(f2, bmt, ordweib = TRUE, control = bsgw.control(iter = 500, burnin = 100, nskip = 50))# prediction on a uniform grid of 100 time points# (use first 50 observations for speed)pred1 <- predict(reg1, newdata = bmt[1:50,], tvec = 100)pred2 <- predict(reg2, newdata = bmt[1:50,], tvec = 100)# permuting dimensions of survival objects to conform with cfcS1 <- aperm(pred1$smp$S, c(2,1,3))S2 <- aperm(pred2$smp$S, c(2,1,3))# cause-specific competing risk analysis - time modemy.cfc <- cfc.tbasis(S1, S2)# calculating averages across observations (e.g. patients in the study)my.summ <- summary(my.cfc, MARGIN = c(1,2))# plotting mean CI and event-free functions# as well as their sampled-based confidence intervalsplot(my.summ, t = pred1$tvec)## End(Not run)Summarizing and plotting output ofcfc
Description
summary method for classcfc.
Usage
## S3 method for class 'cfc'summary(object , f.reduce = function(x) x , pval = 0.05, ...)## S3 method for class 'summary.cfc'plot(x, which = c(1, 2), ...)Arguments
object | An object of class "cfc", usually the result of a call to |
f.reduce | Function to be applied to each sub-array of |
pval | Desired significance level for confidence intervals produced by |
x | An object of class "summary.cfc", usually the result of a call to |
which | Vector of integers, indicating which plot(s) must be produced: 1) cumulative incidence functions, one per cause. For each cause, median and credible bands are plotted vs. time-from-index. 2) (unadjusted) survival functions, one per cause. Similar to (1), median and credible bands are plotted. |
... | Further arguments to be passed to |
Value
Recall that the survival probability and cumulative incidence arrays returned bycfc are three-dimensional, and their first two dimensions indicate 1) time points and 2) causes.f.reduce is expected to produce an array of a fixed length, when applied to each sub-array,ci[i, j, ] ands[i, j, ]. The end-result is two three-dimensional array, where the first two dimensions are identical to its input arrays. This 3D array is then passed to thequantile function to compute median and credible bands. There is a special case wheref.reduce returns a scalar, rather than an array, when applied to each sub-array. In this case, quantile calculation is meaningless and we return simply these point estimates. In summary, the return object fromsummary is a list with elements: 1)ci (cumulative incidence), 2)s (survival), and 3)quantiles, a boolean flag indicating whether the cumulative incidence and survival arrays returned are quantiles or point estimates.
Author(s)
Alireza S. Mahani, Mansour T.A. Sharabiani
References
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
Examples
## Not run: library("BSGW") # used for Bayesian survival regressiondata(bmt)# splitting data into training and prediction setsidx.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 BSGWout.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$dattmax <- out.prep$tmax# estimating cause-specific models# set nsmp to larger number in real-world applicationsnsmp <- 10reg1 <- 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 modelsurvfunc <- 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 listsX.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 applicationsout.cfc <- cfc(f.list, arg.list, nobs.pred * nsmp, tout, rel.tol = 1e-2)# summarizing (and plotting) the results# this function calculates the population-average CI and survival, one# per each MCMC sample; therefore, the quantiles produced by the summary# method, correspondingly, reflect our confidence in population-average valuesmy.f.reduce <- function(x, nobs, nsmp) { return (colMeans(array(x, dim = c(nobs, nsmp))))}my.summ <- summary(out.cfc, f.reduce = my.f.reduce, nobs = nobs.pred, nsmp = nsmp)## End(Not run)Summarizing probability-denominated CFC objects
Description
summary method for classcfc.pbasis.
Usage
## S3 method for class 'cfc.pbasis'summary(object, ...)## S3 method for class 'summary.cfc.pbasis'plot(x, ...)Arguments
object | An object of class "cfc.pbasis", usually the result of a call to |
x | An object of class "summary.cfc.pbasis", usually the result of a call to |
... | Further arguments to be passed to/from other methods. |
Value
The functionsummary.cfc.pbasis calculates the average of cumulative incidence and event-free probability functions at each time point across all elements of the object list. If the object is a matrix, it is returned without change.
Author(s)
Alireza S. Mahani, Mansour T.A. Sharabiani
References
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
The model fitting function iscfc.pbasis. Seesummary andplot for descriptions of the generic methods. Seecfc.tbasis for time-denominated CFC, as well as usage examples.
Summarizing and plotting output ofcfc.survreg
Description
summary and method for classcfc.survreg.
Usage
## S3 method for class 'cfc.survreg'summary(object, obs.idx = "all", ...)## S3 method for class 'summary.cfc.survreg'plot(x, which = c(1, 2), ...)Arguments
object | An object of class "cfc.survreg", usually the result of a call to |
obs.idx | Index of observations to calculate mean cumulative incidence for; defaults to all observation. |
... | Further arguments to be passed to/from other methods. |
x | An object of class |
which | Vector of integers, indicating which plot(s) must be produced: 1) cumulative incidence functions, one per cause, as a function of time-to-index, all in the same plot, 2) comparison of cumulative incidence function with/without competing-risk adjustment. The unadjusted figure is equivalent to 1 minus the Kaplan-Meyer (i.e., survival) function. |
Value
summary.cfc.surveeg produces a matrix of dimensionslength(object$tout) (number of time points) byobject$K (number of causes). See description ofwhich aregument forplot.summary.cfc.survreg.
Author(s)
Mansour T.A. Sharabiani, Alireza S. Mahani
References
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
The model fitting function iscfc.survreg. Seesummary andplot for descriptions of the generic methods. For more flexible ways of cause-specific competing-risk analysis, seecfc.
Summarizing time-denominated CFC objects
Description
summary method for classcfc.tbasis.
Usage
## S3 method for class 'cfc.tbasis'summary(object, MARGIN = if (class(object)[2] == "matrix") NULL else 1, ...)## S3 method for class 'summary.cfc.tbasis'plot(x, t = 1, ci = 0.95, ...)Arguments
object | An object of class "cfc.tbasis", usually the result of a call to |
MARGIN | Dimensions of cumulative incidence and event-free probability arrays to keep while averaging the remaining dimensions. If the |
x | An object of class "summary.cfc.tbasis", usually the result of a call to |
t | Regular time step, or vector of time values, used for producing cumulative incidence and event-free probability plots. |
ci | Confidence interval used in cumulative incidence and event-free probability plots. |
... | Further arguments to be passed to/from other methods. |
Value
The functionsummary.cfc.tbasis calculates the average of cumulative incidence and event-free probability functions as directed byMARGIN. For example, if the elementci1 of the object list is three-dimensional, then usingMARGIN=c(1,2) causes the last dimension to be averaged out.
Author(s)
Alireza S. Mahani, Mansour T.A. Sharabiani
References
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
The model fitting function iscfc.tbasis. Seesummary andplot for descriptions of the generic methods. Seecfc.pbasis for probability-denominated CFC, as well as usage examples.