indep.test: Energy-tests of Independence

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

View source: R/Eindep.R

Description

Computes a multivariate nonparametric test of independence. The default method implements the distance covariance test dcov.test.

Usage

1
indep.test(x, y, method = c("dcov","mvI"), index = 1, R)

Arguments

x

matrix: first sample, observations in rows

y

matrix: second sample, observations in rows

method

a character string giving the name of the test

index

exponent on Euclidean distances

R

number of replicates

Details

indep.test with the default method = "dcov" computes the distance covariance test of independence. index is an exponent on the Euclidean distances. Valid choices for index are in (0,2], with default value 1 (Euclidean distance). The arguments are passed to the dcov.test function. See the help topic dcov.test for the description and documentation and also see the references below.

indep.test with method = "mvI" computes the coefficient I_n and performs a nonparametric E-test of independence. The arguments are passed to mvI.test. The index argument is ignored (index = 1 is applied). See the help topic mvI.test and also see the reference (2006) below for details.

The test decision is obtained via bootstrap, with R replicates. The sample sizes (number of rows) of the two samples must agree, and samples must not contain missing values.

These energy tests of independence are based on related theoretical results, but different test statistics. The dcov method is faster than mvI method by approximately a factor of O(n).

Value

indep.test returns a list with class htest containing

method

description of test

statistic

observed value of the test statistic n V_n^2 or n I_n^2

estimate

V_n or I_n

estimates

a vector [dCov(x,y), dCor(x,y), dVar(x), dVar(y)] (method dcov)

replicates

replicates of the test statistic

p.value

approximate p-value of the test

data.name

description of data

Note

As of energy-1.1-0, indep.etest is deprecated and replaced by indep.test, which has methods for two different energy tests of independence. indep.test applies the distance covariance test (see dcov.test) by default (method = "dcov"). The original indep.etest applied the independence coefficient I_n, which is now obtained by method = "mvI".

Author(s)

Maria L. Rizzo mrizzo @ bgsu.edu and Gabor J. Szekely

References

Szekely, G.J. and Rizzo, M.L. (2009), Brownian Distance Covariance, Annals of Applied Statistics, Vol. 3 No. 4, pp. 1236-1265. (Also see discussion and rejoinder.)
doi: 10.1214/09-AOAS312

Szekely, G.J., Rizzo, M.L., and Bakirov, N.K. (2007), Measuring and Testing Dependence by Correlation of Distances, Annals of Statistics, Vol. 35 No. 6, pp. 2769-2794.
doi: 10.1214/009053607000000505

Bakirov, N.K., Rizzo, M.L., and Szekely, G.J. (2006), A Multivariate Nonparametric Test of Independence, Journal of Multivariate Analysis 93/1, 58-80,
doi: 10.1016/j.jmva.2005.10.005

See Also

dcov.test mvI.test dcov mvI

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 ## independent multivariate data
 x <- matrix(rnorm(60), nrow=20, ncol=3)
 y <- matrix(rnorm(40), nrow=20, ncol=2)
 indep.test(x, y, method = "dcov", R = 99)
 indep.test(x, y, method = "mvI", R = 99)

 ## dependent multivariate data
 if (require(MASS)) {
   Sigma <- matrix(c(1, .1, 0, 0 , 1, 0, 0 ,.1, 1), 3, 3)
   x <- mvrnorm(30, c(0, 0, 0), diag(3))
   y <- mvrnorm(30, c(0, 0, 0), Sigma) * x
   indep.test(x, y, R = 99)    #dcov method
   indep.test(x, y, method = "mvI", R = 99)
    }
  

energy documentation built on Feb. 22, 2021, 5:08 p.m.