prcomp: Principal Components Analysis for "matter" Matrices

prcompR Documentation

Principal Components Analysis for “matter” Matrices

Description

This method allows computation of a truncated principal components analysis of matter_mat and sparse_mat matrices using the implicitly restarted Lanczos method from the “irlba” package.

Usage

## S4 method for signature 'matter_mat'
prcomp(x, k = 3L, retx = TRUE, center = TRUE, scale. = FALSE, ...)

## S4 method for signature 'sparse_mat'
prcomp(x, k = 3L, retx = TRUE, center = TRUE, scale. = FALSE, ...)

prcomp_lanczos(x, k = 3L, retx = TRUE,
    center = TRUE, scale. = FALSE, transpose = FALSE,
    verbose = NA, BPPARAM = bpparam(), ...)

Arguments

x

A matter matrix, or any matrix-like object for prcomp_lanczos.

k

The number of principal components to return, must be less than min(dim(x)).

retx

A logical value indicating whether the rotated variables should be returned.

center

A logical value indicating whether the variables should be shifted to be zero-centered, or a centering vector of length equal to the number of columns of x. The centering is performed implicitly and does not change the out-of-memory data in x.

scale.

A logical value indicating whether the variables should be scaled to have unit variance, or a scaling vector of length equal to the number of columns of x. The scaling is performed implicitly and does not change the out-of-memory data in x.

transpose

A logical value indicating whether x should be considered transposed or not. This can be useful if the input matrix is (P x N) instead of (N x P) and storing the transpose is expensive. This is not necessary for matter_mat and sparse_mat objects, but can be useful for large in-memory (P x N) matrices.

verbose

Should progress messages be printed?

...

Additional options passed to rowStats or colStats.

BPPARAM

An optional instance of BiocParallelParam. See documentation for bplapply. Currently only used for centering and scaling. Use options(matter.matmul.bpparam=TRUE) to enable parallel matrix multiplication for matter_mat and sparse_mat matrices.

Value

An object of class ‘prcomp’. See ?prcomp for details.

Note

The built-in predict() method (from the stats package) is not compatible with the argument transpose=TRUE.

Author(s)

Kylie A. Bemis

See Also

irlba prcomp_irlba

Examples

register(SerialParam())
set.seed(1)

x <- matter_mat(rnorm(1000), nrow=100, ncol=10)

prcomp(x)

kuwisdelu/matter documentation built on Oct. 19, 2024, 10:31 a.m.