tPCA: PCA for Tensor-Valued Observations

Description Usage Arguments Details Value Author(s) References Examples

View source: R/tPCA.R

Description

Computes the tensorial principal components.

Usage

1
tPCA(x, p = NULL, d = NULL)

Arguments

x

Numeric array of an order at least three. It is assumed that the last dimension corresponds to the sampling units.

p

A vector of the percentages of variation per each mode the principal components should explain.

d

A vector of the exact number of components retained per each mode. At most one of this and the previous argument should be supplied.

Details

The observed tensors (array) X of size p_1 x p_2 x ... x p_r measured on N units are projected from each mode on the eigenspaces of the m-mode covariance matrices of the corresponding modes. As in regular PCA, by retaining only some subsets of these projections (indices) with respective sizes d_1, d_2, ... d_r, a dimension reduction can be carried out, resulting into observations tensors of size d_1 x d_2 x ... x d_r. In R the sample of X is saved as an array of dimensions p_1, p_2, ..., p_r, N.

Value

A list containing the following components:

S

Array of the same size as x containing the principal components.

U

List containing the rotation matrices

D

List containing the amounts of variance explained by each index in each mode.

p_comp

The percentages of variation per each mode that the principal components explain.

Xmu

The data location.

Author(s)

Joni Virta

References

Virta, J., Taskinen, S. and Nordhausen, K. (2016), Applying fully tensorial ICA to fMRI data, Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE,
doi: 10.1109/SPMB.2016.7846858

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Digit data example

data(zip.train)
x <- zip.train

rows <- which(x[, 1] == 0 | x[, 1] == 1)
x0 <- x[rows, 2:257]
y0 <- x[rows, 1] + 1

x0 <- t(x0)
dim(x0) <- c(16, 16, 2199)


tpca <- tPCA(x0, d = c(2, 2))
pairs(t(apply(tpca$S, 3, c)), col=y0)

Example output

Loading required package: JADE
Loading required package: fICA
Registered S3 method overwritten by 'GGally':
  method from   
  +.gg   ggplot2
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 

tensorBSS documentation built on June 2, 2021, 9:08 a.m.