pca.mvreplace: Replace missing values in data

Description Usage Arguments Details Value Author(s) References Examples

View source: R/pca.R

Description

pca.mvreplace is used to replace missing values in a data matrix with approximated by iterative PCA decomposition.

Usage

1
2
pca.mvreplace(x, center = T, scale = F, maxncomp = 7,
  expvarlim = 0.95, covlim = 10^-6, maxiter = 100)

Arguments

x

a matrix with data, containing missing values.

center

logical, do centering of data values or not.

scale

logical, do standardization of data values or not.

maxncomp

maximum number of components in PCA model.

expvarlim

minimum amount of variance, explained by chosen components (used for selection of optimal number of components in PCA models).

covlim

convergence criterion.

maxiter

maximum number of iterations if convergence criterion is not met.

Details

The function uses iterative PCA modeling of the data to approximate and impute missing values. The result is most optimal for data sets with low or moderate level of noise and with number of missing values less than 10% for small dataset and up to 20% for large data.

Value

Returns the same matrix x where missing values are replaced with approximated.

Author(s)

Sergey Kucheryavskiy ([email protected])

References

Philip R.C. Nelson, Paul A. Taylor, John F. MacGregor. Missing data methods in PCA and PLS: Score calculations with incomplete observations. Chemometrics and Intelligent Laboratory Systems, 35 (1), 1996.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(mdatools)

## A very simple example of imputing missing values in a data with no noise

# generate a matrix with values
s = 1:6
odata = cbind(s, 2*s, 4*s)

# make a matrix with missing values
mdata = odata
mdata[5, 2] = mdata[2, 3] = NA

# replace missing values with approximated
rdata = pca.mvreplace(mdata, scale = TRUE)

# show all matrices together
show(cbind(odata, mdata, round(rdata, 2)))

svkucheryavski/mdatools documentation built on Aug. 27, 2019, 4:38 a.m.