tensorStandardize: Standardize an Observation Array

Description Usage Arguments Details Value Author(s) Examples

View source: R/tensorStandardize.R

Description

Standardizes an array of array-valued observations simultaneously from each mode. The method can be seen as a higher-order analogy for the regular multivariate standardization of random vectors.

Usage

1
tensorStandardize(x, location = NULL, scatter = NULL)

Arguments

x

Array of an order higher than two with the last dimension corresponding to the sampling units.

location

The location to be used in the standardizing. Either NULL, defaulting to the mean array, or a user-specified p_1 x p_2 x ... x p_r-dimensional array.

scatter

The scatter matrices to be used in the standardizing. Either NULL, defaulting to the m-mode covariance matrices, or a user-specified list of length r of p_1 x p_1 ... p_r x p_r-dimensional symmetric positive definite matrices.

Details

The algorithm first centers the n observed tensors Xi using location (either the sample mean, or a user-specified location). Then, if scatter = NULL, it estimates the mth mode covariance matrix Cov_m(X) = E(X(m) X(m)^T)/(p1 ... p(m-1) p(m+1) ... pr), where X(m) is the centered m-flattening of X, for each mode, and transforms the observations with the inverse square roots of the covariance matrices from the corresponding modes. If, instead, the user has specified a non-NULL value for scatter, the inverse square roots of those matrices are used to transform the centered data.

Value

A list containing the following components:

x

Array of the same size as x containing the standardized observations. The used location and scatters are returned as attributes "location" and "scatter".

S

List containing inverse square roots of the covariance matrices of different modes.

Author(s)

Joni Virta

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Generate sample data.
n <- 100
x <- t(cbind(rnorm(n, mean = 0),
             rnorm(n, mean = 1),
             rnorm(n, mean = 2),
             rnorm(n, mean = 3),
             rnorm(n, mean = 4),
             rnorm(n, mean = 5)))
             
dim(x) <- c(3, 2, n)

# Standardize
z <- tensorStandardize(x)$x

# The m-mode covariance matrices of the standardized tensors
mModeCovariance(z, 1)
mModeCovariance(z, 2)

Example output

Loading required package: JADE
              [,1]          [,2]         [,3]
[1,]  1.027600e+00 -0.0022687503 4.004979e-05
[2,] -2.268750e-03  1.0275941650 4.020323e-04
[3,]  4.004979e-05  0.0004020323 1.029772e+00
            [,1]        [,2]
[1,]  1.02118401 -0.00272932
[2,] -0.00272932  1.03546055

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