This page contains information of the boot_MI
method that is implemented in the psfmi_perform
function of the psfmi
package and that combines Multiple Imputation with bootstrapping for the validation of logistic regression / prediction models. Internal validation is done of the last model that is selected by the function psfmi_lr
. An explanation and examples of how to use the methods can be found below.
With the method boot_MI, first bootstrap samples are drawn from the original dataset with missing values and than multiple imputation is applied in each bootstrap sample. The pooled model is analyzed in the each bootstrap training data and subsequently tested in original multiply imputed data. The method can be performed in combination with backward or forward selection selection.
How these steps work is visualized in the Figure below.
Schematic overview of the boot_MI method
internal validation is done of the last model that is selected by the function psfmi_lr
. In the example below, psfmi_lr
is used with p.crit
set at 1. This setting is also used and in the psfmi_perform
function. This means that first the full model is pooled and subsequently interval validation is also done of this full model.
library(psfmi)
<- psfmi_lr(data=lbpmilr, formula = Chronic ~ Pain + JobDemands + rcs(Tampascale, 3) +
pool_lr factor(Satisfaction) + Smoking, p.crit = 1, direction="FW",
nimp=5, impvar="Impnr", method="D1")
set.seed(100)
<- psfmi_perform(pool_lr, val_method = "boot_MI", data_orig = lbp_orig, nboot = 5,
res_MI_boot p.crit=1, nimp_mice = 3, direction = "BW", miceImp = miceImp,
printFlag = FALSE)
##
## Boot 1
##
## Boot 2
##
## Boot 3
##
## Boot 4
##
## Boot 5
##
## p.crit = 1, validation is done without variable selection
res_MI_boot
## $stats_val
## Orig Apparent Test Optimism Corrected
## AUC 0.8871000 0.8916400 0.8802000 0.01144000 0.8756600
## R2 0.5605521 0.5783181 0.5378758 0.04044230 0.5201098
## Brier Scaled 0.4514569 0.4629364 0.4117878 0.05114854 0.4003084
## Slope 1.0000000 1.0000000 0.9050770 0.09492303 0.9050770
##
## $intercept_test
## intercept
## -0.1418631
##
## $res_boot
## ROC_app ROC_test R2_app R2_test Brier_sc_app Brier_sc_test
## Boot 1 0.8431 0.8777 0.4443306 0.5289039 0.3356881 0.4126126
## Boot 2 0.9131 0.8817 0.6384560 0.5483116 0.5150413 0.4217096
## Boot 3 0.8911 0.8822 0.5923924 0.5458272 0.4735383 0.4225408
## Boot 4 0.9104 0.8864 0.6219550 0.5501550 0.5026123 0.4078803
## Boot 5 0.9005 0.8730 0.5944567 0.5161814 0.4878018 0.3941958
## intercept Slope
## Boot 1 -0.11704446 1.2052458
## Boot 2 -0.18244542 0.7159558
## Boot 3 -0.05277384 0.8674005
## Boot 4 -0.40024757 0.8972059
## Boot 5 0.04319589 0.8395768
Back to Examples
Internal validation is done of the last model that is selected by the function psfmi_lr
. In the example below, psfmi_lr
is used with p.crit
set at 1, and pooling is than done without variable selection, i.e. first the full model is pooled. When subsequently interval validation is done with the psfmi_perform
function including BW, BW is applied in each bootstrap sample from the full model.
library(psfmi)
<- psfmi_lr(data=lbpmilr, Outcome="Chronic", predictors = c("Pain", "JobDemands", "Smoking"),
pool_lr cat.predictors = "Satisfaction", spline.predictors = "Tampascale", nknots=3,
p.crit = 1, direction="FW", nimp=5, impvar="Impnr", method="D1")
set.seed(100)
<- psfmi_perform(pool_lr, val_method = "boot_MI", data_orig = lbp_orig, nboot = 5,
res_MI_boot p.crit=0.05, nimp_mice = 3, direction = "BW", miceImp = miceImp,
printFlag = FALSE)
##
## Boot 1
## Removed at Step 1 is - JobDemands
## Removed at Step 2 is - Smoking
## Removed at Step 3 is - rcs(Tampascale,3)
##
## Selection correctly terminated,
## No more variables removed from the model
##
## Boot 2
## Removed at Step 1 is - JobDemands
## Removed at Step 2 is - Smoking
## Removed at Step 3 is - rcs(Tampascale,3)
##
## Selection correctly terminated,
## No more variables removed from the model
##
## Boot 3
## Removed at Step 1 is - JobDemands
## Removed at Step 2 is - Smoking
## Removed at Step 3 is - Pain
##
## Selection correctly terminated,
## No more variables removed from the model
##
## Boot 4
## Removed at Step 1 is - Smoking
## Removed at Step 2 is - JobDemands
## Removed at Step 3 is - rcs(Tampascale,3)
##
## Selection correctly terminated,
## No more variables removed from the model
##
## Boot 5
## Removed at Step 1 is - JobDemands
## Removed at Step 2 is - Smoking
##
## Selection correctly terminated,
## No more variables removed from the model
res_MI_boot
## $stats_val
## Orig Apparent Test Optimism Corrected
## AUC 0.8871000 0.8750000 0.8704400 0.00456000 0.8825400
## R2 0.5605521 0.5353315 0.5160330 0.01929853 0.5412536
## Brier Scaled 0.4514569 0.4285873 0.4076258 0.02096155 0.4304954
## Slope 1.0000000 1.0000000 0.9649318 0.03506820 0.9649318
##
## $intercept_test
## intercept
## -0.0995169
##
## $res_boot
## ROC_app ROC_test R2_app R2_test Brier_sc_app Brier_sc_test
## Boot 1 0.8230 0.8669 0.4070467 0.5121114 0.3136382 0.4027844
## Boot 2 0.9034 0.8722 0.6093501 0.5213792 0.4866593 0.4297398
## Boot 3 0.8684 0.8568 0.5243855 0.4775389 0.4131725 0.3481191
## Boot 4 0.8933 0.8730 0.5795163 0.5227525 0.4873638 0.4282208
## Boot 5 0.8869 0.8833 0.5563589 0.5463829 0.4421028 0.4292647
## intercept Slope
## Boot 1 -0.14270301 1.2315078
## Boot 2 -0.01465516 0.7948917
## Boot 3 -0.19316264 0.8346061
## Boot 4 -0.19130914 0.9528790
## Boot 5 0.04424543 1.0107745
Back to Examples