RnipalsPca: NIPALS PCA implemented in R

View source: R/nipalsPca.R

RnipalsPcaR Documentation

NIPALS PCA implemented in R

Description

PCA by non-linear iterative partial least squares

Usage

RnipalsPca(Matrix, nPcs = 2, varLimit = 1, maxSteps = 5000,
  threshold = 1e-06, verbose = interactive(), ...)

Arguments

Matrix

Pre-processed (centered, scaled) numerical matrix samples in rows and variables as columns.

nPcs

Number of components that should be extracted.

varLimit

Optionally the ratio of variance that should be explained. nPcs is ignored if varLimit < 1

maxSteps

Defines how many iterations can be done before algorithm should abort (happens almost exclusively when there were some wrong in the input data).

threshold

The limit condition for judging if the algorithm has converged or not, specifically if a new iteration is done if (T_{old} - T)^T(T_{old} - T) > \code{limit}.

verbose

Show simple progress information.

...

Only used for passing through arguments.

Details

Can be used for computing PCA on a numeric matrix using either the NIPALS algorithm which is an iterative approach for estimating the principal components extracting them one at a time. NIPALS can handle a small amount of missing values. It is not recommended to use this function directely but rather to use the pca() wrapper function. There is a C++ implementation given as nipalsPca which is faster.

Value

A pcaRes object.

Author(s)

Henning Redestig

References

Wold, H. (1966) Estimation of principal components and related models by iterative least squares. In Multivariate Analysis (Ed., P.R. Krishnaiah), Academic Press, NY, 391-420.

See Also

prcomp, princomp, pca

Examples

data(metaboliteData)
mat <- prep(t(metaboliteData))
## c++ version is faster
system.time(pc <- RnipalsPca(mat, method="rnipals", nPcs=2))
system.time(pc <- nipalsPca(mat, nPcs=2))
## better use pca()
pc <- pca(t(metaboliteData), method="rnipals", nPcs=2)


hredestig/pcaMethods documentation built on Sept. 30, 2023, 10:38 a.m.