as.mimids: Create a 'mimids' object

View source: R/as.mimids.R

as.mimidsR Documentation

Create a mimids object

Description

Creates a mimids object from a list of matchit objects and an imputed dataset.

Usage

as.mimids(x, ...)

## Default S3 method:
as.mimids(x, datasets, ...)

Arguments

x

A list of matchit objects, each the output of a call to MatchIt::matchit() on an imputed dataset.

...

Ignored.

datasets

This argument specifies the datasets containing the exposure and the potential confounders called in the formula. This argument must be an object of the mids or amelia class, which is typically produced by a previous call to mice() function from the mice package or to amelia() function from the Amelia package (the Amelia package is designed to impute missing data in a single cross-sectional dataset or in a time-series dataset, currently, the MatchThem package only supports the former datasets).

Details

The matched datasets are stored as though matchthem() was called with approach = "within".

Value

A mimids object.

See Also

matchthem(), mimids, MatchIt::matchit()

Examples


#Loading the dataset
data(osteoarthritis)

#Multiply imputing the missing values
imputed.datasets <- mice::mice(osteoarthritis, m = 5,
                               printFlag = FALSE)

#Matching the multiply imputed datasets manually
match.list <- lapply(1:5, function(i) {
  MatchIt::matchit(OSP ~ AGE + SEX + BMI + RAC + SMK,
                   mice::complete(imputed.datasets, i),
                   method = 'nearest')
})

#Creating mimids object
matched.datasets <- as.mimids(match.list,
                              imputed.datasets)

FarhadPishgar/MatchThem documentation built on April 4, 2024, 5:54 p.m.