# \donttest{
data("biomarkers")
library("dplyr")
# do multiple imputation (with a small number for illustration only)
library("mice")
n_imp <- 2
set.seed(20231129)
mi_biomarkers <- mice::mice(data = biomarkers, m = n_imp, printFlag = FALSE)
imputed_biomarkers <- mice::complete(mi_biomarkers, action = "long") %>%
rename(imp = .imp, id = .id)
# estimate SPVIMs for each imputed dataset, using simple library for illustration only
library("SuperLearner")
est_lst <- lapply(as.list(1:n_imp), function(l) {
this_x <- imputed_biomarkers %>%
filter(imp == l) %>%
select(starts_with("lab"), starts_with("cea"))
this_y <- biomarkers$mucinous
suppressWarnings(
vimp::sp_vim(Y = this_y, X = this_x, V = 2, type = "auc",
SL.library = "SL.glm", gamma = 0.1, alpha = 0.05, delta = 0,
cvControl = list(V = 2), env = environment())
)
})
# pool the SPVIMs using Rubin's rules
pooled_spvims <- pool_spvims(spvim_ests = est_lst)
pooled_spvims
# }
Run the code above in your browser using DataLab