PCA {fMRItools}R Documentation

PCA for tall matrix

Description

Efficient PCA for a tall matrix (many more rows than columns). Uses the SVD of the covariance matrix. The dimensionality of the result can be preset with Q or estimated with PESEL.

Usage

PCA(X, center = TRUE, Q = NULL, Q_max = 100, Vdim = 0)

Arguments

X

The tall numeric matrix for which to compute the PCA. For fMRI data, X should be V brain locations by T timepoints.

center

Center the columns of X? Default: TRUE. Set to FALSE if already centered. Centered data is required to compute PCA.

Q

Number of latent dimensions to estimate. If NULL (default), estimated using PESEL (Sobczyka et al. 2020).

Q_max

Maximal number of principal components for automatic dimensionality selection with PESEL. Default: 100.

Vdim

Number of principal directions to obtain. Default: 0. Can also be "Q" to set equal to the value of Q. Note that setting this value less than Q does not speed up computation time, but does save on memory. Note that the directions will be with respect to X, not its covariance matrix.

Value

The SVD decomposition

Examples

U <- matrix(rnorm(900), nrow=300, ncol=3)
V <- matrix(rnorm(15), nrow=3, ncol=5)
PCA(U %*% V)

[Package fMRItools version 0.4.2 Index]