Learn R Programming

dprep (version 3.0.2)

ce.mimp: Mean or median imputation

Description

A function that detects the location of missing values by class, then imputes the missing values that occur in the features, using mean or median imputation, as selected by the user. If the feature is nominal then imputation is done using the mode.

Usage

ce.mimp(w.cl, method = c("mean", "median"), atr, nomatr = 0)

Arguments

w.cl
dataset with missing values.
method
either "mean" or "median"
atr
list of relevant features
nomatr
list of nominal features, imputation is done using mode

Value

w.cl
the original matrix with values imputed

References

Acuna, E. and Rodriguez, C. (2004). The treatment of missing values and its effect in the classifier accuracy. In D. Banks, L. House, F.R. McMorris, P. Arabie, W. Gaul (Eds). Classification, Clustering and Data Mining Applications. Springer-Verlag Berlin-Heidelberg, 639-648.

Examples

Run this code
data(hepatitis)
#--------Mean Imputation---------- 
hepa.mean.imp=ce.impute(hepatitis,"mean",1:19)

Run the code above in your browser using DataLab