impute.nipals: Impute missing values using NIPALS algorithm

Description Usage Arguments Value Author(s) See Also Examples

View source: R/impute.nipals.R

Description

This function uses nipals function to decompose X into a set of components (t), (pseudo-) singular-values (eig), and feature loadings (p). The original matrix is then approximated/reconstituted using the following equation:

\hat{X} = t * diag(eig) * t(p)

The missing values from X are then approximated from this matrix. It is best to ensure enough number of components are used in order to best impute the missing values.

Usage

1
impute.nipals(X, ncomp, ...)

Arguments

X

A numeric matrix containing missing values

ncomp

Positive integer, the number of components to derive from X using the nipals function and reconstitute the original matrix

...

Optional arguments passed to nipals

Value

A numeric matrix with missing values imputed.

Author(s)

Al J Abadi

See Also

impute.nipals, pca

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data("nutrimouse")
X <- data.matrix(nutrimouse$lipid)
## add missing values to X to impute and compare to actual values
set.seed(42)
na.ind <- sample(seq_along(X), size = 10)
true.values <- X[na.ind]
X[na.ind] <- NA
X.impute <- impute.nipals(X = X, ncomp = 5)
## compare
round(X.impute[na.ind], 2)
true.values

mixOmics documentation built on April 15, 2021, 6:01 p.m.