reduce_pca: Principal component analysis (PCA)

Description Usage Arguments Value References See Also Examples

Description

Apply PCA to a matrix or poplin object. For the data without missing values, PCA is performed via singular value decomposition. Otherwise, PCA is performed using the non-linear iterative partial least squares (NIPALS) algorithm via the nipalsPca function from the pcaMethods package. NIPALS PCA can handle a small amount of missing values.

Usage

1
2
3
4
5
## S4 method for signature 'matrix'
reduce_pca(x, ncomp = 2, center = TRUE, scale = FALSE, ...)

## S4 method for signature 'poplin'
reduce_pca(x, xin, xout, ncomp = 2, center = TRUE, scale = FALSE, ...)

Arguments

x

A matrix or poplin object.

ncomp

Output dimensionality.

center

Logical indicating mean-centering prior to PCA.

scale

Logical indicating unit variance scaling prior to PCA.

...

Additional arguments passed to nipalsPca.

xin

Character specifying the name of data to retrieve from x when x is a poplin object.

xout

character specifying the name of data to store in x when x is a poplin object.

Value

A poplin.pca or poplin object with the same number of rows as ncol(x) containing the dimension reduction result. poplin.pca is a matrix containing custom attributes used to summarize and visualize the PCA result.

References

Wold, H. (1966). Estimation of principal components and related models by iterative least squares. In P. R. Krishnajah (Ed.), Multivariate analysis (pp. 391-420). NewYork: Academic Press.

See Also

Other data reduction methods: poplin_reduce(), reduce_plsda(), reduce_tsne()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(faahko_poplin)

## poplin object
out <- reduce_pca(faahko_poplin, xin = "knn_cyclic", xout = "pca")
summary(poplin_reduced(out, "pca"))

## matrix
m <- poplin_data(faahko_poplin, "knn_cyclic")
out <- reduce_pca(m, ncomp = 3)
summary(out)

jaehyunjoo/poplin documentation built on Jan. 8, 2022, 1:13 a.m.