Description Usage Arguments Details Value Author(s) Examples
View source: R/tensorStandardize.R
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.
1 | tensorStandardize(x, location = NULL, scatter = NULL)
|
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 |
scatter |
The scatter matrices to be used in the standardizing. Either |
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.
A list containing the following components:
x |
Array of the same size as |
S |
List containing inverse square roots of the covariance matrices of different modes. |
Joni Virta
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.