Weights Multiply Imputed Datasets
weightthem() performs weighting in the supplied imputed datasets, given as mids or amelia objects, by running WeightIt::weightit() on each of the imputed datasets with the supplied arguments.
weightthem(formula, datasets, approach = "within", method = "ps", ...)
formula | 
 A   | 
datasets | 
 The datasets containing the exposure and covariates mentioned in the   | 
approach | 
 The approach used to combine information across imputed datasets. Currently,   | 
method | 
 The method used to estimate weights. See   | 
... | 
 Additional arguments to be passed to   | 
If an amelia object is supplied to datasets, it will first be transformed into a mids object for further use. weightthem() works by calling mice::complete() on the mids object to extract a complete dataset, and then calls WeightIt::weightit() on each one, storing the output of each weightit() call and the mids in the output. All arguments supplied to weightthem() except datasets and approach are passed directly to weightit(). With the across method, the estimated propensity scores are averaged across imputations and re-supplied to another set of calls to weightit().
An object of the wimids (weighted multiply imputed datasets) class, which includes the supplied mids object (or an amelia object transformed into a mids object if supplied) and the output of the calls to weightit() on each imputed dataset.
Farhad Pishgar and Noah Greifer
Stef van Buuren and Karin Groothuis-Oudshoorn (2011). mice: Multivariate Imputation by Chained Equations in R. Journal of Statistical Software, 45(3): 1-67. https://www.jstatsoft.org/v45/i03/
#1
#Loading libraries
library(MatchThem)
#Loading the dataset
data(osteoarthritis)
#Multiply imputing the missing values
imputed.datasets <- mice::mice(osteoarthritis, m = 5)
#Estimating weights of observations in the multiply imputed datasets
weighted.datasets <- weightthem(OSP ~ AGE + SEX + BMI + RAC + SMK,
                                imputed.datasets,
                                approach = 'within',
                                method = 'ps',
                                estimand = "ATT")
#2
#Loading libraries
library(Amelia)
library(MatchThem)
#Loading the dataset
data(osteoarthritis)
#Multiply imputing the missing values
imputed.datasets <- amelia(osteoarthritis, m = 5, noms = c("SEX", "RAC", "SMK", "OSP", "KOA"))
#Estimating weights of observations in the multiply imputed datasets
weighted.datasets <- weightthem(OSP ~ AGE + SEX + BMI + RAC + SMK,
                                imputed.datasets,
                                approach = 'within',
                                method = 'ps',
                                estimand = "ATT")Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.