Learn R Programming

MatchThem (version 0.9.0)

complete: Extracts Imputed Datasets

Description

complete() function extracts data from an object of the mids, mimids, or wimids class.

Usage

complete(object, n = 1, include = FALSE, mild = FALSE, all = TRUE,
  ...)

Arguments

object

This argument specifies an object of the mids, mimids, or wimids class.

n

This argument specifies the imputed dataset number, intended to extract its data, or an action. The input must be a positive integer or a keyword. The keywords include "all" (produces a mild object of the imputed datasets), "long" (produces a dataset with imputed datasets stacked vertically), and "broad" (produces a dataset with imputed datasets stacked horizontally). The default is 1.

include

This argument specifies whether the original data with the missing values should be included. The input must be a logical value. The default is FALSE.

mild

This argument specifies whether the return value should be an object of mild class. Please note that setting mild = TRUE overrides n keywords "long", "broad", and "repeated". The default is FALSE.

all

This argument specifies whether to include observations with a zero estimated weight (only for mimids or wimids objects). The default is TRUE.

...

Additional arguments to be passed to the function.

Value

This function returns the imputed dataset within mids, mimids, or wimids class objects.

Details

The datasets within the mids, mimids, or wimids class objects are extracted.

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. https://www.jstatsoft.org/v45/i03/

See Also

mimids

wimids

Examples

Run this code
# NOT RUN {
#Loading the dataset
data(osteoarthritis)

#Multiply imputing the missing values
imputed.datasets <- mice(osteoarthritis, m = 5, maxit = 10,
                         method = c("", "", "mean", "polyreg",
                                    "logreg", "logreg", "logreg"))

#Matching the multiply imputed datasets
matched.datasets <- matchthem(OSP ~ AGE + SEX + BMI + RAC + SMK, imputed.datasets,
                              approach = 'within', method = 'nearest')

#Extracting the first imputed dataset
matched.dataset.1 <- complete(matched.datasets, n = 1)
# }

Run the code above in your browser using DataLab