Learn R Programming

MatchThem (version 0.8.1)

weightthem.data: Outputs Weighted Imputed Datasets

Description

The weightthem.data() function extracts data from an object of the wimids class.

Usage

weightthem.data(object, n = 1)

Arguments

object

This argument specifies an object of the wimids class.

n

This argument specifies the weighted imputed dataset number, intended to extract its data. The input must be a positive integer. The default is 1.

Value

This function returns the imputed dataset after weighting, with weights of observations included in the dataset (listed as the weights variables).

Details

The weighted datasets within the wimids class object are extracted.

See Also

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"))

#Estimating weights of observations in the multiply imputed datasets
weighted.datasets <- weightthem(OSP ~ AGE + SEX + BMI + RAC + SMK, imputed.datasets,
                                approach = 'within', method = 'ps')

#Extracting the first imputed dataset
weighted.dataset.1 <- weightthem.data(weighted.datasets, n = 1)
# }

Run the code above in your browser using DataLab