wNNSel.impute {wNNSel} | R Documentation |
Weighted Nearest Neighbor Imputation of Missing Values using Selected Variables
Description
This function imputes the missing values using user-spefied values of the tuning parameters. It also works when the samples are smaller than the covariates.
Usage
wNNSel.impute(x, k, useAll = TRUE, x.initial = NULL, x.dist = "euclidean",
kernel = "gaussian", lambda = 0.3, impute.fn, convex = TRUE,
method = "2", m = 2, c = 0.3, withinFolds = FALSE, folds,
verbose = TRUE, verbose2 = FALSE)
Arguments
x |
a |
k |
an optional, the number of nearest neighbors to use for imputation. |
useAll |
|
x.initial |
an optional. A complete data matrix e.g. using mean imputation of |
x.dist |
distance to compute. The default is |
kernel |
kernel function to be used in nearest neighbors imputation. Default kernel function is "gaussian". |
lambda |
|
impute.fn |
the imputation function to run on the length k vector of values for a missing feature.
Defaults to a weighted mean of the neighboring values, weighted by the specified |
convex |
logical. If |
method |
convex function, performs selection of variables. If |
m |
|
c |
|
withinFolds |
|
folds |
a |
verbose |
logical. If |
verbose2 |
logical. If |
Details
For each sample, identify missinng features. For each missing feature find the nearest neighbors which have that feature. Impute the missing value using the imputation function on the selected vector of values found from the neighbors.
Value
imputed data matrix
See Also
Examples
set.seed(3)
x = matrix(rnorm(100),10,10)
x.miss = x > 1
x[x.miss] = NA
wNNSel.impute(x)
wNNSel.impute(x, lambda=0.5, m=2)