the R psfmi package
Introduction
On this page you will find information about the psfmi package. The package contains functions to pool logistic (psfmi_lr), Cox regression (psfmi_coxr) and linear and logistic mixed models (psfmi_mm) in multiply imputed datasets. It is also possible to apply backward variable selection in multiple imputed datasets (Be aware that backward selection may result in overfitted and optimistic prediction models, see TRIPOD). Backward selection should therefore be followed by internal validation of the model. This is also possible with the psfmi package.
Pooling methods are Rubin’s Rules, and especially of interest for categorical predictors, the D1, D2, D3 and MPR (median p-value) methods. Moreover, pooling results can be obtained for models including two-way interaction terms between continuous, dichotomous, categorical predictors and restricted cubic spline variables. This is also allowed during variable selection. Further, all type of predictors and interaction terms can be forced in the model during variable selection.
The package also contains a function to generate pooled apparent model performance measures as ROC/AUC, Nagelkerke R-squares, Hosmer & Lemeshow test values and calibration plots over multiply imputed datasets (miperform_lr). A wrapper function over Frank Harrell’s validate function is available. Bootstrap internal validation is performed in each imputed dataset and results are pooled. Backward Selection as part of internal validation is optional and recommended.
There is also a function to perfrom external validation in multiply imputed datasets (mivalext_lr). Moreover, a function to evaluate the stability of selected mosdels is also available and uses bootstrapping in combination with the functions (psfmi_lr and psfmi_coxr) and cluster bootstrapping in combination with the function (psfmi_mm).
Installing the psfmi package
The package can be installed by running the following code in the R console window:
install.packages(“devtools”)
library(devtools)
devtools::install_github(“mwheymans/psfmi”)
library(psfmi)
Main functions
The main functions that are available in the psfmi package are:
psfmi_lr: Pooling and predictor selection function for Logistic regression models in multiply imputed datasets.
psfmi_coxr: Pooling and predictor selection function for Cox regression models in multiply imputed datasets.
psfmi_mm: Pooling and predictor selection function for linear and logistic Mixed models in multiply imputed datasets.
psfmi_stab: Evaluation of Model Stability in multiply imputed datasets.
miperform_lr: Evaluate performance of logistic regression models over multiply imputed datasets.
mivalext_lr: External Validation of logistic prediction models in multiply imputed datasets.