dcor.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\).

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

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

  • z (array_like) – 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

numpy scalar

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