impute_data_mice: Chained multiple imputation of a set of variables

Description Usage Arguments Value Examples

View source: R/impute_data_mice.R

Description

This function uses the mice package to multiply impute missing values based on the statistical relationships among a set of variables. There is a range of mice documentation and tutorials that is worth getting into to develop and check this function.

Usage

1
impute_data_mice(data, var_names, var_methods, n_imputations)

Arguments

data

Data table - the Health Survey for England dataset with missing values

var_names

Character vector - the names of the variables to be considered in the multiple imputation.

var_methods

Character vector - the names of the statistical methods to be used to predict each of the above variables - see the mice documentation.

n_imputations

Integer - the number of different versions of the imputed data to produce.

Value

Returns a list containing

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 

# "logreg" - binary Logistic regression
# "polr" - ordered Proportional odds model
# "polyreg" - unordered Polytomous logistic regression

imp_obj <- impute_data_mice(
  data = test_data,
  c("binary_variable", "order_categorical_variable", "unordered_categorical_variable"),
  c("logreg", "polr", "polyreg"),
  n_imputations = 5
)


## End(Not run)

dosgillespie/hseclean documentation built on May 2, 2020, 1:15 a.m.