# nipals: Non-linear Iterative Partial Least Squares (NIPALS) algorithm In mixOmics: Omics Data Integration Project

## Description

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

## Usage

 `1` ```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.

## 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.

## Value

The returned value is a list with components:

 `eig` vector containing the pseudosingular values of `X`, of length `ncomp`. `t` matrix whose columns contain the left singular vectors of `X`. `p` matrix whose columns contain the right singular vectors of `X`. Note that for a complete data matrix X, the return values `eig`, `t` and `p` such that `X = t * diag(eig) * t(p)`. `rec` matrix obtained by the reconstitution of the data using the `ncomp` components.

## Author(s)

Sébastien Déjean and Ignacio González.

## References

Tenenhaus, M. (1998). La regression PLS: theorie 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.mixOmics.org for more details.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```## 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) ```

### Example output

```Loading required package: MASS
Loading required package: lattice
Loading required package: ggplot2

Loaded mixOmics 6.1.3

Visit http://www.mixOmics.org for more details about our methods.
Any bug reports or comments? Notify us at mixomics at math.univ-toulouse.fr or https://bitbucket.org/klecao/package-mixomics/issues

Thank you for using mixOmics!
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE
3: .onUnload failed in unloadNamespace() for 'rgl', details:
call: fun(...)
error: object 'rgl_quit' not found
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1.00 0.50 0.33 0.25 0.20 0.17
[2,] 0.50 0.33 0.25 0.20 0.17 0.14
[3,] 0.33 0.25 0.20 0.17 0.14 0.12
[4,] 0.25 0.20 0.17 0.14 0.12 0.11
[5,] 0.20 0.17 0.14 0.12 0.11 0.10
[6,] 0.17 0.14 0.12 0.11 0.10 0.09
[7,] 0.14 0.12 0.11 0.10 0.09 0.08
[8,] 0.12 0.11 0.10 0.09 0.08 0.08
[9,] 0.11 0.10 0.09 0.08 0.08 0.07
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0.92 0.54 0.40 0.38 0.26 0.23
[2,] 0.55 0.32 0.24 0.23 0.16 0.14
[3,] 0.38 0.22 0.17 0.16 0.11 0.09
[4,] 0.30 0.18 0.13 0.12 0.09 0.07
[5,] 0.25 0.15 0.11 0.10 0.07 0.06
[6,] 0.22 0.13 0.09 0.09 0.06 0.05
[7,] 0.19 0.11 0.08 0.08 0.06 0.05
[8,] 0.16 0.09 0.07 0.07 0.05 0.04
[9,] 0.15 0.09 0.06 0.06 0.04 0.04
```

mixOmics documentation built on June 1, 2018, 5:06 p.m.