Distance correlation


In statistics and in probability theory, distance correlation or distance covariance is a measure of dependence between two paired random vectors of arbitrary, not necessarily equal, dimension. The population distance correlation coefficient is zero if and only if the random vectors are independent. Thus, distance correlation measures both linear and nonlinear association between two random variables or random vectors. This is in contrast to Pearson's correlation, which can only detect linear association between two random variables.
Distance correlation can be used to perform a statistical test of dependence with a permutation test. One first computes the distance correlation between two random vectors, and then compares this value to the distance correlations of many shuffles of the data.

Background

The classical measure of dependence, the Pearson correlation coefficient, is mainly sensitive to a linear relationship between two variables. Distance correlation was introduced in 2005 by Gábor J. Székely in several lectures to address this deficiency of Pearson's correlation, namely that it can easily be zero for dependent variables. Correlation = 0 does not imply independence while distance correlation = 0 does imply independence. The first results on distance correlation were published in 2007 and 2009. It was proved that distance covariance is the same as the Brownian covariance. These measures are examples of energy distances.
The distance correlation is derived from a number of other quantities that are used in its specification, specifically: distance variance, distance standard deviation, and distance covariance. These quantities take the same roles as the ordinary moments with corresponding names in the specification of the Pearson product-moment correlation coefficient.

Definitions

Distance covariance

Let us start with the definition of the sample distance covariance. Let, k = 1, 2,..., n be a statistical sample from a pair of real valued or vector valued random variables. First, compute the n by n distance matrices and containing all pairwise distances
where ||⋅ ||denotes Euclidean norm. Then take all doubly centered distances
where is the -th row mean, is the -th column mean, and is the grand mean of the distance matrix of the X sample. The notation is similar for the b values. and The squared sample distance covariance is simply the arithmetic average of the products Aj, k Bj, k:
The statistic Tn = n dCov2n determines a consistent multivariate test of independence of random vectors in arbitrary dimensions. For an implementation see dcov.test function in the energy package for R.
The population value of distance covariance can be defined along the same lines. Let X be a random variable that takes values in a p-dimensional Euclidean space with probability distribution and let Y be a random variable that takes values in a q-dimensional Euclidean space with probability distribution, and suppose that X and Y have finite expectations. Write
Finally, define the population value of squared distance covariance of X and Y as
One can show that this is equivalent to the following definition:
where E denotes expected value, and and are independent and identically distributed. The primed random variables and denote
independent and identically distributed copies of the variables and and are similarly iid. Distance covariance can be expressed in terms of the classical Pearson's covariance,
cov, as follows:
This identity shows that the distance covariance is not the same as the covariance of distances, ). This can be zero even if X and Y are not independent.
Alternatively, the distance covariance can be defined as the weighted L2 norm of the distance between the joint characteristic function of the random variables and the product of their marginal characteristic functions:
where,, and are the characteristic functions of X, and Y, respectively, p, q denote the Euclidean dimension of X and Y, and thus of s and t, and cp, cq are constants. The weight function is chosen to produce a scale equivariant and rotation invariant measure that doesn't go to zero for dependent variables. One interpretation of the characteristic function definition is that the variables eisX and eitY are cyclic representations of X and Y with different periods given by s and t, and the expression in the numerator of the characteristic function definition of distance covariance is simply the classical covariance of eisX and eitY. The characteristic function definition clearly shows that
dCov2 = 0 if and only if X and Y are independent.

Distance variance and distance standard deviation

The distance variance is a special case of distance covariance when the two variables are identical. The population value of distance variance is the square root of
where denotes the expected value, is an independent and identically distributed copy of and is independent of and and has the same distribution as and.
The sample distance variance is the square root of
which is a relative of Corrado Gini's mean difference introduced in 1912.
The distance standard deviation is the square root of the distance variance.

Distance correlation

The distance correlation of two random variables is obtained by dividing their distance covariance by the product of their distance standard deviations. The distance correlation is
and the sample distance correlation is defined by substituting the sample distance covariance and distance variances for the population coefficients above.
For easy computation of sample distance correlation see the dcor function in the energy package for R.

Properties

Distance correlation

Distance covariance

This last property is the most important effect of working with centered distances.
The statistic is a biased estimator of. Under independence of X and Y
An unbiased estimator of is given by Székely and Rizzo.

Distance variance

Equality holds in if and only if one of the random variables or is a constant.

Generalization

Distance covariance can be generalized to include powers of Euclidean distance. Define
Then for every, and are independent if and only if. It is important to note that this characterization does not hold for exponent ; in this case for bivariate, is a deterministic function of the Pearson correlation. If and are powers of the corresponding distances,, then sample distance covariance can be defined as the nonnegative number for which
One can extend to metric-space-valued random variables and : If has law in a metric space with metric, then define,, and,. Then if has law , define
This is non-negative for all such iff both metric spaces have negative type. Here, a metric space has negative type if is isometric to a subset of a Hilbert space. If both metric spaces have strong negative type, then iff are independent.

Alternative definition of distance covariance

The original distance covariance has been defined as the square root of, rather than the squared coefficient itself. has the property that it is the energy distance between the joint distribution of and the product of its marginals. Under this definition, however, the distance variance, rather than the distance standard deviation, is measured in the same units as the distances.
Alternately, one could define distance covariance to be the square of the energy distance:
In this case, the distance standard deviation of is measured in the same units as distance, and there exists an unbiased estimator for the population distance covariance.
Under these alternate definitions, the distance correlation is also defined as the square, rather than the square root.

Alternative formulation: Brownian covariance

Brownian covariance is motivated by generalization of the notion of covariance to stochastic processes. The square of the covariance of random variables X and Y can be written in the following form:
where E denotes the expected value and the prime denotes independent and identically distributed copies. We need the following generalization of this formula. If U, V are arbitrary random processes defined for all real s and t then define the U-centered version of X by
whenever the subtracted conditional expected value exists and denote by YV the V-centered version of Y. The covariance of is defined as the nonnegative number whose square is
whenever the right-hand side is nonnegative and finite. The most important example is when U and V are two-sided independent Brownian motions /Wiener processes with expectation zero and covariance . In this case the covariance is called Brownian covariance and is denoted by
There is a surprising coincidence: The Brownian covariance is the same as the distance covariance:
and thus Brownian correlation is the same as distance correlation.
On the other hand, if we replace the Brownian motion with the deterministic identity function id then Covid is simply the absolute value of the classical Pearson covariance,

Related metrics

Other correlational metrics, including kernel-based correlational metrics can also detect linear and nonlinear interactions. Both distance correlation and kernel-based metrics can be used in methods such as canonical correlation analysis and independent component analysis to yield stronger statistical power.