pool {MatchThem} | R Documentation |
Pools Estimates by Rubin's Rules
Description
pool()
pools estimates from the analyses done within each multiply imputed dataset. The typical sequence of steps to do a matching or weighting procedure on multiply imputed datasets are:
Multiply impute the missing values using the
mice()
function (from the mice package) or theamelia()
function (from the Amelia package), resulting in a multiply imputed dataset (an object of themids
oramelia
class);Match or weight each multiply imputed dataset using
matchthem()
orweightthem()
, resulting in an object of themimids
orwimids
class;Check the extent of balance of covariates in the datasets (using functions from the cobalt package);
Fit the statistical model of interest on each dataset by the
with()
function, resulting in an object of themimira
class; andPool the estimates from each model into a single set of estimates and standard errors, resulting in an object of the
mimipo
class.
Usage
pool(object, dfcom = NULL)
Arguments
object |
An object of the |
dfcom |
A positive number representing the degrees of freedom in the data analysis. The default is |
Details
pool()
function averages the estimates of the model and computes the total variance over the repeated analyses by Rubin’s rules. It calls mice::pool()
after computing the model degrees of freedom.
Value
This function returns an object from the mimipo
class. Methods for mimipo
objects (e.g., print()
, summary()
, etc.) are imported from the mice package.
References
Stef van Buuren and Karin Groothuis-Oudshoorn (2011). mice
: Multivariate Imputation by Chained Equations in R
. Journal of Statistical Software, 45(3): 1-67. doi:10.18637/jss.v045.i03
See Also
Examples
#Loading libraries
#Loading the dataset
data(osteoarthritis)
#Multiply imputing the missing values
imputed.datasets <- mice::mice(osteoarthritis, m = 5)
#Weighting the multiply imputed datasets
weighted.datasets <- weightthem(OSP ~ AGE + SEX + BMI + RAC + SMK,
imputed.datasets,
approach = 'within',
method = 'glm')
#Analyzing the weighted datasets
models <- with(weighted.datasets,
WeightIt::glm_weightit(KOA ~ OSP,
family = binomial))
#Pooling results obtained from analyzing the datasets
results <- pool(models)
summary(results)