imp_multi: The main function called by the user. LATER THE USER WILL USE...

Description Usage Arguments Value

View source: R/hmi_mainfunctions_2016-08-12.R View source: R/hmi_mainfunctions_2016-08-02.R View source: R/hmi_mainfunctions_2016-07-27withMCMCglmm.R View source: R/hmi_mainfunctions_2016-07-13.R

Description

The user has to passes to the function his data. Optionally he pass his analysis model formula so that hmi runs the imputation model in line with his analysis model formula. And of course he can specify some parameters for the imputation routine (like the number of imputations and iterations and the burn in percentage.) The standard usage should be that the user gives his complete dataset and his analysis model. But he also could just give y, X and Z and the cluser ID.

The user has to passes to the function his data. Optionally he pass his analysis model formula so that hmi runs the imputation model in line with his analysis model formula. And of course he can specify some parameters for the imputation routine (like the number of imputations and iterations and the burn in percentage.) The standard usage should be that the user gives his complete dataset and his analysis model. But he also could just give y, X and Z and the cluser ID.

Usage

1
2
3
4
5
6
7
8
9
imp_multi(y_imp_multi, X_imp_multi, Z_imp_multi, clID, n.iter = 100, M = 10,
  n.chains = 3, burn.in = 1/3, max.iter = 5000, allowed_max_value = Inf,
  allowed_max_variable = NULL, allowed_min_value = -Inf,
  allowed_min_variable = NULL)

imp_multi(y_imp_multi, X_imp_multi, Z_imp_multi, clID, n.iter = 100, M = 10,
  n.chains = 3, burn.in = 1/3, max.iter = 5000, allowed_max_value = Inf,
  allowed_max_variable = NULL, allowed_min_value = -Inf,
  allowed_min_variable = NULL)

Arguments

y_imp_multi

A Vector with the variable to impute.

X_imp_multi

A data.frame with the fixed effects variables.

Z_imp_multi

A data.frame with the random effects variables.

clID

A vector with the cluster ID.

n.iter

An integer defining the number of iterations that should be run in each bunch of iterations.

M

An integer defining the number of imputations that should be made.

n.chains

An integer defining the number of Markov chains to be made.

burn.in

A numeric between 0 and 1 defining the percentage of draws from the gibbs sampler that should be discarded as burn in.

max.iter

An integer defining the maximum number of iterations that should be run in total.

allowed_max_value

A single numeric Value which shall not be exceeded when values are imputed (e.g. the age of a person can be limited to 125).

allowed_max_variable

A character naming a variable V. For each Y_i the value of V_i shall not exceeded (e.g. the net income shall not exceed the gross income). Note that a new imputed value has to satisfy both conditions of allowed_max_value and allowed_max_variable at the same time.

allowed_min_value

Analog to allowed_max_value.

allowed_min_variable

Analog to allowed_max_variable.

data

A matrix or (better) a data.frame with all variables appearing in model_formula.

model_formula

A formula used for the analysis model.

y

A vector or data.frame with ncol = 1 containing the target variable with the missing values.

X

A vector a data.frame containing the covariates influencing y via fixed effects. If rows with missing values in X should also be imputed, put all your variables in a data.frame (or matrix)

Z

A vector a data.frame containing the covariates influencing y via random effects

cl.id

A factor (should come as data.frame or vector) containing the cluster IDs.

y_variable_name

A character naming the variable to impute.

n.iter

An integer defining the number of iterations that should be run in each bunch of iterations.

M

An integer defining the number of imputations that should be made.

n.chains

An integer defining the number of Markov chains to be made.

burn.in

A numeric between 0 and 1 defining the percentage of draws from the gibbs sampler that should be discarded as burn in.

Value

A data.frame. It consists of the original data and m additional variables with the imputed values.

A data.frame. It consists of the original data and m additional variables with the imputed values.


matthiasspeidel/hmi documentation built on Aug. 18, 2020, 4:37 p.m.