Learn R Programming

hmi (version 0.9.16)

imp_semicont_single: The function for hierarchical imputation of semicontinuous variables.

Description

The function is called by the wrapper. We consider data to be "semicontinuous" when more than 5% of the (non categorical) observations. For example in surveys a certain portion of people, when asked for their income, report "0", which clearly violates the assumption of income to be (log-) normally distributed.

Usage

imp_semicont_single(y_imp, X_imp, spike = NULL, pvalue = 0.2,
  k = Inf)

Arguments

y_imp

A Vector with the variable to impute.

X_imp

A data.frame with the fixed effects variables.

spike

A numeric value saying to which value Y might be spiked.

pvalue

A numeric between 0 and 1 denoting the threshold of p-values a variable in the imputation model should not exceed. If they do, they are excluded from the imputation model.

k

An integer defining the allowed maximum of levels in a factor covariate.

Value

A n x 1 data.frame with the original and imputed values.