Impute missing values using NIPALS algorithm
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.
impute.nipals(X, ncomp, ...)
A numeric matrix with missing values imputed.
Al J Abadi
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.valuesPlease choose more modern alternatives, such as Google Chrome or Mozilla Firefox.