CSC_MI | R Documentation |
This function can be utilized to perform Cause-Specific Cox Regression on multiply imputed datasets.
CSC_MI(mids, formula, ...)
mids |
A |
formula |
A formula object passed to the |
... |
Other arguments which should be passed to the |
A small convenience function to perform CSC regression on multiply imputed data. It is simply a wrapper around the CSC
function from the riskRegression package, because the usual use of with
is not supported directly. It returns a mira
object, which can be passed to the outcome_model
argument inside of the adjustedcif
function when needed. No pool
method or other functionality is available.
A mira
object containing the CSC regression for every imputed dataset.
Robin Denz
adjustedsurv
, CSC
, mice
# not run because it would be too slow
library(adjustedCurves)
library(survival)
if (requireNamespace("riskRegression") & requireNamespace("mice")) {
library(riskRegression)
library(mice)
# simulate some data as example
sim_dat <- sim_confounded_crisk(n=50, max_t=1.2)
sim_dat$group <- as.factor(sim_dat$group)
# introduce random missingness in x1 as example
sim_dat$x1 <- ifelse(runif(n=50) < 0.5, sim_dat$x1, NA)
# perform multiple imputation
mids <- mice::mice(data=sim_dat, method="pmm", m=5, printFlag=0)
# use the function
csc_mods <- CSC_MI(mids=mids,
formula=Hist(time, event) ~ x1 + x2 + x3 + x4 + x5 + x6 + group
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.