-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathREADME.Rmd
94 lines (69 loc) · 3.47 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# psfmi
[](https://CRAN.R-project.org/package=psfmi)
[](https://CRAN.R-project.org/package=psfmi)
[](https://github.com/mwheymans/psfmi/actions)
[](https://cran.r-project.org/)
The package provides functions to apply pooling, backward and forward selection
of linear, logistic and Cox regression models across multiply imputed data sets
using Rubin's Rules (RR). The D1, D2, D3, D4 and the median p-values method can be
used to pool the significance of categorical variables (multiparameter test).
The model can contain continuous, dichotomous, categorical and restricted cubic
spline predictors and interaction terms between all these type of variables.
Variables can also be forced in the model during selection.
Validation of the prediction models can be performed with cross-validation or
bootstrapping across multiply imputed data sets and pooled model performance measures
as AUC value, Reclassification, R-square, Hosmer and Lemeshow test, scaled Brier score and calibration
plots are generated. Also a function to externally validate logistic prediction models
across multiple imputed data sets is available and a function to compare models
in multiply imputed data.
## Installation
You can install the released version of psfmi with:
``` r
install.packages("psfmi")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("mwheymans/psfmi")
```
## Citation
Cite the package as:
``` r
Martijn W Heymans (2021). psfmi: Prediction Model Pooling, Selection and Performance Evaluation
Across Multiply Imputed Datasets. R package version 1.1.0. https://mwheymans.github.io/psfmi/
```
## Examples
This example shows you how to pool a logistic regression model across 5 multiply imputed
datasets and that includes two restricted cubic spline variables and a categorical, continuous
and dichotomous variable. The pooling method that is used is method D1.
```{r }
library(psfmi)
pool_lr <- psfmi_lr(data=lbpmilr, formula = Chronic ~ rcs(Pain, 3) +
JobDemands + rcs(Tampascale, 3) + factor(Satisfaction) +
Smoking, nimp=5, impvar="Impnr", method="D1")
pool_lr$RR_model
pool_lr$multiparm
```
This example shows you how to apply forward selection of the above model using a p-value of 0.05.
```{r }
library(psfmi)
pool_lr <- psfmi_lr(data=lbpmilr, formula = Chronic ~ rcs(Pain, 3) +
JobDemands + rcs(Tampascale, 3) + factor(Satisfaction) +
Smoking, p.crit = 0.05, direction="FW",
nimp=5, impvar="Impnr", method="D1")
pool_lr$RR_model_final
pool_lr$multiparm
```
More examples for logistic, linear and Cox regression models as well as internal and external validation of prediction models can be found on the [package website](https://mwheymans.github.io/psfmi/) or in the online book [Applied Missing Data Analysis](https://bookdown.org/mwheymans/bookmi/).