# centering: Double centering and U-centering In energy: E-Statistics: Multivariate Inference via the Energy of Data

## Description

Stand-alone double centering and U-centering functions that are applied in unbiased distance covariance, bias corrected distance correlation, and partial distance correlation.

## Usage

 1 2 3 4 Dcenter(x) Ucenter(x) U_center(Dx) D_center(Dx) 

## Arguments

 x dist object or data matrix Dx distance or dissimilarity matrix

## Details

In Dcenter and Ucenter, x must be a dist object or a data matrix. Both functions return a doubly centered distance matrix.

Note that pdcor, etc. functions include the centering operations (in C), so that these stand alone versions of centering functions are not needed except in case one wants to compute just a double-centered or U-centered matrix.

U_center is the Rcpp export of the cpp function. D_center is the Rcpp export of the cpp function.

## Value

All functions return a square symmetric matrix.

Dcenter returns a matrix

A_{ij}=a_{ij} - \bar a_{i.} - \bar a_{.j} + \bar a_{..}

as in classical multidimensional scaling. Ucenter returns a matrix

\tilde A_{ij}=a_{ij} - \frac{a_{i.}}{n-2} - \frac{a_{.j}}{n-2} + \frac{a_{..}}{(n-1)(n-2)},\quad i \neq j,

with zero diagonal, and this is the double centering applied in pdcov and pdcor as well as the unbiased dCov and bias corrected dCor statistics.

## Note

The c++ versions D_center and U_center should typically be faster. R versions are retained for historical reasons.

## Author(s)

Maria L. Rizzo mrizzo @ bgsu.edu and Gabor J. Szekely

## References

Szekely, G.J. and Rizzo, M.L. (2014), Partial Distance Correlation with Methods for Dissimilarities, Annals of Statistics, Vol. 42, No. 6, pp. 2382-2412.
https://projecteuclid.org/euclid.aos/1413810731

## Examples

 1 2 3 4 5 6 7  x <- iris[1:10, 1:4] dx <- dist(x) Dx <- as.matrix(dx) M <- U_center(Dx) all.equal(M, U_center(M)) #idempotence all.equal(M, D_center(M)) #invariance 

### Example output

[1] TRUE
[1] TRUE


energy documentation built on Feb. 22, 2021, 5:08 p.m.