Learn R Programming

rminer (version 1.1)

imputation: Missing data imputation (e.g. substitution by value or hotdeck method).

Description

Missing data imputation (e.g. substitution by value or hotdeck method).

Usage

imputation(imethod = "value", D, Attribute = NULL, Missing = NA, Value = 1)

Arguments

imethod
imputation method type:
  • value-- substitutes missing data byValue(with single element or several elements);
  • hotdeck-- searches first the most similar example (i.e. using a k-nearest ne
D
dataset with missing data (data.frame)
Attribute
if NULL then all attributes (data columns) with missing data are replaced. Else, Attribute is the attribute number (numeric) or name (character).
Missing
missing data symbol
Value
the substitution value (if imethod=value) or number of neighbors (k of knn).

Value

  • A data.frame without missing data.

Details

Check the references.

References

M. Brown and J. Kros. Data mining and the impact of missing data. In Industrial Management & Data Systems, 103(8):611-621, 2003.

See Also

fit, factorize and delevels.

Examples

Run this code
d=matrix(ncol=5,nrow=5)
d[1,]=c(5,4,3,2,1)
d[2,]=c(4,3,4,3,4)
d[3,]=c(1,1,1,1,1)
d[4,]=c(4,NA,3,4,4)
d[5,]=c(5,NA,NA,2,1)
d=data.frame(d); d[,3]=factor(d[,3])
print(d)
print(imputation("value",d,3,Value="3"))
print(imputation("value",d,2,Value=median(na.omit(d[,2]))))
print(imputation("value",d,2,Value=c(1,2)))
print(imputation("hotdeck",d,"X2",Value=1))
print(imputation("hotdeck",d,Value=1))

Run the code above in your browser using DataLab