CSC_MI: Cause-Specific Cox Regression with Multiple Imputation

View source: R/ce_model_mi.r

CSC_MIR Documentation

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, ...)

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.

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.

Value

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

Author(s)

Robin Denz

See Also

adjustedsurv, CSC, mice

Examples

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


RobinDenz1/adjustedCurves documentation built on Sept. 27, 2024, 7:04 p.m.