distcov.test {dcortools}R Documentation

Performs a distance covariance test.

Description

Performs a distance covariance test.

Usage

distcov.test(
  X,
  Y,
  method = "permutation",
  b = 499L,
  ln = 20,
  affine = FALSE,
  standardize = FALSE,
  bias.corr = FALSE,
  type.X = "sample",
  type.Y = "sample",
  metr.X = "euclidean",
  metr.Y = "euclidean",
  use = "all",
  return.data = FALSE,
  algorithm = "auto"
)

Arguments

X

contains either the first sample or its corresponding distance matrix.

In the first case, X can be provided either as a vector (if one-dimensional), a matrix or a data.frame (if two-dimensional or higher).

In the second case, the input must be a distance matrix corresponding to the sample of interest.

If X is a sample, type.X must be specified as "sample". If X is a distance matrix, type.X must be specified as "distance".

Y

see X.

method

specifies the type of test that is performed.

"permutation" performs a Monte Carlo Permutation test.

"gamma" performs a test based on a gamma approximation of the test statistic under the null (Huang and Huo 2017). This test tends to be anti-conservative, if the “real” p-value is small

"conservative" performs a conservative two-moment approximation (Berschneider and Bottcher 2018).

"bb3" performs a three-moment approximation (Berschneider and Bottcher 2018). This is the most precise parametric option, but only available with the standard algorithm.

"wildbs1" and "wilbs2" perform wild bootstrap tests (Chwialkowski et al. 2014); experimental at the moment.

b

integer; specifies the number of random permutations/bootstrap samples used for the permutation or wild bootstraps tests. Ignored for other tests.

ln

numeric; block size parameter for wild bootstrap tests. Ignored for other tests.

affine

logical; specifies if the affinely invariant distance covariance (Dueck et al. 2014) should be calculated or not.

standardize

logical; specifies if X and Y should be standardized dividing each component by its standard deviations. No effect when affine = TRUE.

bias.corr

logical; specifies if the bias corrected version of the sample distance covariance (Huo and Szekely 2016) should be calculated.

type.X

For "distance", X is interpreted as a distance matrix. For "sample", X is interpreted as a sample.

type.Y

see type.X.

metr.X

specifies the metric which should be used to compute the distance matrix for X (ignored when type.X = "distance").

Options are "euclidean", "discrete", "alpha", "minkowski", "gaussian", "gaussauto", "boundsq" or user-specified metrics (see examples).

For "alpha", "minkowski", "gauss", "gaussauto" and "boundsq", the corresponding parameters are specified via "c(metric, parameter)", c("gaussian", 3) for example uses a Gaussian metric with bandwidth parameter 3; the default parameter is 2 for "minkowski" and "1" for all other metrics.

See Lyons (2013); Sejdinovic et al. (2013); Bottcher et al. (2018) for details.

metr.Y

see metr.X.

use

specifies how to treat missing values. "complete.obs" excludes NAs, "all" uses all observations.

return.data

logical; specifies if the test object should contain the original data.

algorithm

specifies the algorithm used for calculating the distance covariance.

"fast" uses an O(n log n) algorithm if the observations are one-dimensional and metr.X and metr.Y are either "euclidean" or "discrete", see also Huo and Szekely (2016).

"memsave" uses a memory saving version of the standard algorithm with computational complexity O(n^2) but requiring only O(n) memory.

"standard" uses the classical algorithm. User-specified metrics always use the classical algorithm.

"auto" chooses the best algorithm for the specific setting using a rule of thumb.

Value

distcov.test object

References

Berschneider G, Bottcher B (2018). “On complex Gaussian random fields, Gaussian quadratic forms and sample distance multivariance.” arXiv preprint arXiv:1808.07280.

Bottcher B, Keller-Ressel M, Schilling RL (2018). “Detecting independence of random vectors: generalized distance covariance and Gaussian covariance.” Modern Stochastics: Theory and Applications, 3, 353–383.

Chwialkowski KP, Sejdinovic D, Gretton A (2014). “A wild bootstrap for degenerate kernel tests.” In Advances in neural information processing systems, 3608–3616.

Dueck J, Edelmann D, Gneiting T, Richards D (2014). “The affinely invariant distance correlation.” Bernoulli, 20, 2305–2330.

Huang C, Huo X (2017). “A statistically and numerically efficient independence test based on random projections and distance covariance.” arXiv preprint arXiv:1701.06054.

Huo X, Szekely GJ (2016). “Fast computing for distance covariance.” Technometrics, 58(4), 435–447.

Lyons R (2013). “Distance covariance in metric spaces.” The Annals of Probability, 41, 3284–3305.

Sejdinovic D, Sriperumbudur B, Gretton A, Fukumizu K (2013). “Equivalence of distance-based and RKHS-based statistics in hypothesis testing.” The Annals of Statistics, 41, 2263–2291.

Szekely GJ, Rizzo ML, Bakirov NK (2007). “Measuring and testing dependence by correlation of distances.” The Annals of Statistics, 35, 2769–2794.

Szekely GJ, Rizzo ML (2009). “Brownian distance covariance.” The Annals of Applied Statistics, 3, 1236–1265.


[Package dcortools version 0.1.6 Index]