Description Details Author(s) See Also Examples
Fast Rank-Based Independence Testing
The package independence
provides three ranking-based nonparametric tests
for the independence of two continuous variables X and Y:
the classical Hoeffding's D test:
hoeffding.D.test
a refined variant of it, named R:
hoeffding.refined.test
the Bergsma-Dassios T* sign covariance:
tau.star.test
The first test is consistent assuming an absolutely continuous joint distribution, i.e., the population coefficient D=0 iff the variables are independent. The latter two are consistent under no restriction on the distribution.
Given an iid sample (X1,Y1),...,(Xn,Yn), all three statistics are computed in time O(n log n) improving upon previous implementations. The statistics R and T* are computed by a new algorithm, following work of Even-Zohar and Leng. It is based on the fast counting of certain patterns in the permutation that relates the ranks of X and Y. See [arxiv:2010.09712] and references therein.
Chaim Even-Zohar <chaim@ucdavis.edu>
tau.star.test
,
hoeffding.D.test
,
hoeffding.refined.test
relative.order
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | library(independence)
## independent
set.seed(123)
xs = rnorm(10000)
ys = rnorm(10000)
hoeffding.D.test(xs,ys)
hoeffding.refined.test(xs,ys)
tau.star.test(xs,ys)
## dependent, even though uncorrelated
set.seed(123)
xs = rnorm(10000,0,3001:13000)
ys = rnorm(10000,0,3001:13000)
hoeffding.D.test(xs,ys)
hoeffding.refined.test(xs,ys)
tau.star.test(xs,ys)
## dependent but not absolutely continuous, fools Hoeffding's D
set.seed(123)
xs = runif(200)
f = function(x,y) ifelse(x>y, pmin(y,x/2), pmax(y,(x+1)/2))
ys = f(xs,runif(200))
hoeffding.D.test(xs,ys)
hoeffding.refined.test(xs,ys)
tau.star.test(xs,ys)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.