impute_median {simputation} | R Documentation |
Impute (group-wise) medians
Description
Impute medians of group-wise medians.
Usage
impute_median(
dat,
formula,
add_residual = c("none", "observed", "normal"),
type = 7,
...
)
Arguments
dat |
|
formula |
|
add_residual |
|
type |
|
... |
Currently not used. |
Model Specification
Formulas are of the form
IMPUTED_VARIABLES ~ MODEL_SPECIFICATION [ | GROUPING_VARIABLES ]
The left-hand-side of the formula object lists the variable or variables to
be imputed. Variables in MODEL_SPECIFICATION
and/or
GROUPING_VARIABLES
are used to split the data set into groups prior to
imputation. Use ~ 1
to specify that no grouping is to be applied.
Examples
# group-wise median imputation
irisNA <- iris
irisNA[1:3,1] <- irisNA[4:7,2] <- NA
a <- impute_median(irisNA, Sepal.Length ~ Species)
head(a)
# group-wise median imputation, all variables except species
a <- impute_median(irisNA, . - Species ~ Species)
head(a)