dcov: Distance variance, covariance and correlation

View source: R/distance_cov_cor.R

Distance variance, covariance and correlationR Documentation

Distance variance, covariance and correlation

Description

Distance variance, covariance and correlation.

Usage

dvar(x, bc = FALSE)
dcov(x, y, bc = FALSE)
dcor(x, y, bc = FALSE)
bcdcor(x, y)

Arguments

x

A numerical matrix or a vector.

y

A numerical matrix or a vector.

bc

If you want the bias-corrected distance correlation set this equal to TRUE.

Details

The distance variance of a matrix/vector, the distance covariance or distance correlation of two matrices is calculated. For the distance variance of a vector we use the fast method of Huo and Szekely (2016).

Value

The distance covariance or the distance variance.

For the bias corrected distance correlation its value only.

For the distance correlation a list including:

dcov

The distance covariance.

dvarX

The distance variance of x.

dvarY

The distance variance of Y.

dcor

The distance correlation.

Author(s)

Michail Tsagris and Manos Papadakis.

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>.

References

Szekely G.J., Rizzo M.L. and Bakirov N.K.(2007). Measuring and Testing Independence by Correlation of Distances. Annals of Statistics, 35(6):2769–2794.

Szekely G. J. and Rizzo M. L. (2023). The Energy of Data and Distance Correlation. Chapman and Hall/CRC.

Tsagris M. and Papadakis M. (2025). Fast and light-weight energy statistics using the R package Rfast. https://arxiv.org/abs/2501.02849

See Also

pdcor, dcor.ttest, edist

Examples

x <- as.matrix(iris[1:50, 1:4])
y <- as.matrix(iris[51:100, 1:4])
res <- dvar(x[, 1])
#dcor(x, y)

Rfast documentation built on April 3, 2025, 11:34 p.m.