tensorCentering {tensorBSS}R Documentation

Center an Array of Observations

Description

Centers an array of array-valued observations by substracting a location array (the mean array by default) from each observation.

Usage

tensorCentering(x, location = NULL)

Arguments

x

Array of order at least two with the last dimension corresponding to the sampling units.

location

The location to be used in the centering. Either NULL, defaulting to the mean array, or a user-specified p_1 \times p_2 \times \ldots \times p_r-dimensional array.

Details

Centers a p_1 \times p_2 \times \ldots \times p_r \times n-dimensional array by substracting the p_1 \times p_2 \times \ldots \times p_r-dimensional location from each of the observed arrays.

Value

Array of centered observations with the same dimensions as the input array. The used location is returned as attribute "location".

Author(s)

Joni Virta

Examples

## Generate sample data.
n <- 1000
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)

## Centered data
xcen <- tensorCentering(x)

## Check the means of individual cells
apply(xcen, 1:2, mean)

[Package tensorBSS version 0.3.8 Index]