Learn R Programming

mice (version 3.4.0)

mice.impute.2lonly.mean: Imputation of the mean within the class

Description

Imputes the mean of within the class

Usage

mice.impute.2lonly.mean(y, ry, x, type, wy = NULL, ...)

Arguments

y

Vector to be imputed

ry

Logical vector of length length(y) indicating the the subset y[ry] of elements in y to which the imputation model is fitted. The ry generally distinguishes the observed (TRUE) and missing values (FALSE) in y.

x

Numeric design matrix with length(y) rows with predictors for y. Matrix x may have no missing values.

type

Vector of length ncol(x) identifying random and class variables. The class variable (only one is allowed) is coded as -2.

wy

Logical vector of length length(y). A TRUE value indicates locations in y for which imputations are created.

...

Other named arguments.

Value

Vector with imputed data, same type as y, and of length sum(wy)

Details

Observed values in y are averaged within the class, and replicated to the missing y within that class. If there are no observed data in the class, all entries of the class are set to NaN. This function is primarily useful for repairing incomplete data that are constant within the class, but that vary over the classes.

See Also

Other univariate 2lonly functions: mice.impute.2lonly.norm, mice.impute.2lonly.pmm