Skip to contents

Performs a distance correlation t-test of multivariate independence, based on the distance correlation t-statistic introduced by Székely and Rizzo (2013). This implementation executes the statistical approach of energy::dcorT.test, but is written in C++ for improved performance. The function supports testing for dependence between multivariate random vectors and uses a t-distribution approximation under the null hypothesis of independence. Empirical benchmarks indicate that this C++ version can be significantly faster than the original R version in the energy package, especially for larger sample sizes (e.g., 1.5–3x faster for n = 10,000).

Usage

dcor_t_test(x, y)

Arguments

x

[data.frame | matrix]
Data of the first sample.

y

[data.frame | matrix]
Data of the second sample.

Value

[list]
returns a list containing:

method

description of test.

statistic

observed value of the test statistic.

parameter

degrees of freedom.

estimate

bias corrected squared measure of distance correlation between x and y.

p.value

p-value of the t-test.

data.name

description of data.

References

Székely, G. J., & Rizzo, M. L. (2013). The distance correlation t-test of independence in high dimension. Journal of Multivariate Analysis, 117, 193–213. URL: https://doi.org/10.1016/j.jmva.2013.02.012. Székely, G. J., & Rizzo, M. L. (2014). Energy statistics: A class of statistics based on distances. Journal of Statistical Planning and Inference, 143(8), 1249–1272. URL: https://doi.org/10.1016/j.jspi.2013.03.018.

Examples

dcor_t_test(iris[, "Petal.Length"], iris[, c("Sepal.Length", "Sepal.Width")])
#> $statistic
#> [1] 132.974
#> 
#> $parameter
#> [1] 11024
#> 
#> $p.value
#> [1] 0
#> 
#> $estimate
#> [1] 0.7848375
#> 
#> $method
#> [1] "dcor t-test of independence for high dimension"
#> 
#> $data.name
#> [1] "x and y"
#>