impute.nipals: Impute missing values using NIPALS algorithm

View source: R/impute.nipals.R

impute.nipalsR Documentation

Impute missing values using NIPALS algorithm

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

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

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

mixOmicsTeam/mixOmics documentation built on Nov. 4, 2024, 8:56 a.m.