# distance_correlation_af_inv_sqr#

distance_correlation_af_inv_sqr(x, y, method=DistanceCovarianceMethod.AUTO, compile_mode=CompileMode.AUTO)[source]#

Square of the affinely invariant distance correlation.

Computes the estimator for the square of the affinely invariant distance correlation between two random vectors.

Warning

The return value of this function is undefined when the covariance matrix of $$x$$ or $$y$$ is singular.

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

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

• method (Union[DistanceCovarianceMethod, Literal['auto', 'naive', 'avl', 'mergesort']]) – Method to use internally to compute the distance covariance.

• compile_mode (CompileMode) – Compilation mode used. By default it tries to use the fastest available type of compilation.

Returns

Value of the estimator of the squared affinely invariant distance correlation.

Return type

Array

distance_correlation u_distance_correlation

Examples

>>> import numpy as np
>>> import dcor
>>> a = np.array([[1., 3., 2., 5.],
...               [5., 7., 6., 8.],
...               [9., 10., 11., 12.],
...               [13., 15., 15., 16.]])
>>> b = np.array([[1.], [0.], [0.], [1.]])
>>> dcor.distance_correlation_af_inv_sqr(a, a)
1.0
>>> dcor.distance_correlation_af_inv_sqr(a, b)
0.5773502...
>>> dcor.distance_correlation_af_inv_sqr(b, b)
1.0