dcor.independence.distance_correlation_t_test

distance_correlation_t_test(x, y)[source]

Test of independence for high dimension.

It is based on convergence to a Student t distribution. The null hypothesis is that the two random vectors are independent.

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

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

Returns

Results of the hypothesis test.

Return type

HypothesisTest[T]

See also

distance_correlation_t_statistic

Examples

>>> import numpy as np
>>> import dcor
>>> a = np.array([[1, 2, 3, 4],
...               [5, 6, 7, 8],
...               [9, 10, 11, 12],
...               [13, 14, 15, 16]])
>>> b = np.array([[1, 0, 0, 1],
...               [0, 1, 1, 1],
...               [1, 1, 1, 1],
...               [1, 1, 0, 1]])
>>> with np.errstate(divide='ignore'):
...     dcor.independence.distance_correlation_t_test(a, a)
...                                      
HypothesisTest(pvalue=0.0, statistic=inf)
>>> dcor.independence.distance_correlation_t_test(a, b)
...                                      
HypothesisTest(pvalue=0.6327451..., statistic=-0.4430164...)
>>> with np.errstate(divide='ignore'):
...     dcor.independence.distance_correlation_t_test(b, b)
...                                      
HypothesisTest(pvalue=0.0, statistic=inf)