Learn R Programming

adjustedCurves (version 0.11.3)

CSC_MI: Cause-Specific Cox Regression with Multiple Imputation

Description

This function can be utilized to perform Cause-Specific Cox Regression on multiply imputed datasets.

Usage

CSC_MI(mids, formula, ...)

Value

A mira object containing the CSC regression for every imputed dataset.

Arguments

mids

A mids object created using the mice function. This replaces the data argument in the original function call.

formula

A formula object passed to the CSC function in the riskRegression package.

...

Other arguments which should be passed to the CSC function in the riskRegression package.

Author

Robin Denz

Details

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.

See Also

adjustedsurv, CSC, mice

Examples

Run this code
# not run because it would be too slow
# \donttest{
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
                   )
}
# }

Run the code above in your browser using DataLab