Learn R Programming

imputeLCMD (version 2.0)

impute.wrapper.KNN: Wrapper function for KNN imputation.

Description

This function is a wrapper around the impute.knn function from impute package that performs KNN imputation for a data matrix containing missing entries.

Usage

impute.wrapper.KNN(dataSet.mvs, K)

Arguments

dataSet.mvs

A data matrix containing left-censored missing entries.

K

T he number of neighbors used to infer the missing data.

Value

A complete expression data matrix with missing values imputed.

Details

Requires impute package.

References

Hastie, T., Tibshirani, R., Sherlock, G., Eisen, M., Brown, P. and Botstein, D., Imputing Missing Data for Gene Expression Arrays, Stanford University Statistics Department Technical report (1999), http://www-stat.stanford.edu/~hastie/Papers/missing.pdf

Olga Troyanskaya, Michael Cantor, Gavin Sherlock, Pat Brown, Trevor Hastie, Robert Tibshirani, David Botstein and Russ B. Altman, Missing value estimation methods for DNA microarrays BIOINFORMATICS Vol. 17 no. 6, 2001 Pages 520-525

See Also

impute.knn, impute.wrapper.SVD, impute.wrapper.MLE

Examples

Run this code
# NOT RUN {
# generate expression data matrix

exprsDataObj = generate.ExpressionData(nSamples1 = 6, nSamples2 = 6,
                          meanSamples = 0, sdSamples = 0.2,
                          nFeatures = 1000, nFeaturesUp = 50, nFeaturesDown = 50,
                          meanDynRange = 20, sdDynRange = 1,
                          meanDiffAbund = 1, sdDiffAbund = 0.2)
exprsData = exprsDataObj[[1]]
  
# insert 15% missing data with 100% missing not at random

m.THR = quantile(exprsData, probs = 0.15)
sd.THR = 0.1
MNAR.rate = 100
exprsData.MD.obj = insertMVs(exprsData,m.THR,sd.THR,MNAR.rate)
exprsData.MD = exprsData.MD.obj[[2]]

# perform missing data imputation
  
exprsData.imputed = impute.wrapper.KNN(exprsData.MD,15)

## The function is currently defined as
function (dataSet.mvs, K) 
{
    resultKNN = impute.knn(dataSet.mvs, k = K, rowmax = 0.99, 
        colmax = 0.99, maxp = 1500, rng.seed = sample(1:1000, 
            1))
    dataSet.imputed = resultKNN[[1]]
    return(dataSet.imputed)
  }
# }

Run the code above in your browser using DataLab