Skip to contents

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

Robin Denz

See also

Examples

# 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
                   )
}
#> Loading required namespace: riskRegression
#> Loading required namespace: mice
#> riskRegression version 2023.12.21
#> 
#> Attaching package: ‘mice’
#> The following object is masked from ‘package:stats’:
#> 
#>     filter
#> The following objects are masked from ‘package:base’:
#> 
#>     cbind, rbind
# }