Description Usage Arguments Details Value Author(s) References See Also Examples
Test to check the independence between two variables x and y using the Distance Covariance. The dcov.gamma() function, uses Distance Covariance independence criterion with gamma approximation to test for independence between two random variables.
1 | dcov.gamma(x, y, index = 1, numCol = 100)
|
x |
data of first sample |
y |
data of second sample |
index |
exponent on Euclidean distance, in (0,2] |
numCol |
Number of columns used in incomplete Singular Value Decomposition |
Let x and y be two samples of length n. Gram matrices K and L are defined as: K_{i,j} =|x_i-x_j|^s and L_{i,j} =|y_i-y_j|^s, where 0<s<2. H_{i,j} = delta_{i,j} - 1/n. Let A=HKH and B=HLH, then nV^2 = ∑ A_{i,j} B_{i,j} \n^2. For more detail: dcov.test in package energy. Gamma test compares nV^2_n(x,y) with the alpha quantile of the gamma distribution with mean and variance same as nV^2_n under independence hypothesis.
dcov.gamma() returns a list with class htest containing
method |
description of test |
statistic |
observed value of the test statistic |
estimate |
nV^2(x,y) |
estimates |
a vector: [nV^2(x,y), mean of nV^2(x,y), variance of nV^2(x,y)] |
replicates |
replicates of the test statistic |
p.value |
approximate p-value of the test |
data.name |
desciption of data |
Petras Verbyla (petras.verbyla@mrc-bsu.cam.ac.uk) and Nina Ines Bertille Desgranges
A. Gretton et al. (2005). Kernel Methods for Measuring Independence. JMLR 6 (2005) 2075-2129.
G. Szekely, M. Rizzo and N. Bakirov (2007). Measuring and Testing Dependence by Correlation of Distances. The Annals of Statistics 2007, Vol. 35, No. 6, 2769-2794.
hsic.perm, hsic.clust, hsic.gamma, dcov.test, kernelCItest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | library(energy)
set.seed(10)
#independence
x <- runif(300)
y <- runif(300)
hsic.gamma(x,y)
hsic.perm(x,y)
dcov.gamma(x,y)
dcov.test(x,y)
#uncorelated but not dependent
z <- 10*(runif(300)-0.5)
w <- z^2 + 10*runif(300)
cor(z,w)
hsic.gamma(z,w)
hsic.perm(z,w)
dcov.gamma(z,w)
dcov.test(z,w)
|
HSIC test of independence
data: Gamma approximation
HSIC = 3.9419e-05, p-value = 0.4951
sample estimates:
HSIC
3.941891e-05
HSIC test of independence
data: Permutation approximation
HSIC = 3.9419e-05, p-value = 0.5149
sample estimates:
HSIC
3.941891e-05
dCov test of independence
data: index 1, Gamma approximation
nV^2 = 0.070484, p-value = 0.7095
sample estimates:
dCov
0.01532792
Specify the number of replicates R (R > 0) to perform the test of
independence
data: index 1, replicates 0
nV^2 = 0.071288, p-value = NA
sample estimates:
dCov
0.01541517
[1] -0.03614353
HSIC test of independence
data: Gamma approximation
HSIC = 0.01221, p-value < 2.2e-16
sample estimates:
HSIC
0.0122098
HSIC test of independence
data: Permutation approximation
HSIC = 0.012203, p-value = 0.009901
sample estimates:
HSIC
0.01220283
dCov test of independence
data: index 1, Gamma approximation
nV^2 = 762.29, p-value < 2.2e-16
sample estimates:
dCov
1.594046
Specify the number of replicates R (R > 0) to perform the test of
independence
data: index 1, replicates 0
nV^2 = 762.43, p-value = NA
sample estimates:
dCov
1.59419
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.