Imputes the mean of within the class
mice.impute.2lonly.mean(y, ry, x, type, wy = NULL, ...)
Vector to be imputed
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
.
Numeric design matrix with length(y)
rows with predictors for
y
. Matrix x
may have no missing values.
Vector of length ncol(x)
identifying random and class
variables. The class variable (only one is allowed) is coded as -2
.
Logical vector of length length(y)
. A TRUE
value
indicates locations in y
for which imputations are created.
Other named arguments.
Vector with imputed data, same type as y
, and of length
sum(wy)
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.
Other univariate 2lonly
functions: mice.impute.2lonly.norm
,
mice.impute.2lonly.pmm