Learn R Programming

mixOmics (version 4.1-4)

nipals: Non-linear Iterative Partial Least Squares (NIPALS) algorithm

Description

This function performs NIPALS algorithm, i.e. the singular-value decomposition (SVD) of a data table that can contain missing values.

Usage

nipals(X, ncomp = 1, reconst = FALSE, max.iter = 500, tol = 1e-09)

Arguments

X
real matrix or data frame whose SVD decomposition is to be computed. It can contain missing values.
ncomp
integer, the number of components to keep. If missing ncomp=ncol(X).
reconst
logical that specify if nipals must perform the reconstitution of the data using the ncomp components.
max.iter
integer, the maximum number of iterations.
tol
a positive real, the tolerance used in the iterative algorithm.

Value

  • The returned value is a list with components:
  • eigvector containing the pseudosingular values of X, of length ncomp.
  • tmatrix whose columns contain the left singular vectors of X.
  • pmatrix whose columns contain the right singular vectors of X.
  • recmatrix obtained by the reconstitution of the data using the ncomp components.

encoding

latin1

Details

The NIPALS algorithm (Non-linear Iterative Partial Least Squares) has been developed by H. Wold at first for PCA and later-on for PLS. It is the most commonly used method for calculating the principal components of a data set. It gives more numerically accurate results when compared with the SVD of the covariance matrix, but is slower to calculate. This algorithm allows to realize SVD with missing data, without having to delete the rows with missing data or to estimate the missing data.

References

Tenenhaus, M. (1998). La r�gression PLS: th�orie et pratique. Paris: Editions Technic. Wold H. (1966). Estimation of principal components and related models by iterative least squares. In: Krishnaiah, P. R. (editors), Multivariate Analysis. Academic Press, N.Y., 391-420. Wold H. (1975). Path models with latent variables: The NIPALS approach. In: Blalock H. M. et al. (editors). Quantitative Sociology: International perspectives on mathematical and statistical model building. Academic Press, N.Y., 307-357.

See Also

svd, princomp, prcomp, eigen and http://www.math.univ-toulouse.fr/~biostat/mixOmics/ for more details.

Examples

Run this code
## Hilbert matrix
hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, "+") }
X.na <- X <- hilbert(9)[, 1:6]

## Hilbert matrix with missing data
idx.na <- matrix(sample(c(0, 1, 1, 1, 1), 36, replace = TRUE), ncol = 6)
X.na[idx.na == 0] <- NA
X.rec <- nipals(X.na, reconst = TRUE)$rec
round(X, 2)
round(X.rec, 2)

Run the code above in your browser using DataLab