Distance Correlation
dcor(x,y)
dcor(x,y)
x |
numeric vector |
y |
numeric vector |
Returns a numeric value: the distance correlation between x and y.
## Not run: set.seed(1) x < -rnorm(1000) y < -x ^ 2 dcor(x, y) # dcor shows dependence between x and y cor(x, y) # cor does not detect any depencence due to nonlinearity ## End(Not run)
## Not run: set.seed(1) x < -rnorm(1000) y < -x ^ 2 dcor(x, y) # dcor shows dependence between x and y cor(x, y) # cor does not detect any depencence due to nonlinearity ## End(Not run)
Distance Covariance
dcov(x,y)
dcov(x,y)
x |
numeric vector |
y |
numeric vector |
Implements the algorithm described in Chaudhuri, Hu (2019) doi:10.1016/j.csda.2019.01.016 which only has O(n log(n)) complexity.
Returns a numeric value: the distance covariance between x and y.
## Not run: set.seed(1) x < -rnorm(1000) y < -x ^ 2 dcov(x, y) dvov(x, x) dvov(y, y) ## End(Not run)
## Not run: set.seed(1) x < -rnorm(1000) y < -x ^ 2 dcov(x, y) dvov(x, x) dvov(y, y) ## End(Not run)