Multiple Imputation and Cross-validation - method cv_MI

Martijn W Heymans

2021-09-23

Introduction

This page contains information of the cv_MI method that combines Multiple Imputation with Cross-validation for the validation of logistic prediction models. This cross-validation method is based on the papers of Mertens BJ and Miles A. The cv_MI method is implemented in the function psfmi_validate. An explanation and examples of how to use the method can be found below.

Method cv_MI

With this method imputations are implemented as part of the cross-validation procedure. Within each cross-validation fold, imputation is done once. By repeating this process over multiple imputation runs, multiply imputed training and test sets are generated. Model performance is evaluated and tested on the training and test sets respectively. The method can be performed in combination with backward selection in the training set and subsequently testing the performance in the test set. The method can only be performed when the outcome data is complete and the original data, that contains the missing values has to be included.

How this method works is visualized in the Figure below.

Schematic overview of the cv_MI method

Schematic overview of the cv_MI method

Examples

Method cv_MI

To run the cv_MI method use:

library(psfmi)
pool_lr <- psfmi_lr(data=lbpmilr, formula = Chronic ~ rcs(Pain, 3) + JobDemands + Tampascale +
             factor(Satisfaction) + Smoking + factor(Satisfaction)*rcs(Pain, 3) ,
             p.crit = 0.05, direction="BW", nimp=5, impvar="Impnr",
             method="D1")
## Removed at Step 1 is - JobDemands
## Removed at Step 2 is - Smoking
## Removed at Step 3 is - rcs(Pain,3)*factor(Satisfaction)
## Removed at Step 4 is - Tampascale
## 
## Selection correctly terminated, 
## No more variables removed from the model
set.seed(200)
res_cv <- psfmi_validate(pool_lr, val_method = "cv_MI", data_orig = lbp_orig, folds = 5,
                     p.crit=1, BW=FALSE,  nimp_cv = 3, miceImp = miceImp, printFlag = FALSE)
## 
## Imp run 1
## 
## fold 1
## 
## fold 2
## 
## fold 3
## 
## fold 4
## 
## fold 5
## 
## Imp run 2
## 
## fold 1
## 
## fold 2
## 
## fold 3
## 
## fold 4
## 
## fold 5
## 
## Imp run 3
## 
## fold 1
## 
## fold 2
## 
## fold 3
## 
## fold 4
## 
## fold 5
res_cv
## $pool_stats
##                  Train      Test
## AUC          0.8783240 0.8261000
## Scaled Brier 0.4499003 0.3329518
## R2           0.5417304 0.4338910
## 
## $LP_val
## (Intercept)     lp_test 
## 0.007978539 0.845083421 
## 
## $auc_test
##                     95% Low C-statistic 95% Up
## C-statistic (logit)  0.7475      0.8261 0.8841

Back to Examples

Method cv_MI including BW selection

To run the cv_MI method including BW selection use:

library(psfmi)
pool_lr <- psfmi_lr(data=lbpmilr, formula = Chronic ~ rcs(Pain, 3) + JobDemands + Tampascale +
             factor(Satisfaction) + Smoking + factor(Satisfaction)*rcs(Pain, 3) ,
             p.crit = 0.05, direction="BW", nimp=5, impvar="Impnr",
             method="D1")
## Removed at Step 1 is - JobDemands
## Removed at Step 2 is - Smoking
## Removed at Step 3 is - rcs(Pain,3)*factor(Satisfaction)
## Removed at Step 4 is - Tampascale
## 
## Selection correctly terminated, 
## No more variables removed from the model
set.seed(200)
res_cv <- psfmi_validate(pool_lr, val_method = "cv_MI", data_orig = lbp_orig, folds = 5,
                     p.crit=0.05, BW=TRUE,  nimp_cv = 3, miceImp = miceImp, printFlag = FALSE)
## 
## Imp run 1
## 
## fold 1
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 2
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 3
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 4
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 5
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## Imp run 2
## 
## fold 1
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 2
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 3
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 4
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 5
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## Imp run 3
## 
## fold 1
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 2
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 3
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 4
## 
## Selection correctly terminated, 
## No more variables removed from the model
## 
## fold 5
## 
## Selection correctly terminated, 
## No more variables removed from the model
res_cv
## $pool_stats
##                  Train      Test
## AUC          0.8783240 0.8261000
## Scaled Brier 0.4499003 0.3329518
## R2           0.5417304 0.4338910
## 
## $LP_val
## (Intercept)     lp_test 
## 0.007978539 0.845083421 
## 
## $auc_test
##                     95% Low C-statistic 95% Up
## C-statistic (logit)  0.7475      0.8261 0.8841