Learn R Programming

mice (version 2.30)

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, ...)

Arguments

y

Incomplete data vector of length n

ry

Vector of missing data pattern (FALSE=missing, TRUE=observed)

x

Matrix (n x p) of complete covariates.

type

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

...

Other named arguments.

Value

A vector of length nmis with imputations.

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.