impute.mean: Attribute Wise Mean Imputation

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/HotDeckImputation.R

Description

This function imputes the column mean of the complete cases for the missing cases. Utilized by impute.NN_HD as a method for dealing with missing values in distance calculation.

Usage

1
impute.mean(DATA = NULL)

Arguments

DATA

Data with missing values.

Value

Returns an imputed data matrix with the same dimensions as DATA.

Author(s)

Dieter William Joenssen Dieter.Joenssen@googlemail.com

References

Little, R.J.A and Rubin, D.B. (2002) Statistical Analysis with Missing Data. Hoboken: Wiley.

Joenssen, D.W. (2015) Hot-Deck-Verfahren zur Imputation fehlender Daten – Auswirkungen des Donor-Limits. Ilmenau: Ilmedia. [in German, Dissertation]

See Also

impute.NN_HD

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#Set the random seed to an arbitrary number
set.seed(421)

#Generate matrix of random integers
Y<-matrix(sample(0:9,replace=TRUE,size=6*3),nrow=6)

#generate 6 missing values, MCAR, in all but the first row
Y[-1,][sample(1:12,size=6)]<-NA

#Impute the colMeans of Y
impute.mean(DATA=Y)

Example output

     [,1]     [,2] [,3]
[1,]  7.0 9.000000  2.0
[2,]  1.0 5.666667  7.0
[3,]  5.5 5.000000  4.2
[4,]  5.5 5.666667  4.0
[5,]  8.0 3.000000  3.0
[6,]  6.0 5.666667  5.0

HotDeckImputation documentation built on May 2, 2019, 6:41 a.m.