partial_distance_correlation#

partial_distance_correlation(x, y, z)[source]#

Partial distance correlation estimator.

Compute the estimator for the partial distance correlation of the random vectors corresponding to \(x\) and \(y\) with respect to the random variable corresponding to \(z\).

Warning

Partial distance correlation should be used carefully as it presents some undesirable or counterintuitive properties. In particular, the reader cannot assume that \(\mathcal{R}^{*}\) characterizes independence, i.e., \(\mathcal{R}^{*}(X, Y; Z)=0\) does not always implies that \(X\) and \(Y\) are conditionally independent given \(Z\) and vice versa. A more detailed discussion and some counter examples can be found in Sec. 4.2 of Székely and Rizzo1.

Parameters
  • x (ndarray) – First random vector. The columns correspond with the individual random variables while the rows are individual instances of the random vector.

  • y (ndarray) – Second random vector. The columns correspond with the individual random variables while the rows are individual instances of the random vector.

  • z (ndarray) – Random vector with respect to which the partial distance correlation is computed. The columns correspond with the individual random variables while the rows are individual instances of the random vector.

Returns

Value of the estimator of the partial distance correlation.

Return type

ndarray

See also

partial_distance_covariance

Examples

>>> import numpy as np
>>> import dcor
>>> a = np.array([[1], [1], [2], [2], [3]])
>>> b = np.array([[1], [2], [1], [2], [1]])
>>> c = np.array([[1], [2], [2], [1], [2]])
>>> dcor.partial_distance_correlation(a, a, c)
1.0
>>> dcor.partial_distance_correlation(a, b, c) 
-0.5...
>>> dcor.partial_distance_correlation(b, b, c)
1.0
>>> dcor.partial_distance_correlation(a, c, c)
0.0

References

1

Gábor J. Székely and Maria L. Rizzo. Partial distance correlation with methods for dissimilarities. The Annals of Statistics, 42(6):2382–2412, 12 2014. URL: https://doi.org/10.1214/14-AOS1255, doi:10.1214/14-AOS1255.