hsic.perm: Hilber Schmidt Independence Criterion permutation test

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/hsicperm.R

Description

Test to check the independence between two variables x and y using HSIC. The hsic.perm() function, uses Hilbert-Schmidt independence criterion to test for independence between random variables.

Usage

1
hsic.perm(x, y, sig = 1, p = 100, numCol = 50)

Arguments

x

data of first sample

y

data of second sample

sig

Gaussian kernel width for HSIC tests. Default is 1

p

Number of permutations. Default is 100

numCol

maximum number of columns that we use for the incomplete Cholesky decomposition

Details

Let x and y be two samples of length n. Gram matrices K and L are defined as: K_{i,j} =exp((x_i-x_j)^2/sig^2) and L_{i,j} =exp((y_i-y_j)^2/sig^2). H_{i,j} = δ_{i,j} - 1/n. Let A=HKH and B=HLH, then HSIC(x,y)=Tr(AB)/n^2. Permutation test permutes y p times to get y_{(p)} and calculates HSIC(x,y_(p)). (HSIC(x,y)>HSIC(x,y_{(p)}))/p.

Value

hsic.perm() returns a list with class htest containing

method

description of test

statistic

observed value of the test statistic

estimate

HSIC(x,y)

estimates

a vector: [HSIC(x,y), mean of HSIC(x,y), variance of HSIC(x,y)]

replicates

replicates of the test statistic

p.value

approximate p-value of the test

data.name

desciption of data

Author(s)

Petras Verbyla (petras.verbyla@mrc-bsu.cam.ac.uk) and Nina Ines Bertille Desgranges

References

A. Gretton et al. (2005). Kernel Methods for Measuring Independence. JMLR 6 (2005) 2075-2129.

See Also

hsic.gamma, hsic.clust, kernelCItest

Examples

 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)

Example output

	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 

kpcalg documentation built on May 2, 2019, 12:39 p.m.