Description Usage Arguments Details Value See Also Examples
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.
1 2 3 4 |
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 |
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.
imputed data matrix
1 2 3 4 5 6 | 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)
|
[1] "Computing distance matrix..."
[1] "Distance matrix complete"
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] -0.96193342 -0.7447816 -0.57848372 0.90062473 0.7865069 0.7268389
[2,] -0.29252572 -1.1312186 -0.94230073 0.85177045 -0.3104631 -0.8094409
[3,] 0.25878822 -0.7163585 -0.20372818 0.72771517 -0.4247951 0.2670851
[4,] -1.15213189 0.2526524 -1.66647484 0.73650215 -0.7945937 -1.7372637
[5,] 0.19578283 0.1520457 -0.48445511 -0.35212962 0.3484377 -1.4114251
[6,] 0.03012394 -0.3076564 -0.74107266 0.70551551 -2.2654011 -0.4535512
[7,] 0.08541773 -0.9530173 -0.80491293 0.48882153 -0.1622053 -1.0354913
[8,] -0.33290860 -0.6482428 -1.01859623 0.03825201 -0.5260079 -0.5805169
[9,] -1.21885742 -0.5151061 -0.07207847 -0.97928377 -0.4555460 0.9174567
[10,] -0.33939445 0.1998116 -1.13678230 0.79376123 -0.8991663 -0.7851422
[,7] [,8] [,9] [,10]
[1,] 0.57351817 -0.0313255 -0.024515176 -0.85381845
[2,] 0.91819621 0.4670973 -0.352298306 -0.98999433
[3,] 0.25628727 0.2754801 0.688640044 -0.65087774
[4,] 0.35196656 0.2673585 -0.284981169 -0.34383795
[5,] 0.08818601 0.2318261 0.794296303 -0.39087803
[6,] -0.48084638 0.7475925 -0.006402398 -0.07058639
[7,] -0.41882972 0.2565972 0.219150635 -0.46205081
[8,] 0.95511280 0.3833583 -0.886463751 0.54090827
[9,] -1.28900661 -0.9880528 0.439760291 0.93163497
[10,] 0.18619743 -0.1568529 -0.886389751 -0.20927435
[1] "Computing distance matrix..."
[1] "Distance matrix complete"
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] -0.96193342 -0.7447816 -0.57848372 0.90062473 0.7865069 0.7268389
[2,] -0.29252572 -1.1312186 -0.94230073 0.85177045 -0.3104631 -0.8094409
[3,] 0.25878822 -0.7163585 -0.20372818 0.72771517 -0.4535578 0.2670851
[4,] -1.15213189 0.2526524 -1.66647484 0.73650215 -0.7945937 -1.7372637
[5,] 0.19578283 0.1520457 -0.48445511 -0.35212962 0.3484377 -1.4114251
[6,] 0.03012394 -0.3076564 -0.74107266 0.70551551 -2.2654011 -0.4535512
[7,] 0.08541773 -0.9530173 -0.77147803 0.43836195 -0.1622053 -1.0354913
[8,] -0.35832845 -0.6482428 -0.87243770 0.03825201 -0.4898775 -0.5296372
[9,] -1.21885742 -0.4692480 -0.07207847 -0.97928377 -0.4555460 0.9174567
[10,] -0.36438973 0.1998116 -1.13678230 0.79376123 -0.8991663 -0.7851422
[,7] [,8] [,9] [,10]
[1,] 0.5735182 -0.0313255 -0.013295527 -0.85381845
[2,] 0.9181962 0.4670973 -0.352298306 -0.98999433
[3,] 0.2562873 0.1966778 0.688640044 -0.65087774
[4,] 0.3519666 0.2673585 -0.122058930 -0.31127665
[5,] 0.1109909 0.2318261 0.794296303 -0.39087803
[6,] -0.4808464 0.7475925 -0.006402398 -0.07058639
[7,] -0.4188297 0.1940539 0.219150635 -0.46205081
[8,] 0.9551128 0.3833583 -0.886463751 0.54090827
[9,] -1.2890066 -0.9880528 0.439760291 0.93163497
[10,] 0.1861974 -0.1568529 -0.886389751 -0.20927435
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.