Distance Correlation Statistic and t-Test

Distance correlation t-test of multivariate and functional independence (wrapper functions of energy package).

multivariate, htest, nonparametric
dcor.xy(x, y, test = TRUE, metric.x, metric.y, par.metric.x, par.metric.y, n)

dcor.dist(D1, D2)

bcdcor.dist(D1, D2, n)

dcor.test(D1, D2, n)


data (fdata, matrix or data.frame class) of first sample.


data (fdata, matrix or data.frame class) of second sample.


if TRUE, compute bias corrected distance correlation statistic and the corresponding t-test, else compute distance correlation statistic.

metric.x, metric.y

Name of metric or semi-metric function used for compute the distances of x and y object respectively. By default, metric.lp for functional data and metric.dist for multivariate data.

par.metric.x, par.metric.y

List of parameters for the corresponding metric function.


The sample size used in bias corrected version of distance correlation, by default is the number of rows of x.


Distances of first sample (x data).


Distances of second sample (y data).


These wrapper functions extend the functions of the energy package for multivariate data to functional data. Distance correlation is a measure of dependence between random vectors introduced by Szekely, Rizzo, and Bakirov (2007). dcor.xy performs a nonparametric t-test of multivariate or functional independence in high dimension. The distribution of the test statistic is approximately Student t with \(n(n-3)/2-1\) degrees of freedom and for \(n \geq 10\) the statistic is approximately distributed as standard normal. Wrapper function of energy:::dcor.ttest. The t statistic is a transformation of a bias corrected version of distance correlation (see SR 2013 for details). Large values (upper tail) of the t statistic are significant. dcor.test similar to dcor.xy but only for distance matrix. dcor.dist compute distance correlation statistic. Wrapper function of energy::dcor but only for distance matrix bcdcor.dist compute bias corrected distance correlation statistic. Wrapper function of energy:::bcdcor but only for distance matrix.


dcor.test returns a list with class htest containing

  • method description of test

  • statistic observed value of the test statistic

  • parameter degrees of freedom

  • estimate bias corrected distance correlation bcdcor(x,y)

  • p.value p-value of the t-test

  • data.name description of data

dcor.xy returns the previous list with class htest and

  • D1 the distance matrix of x

  • D2 the distance matrix of y

dcor.dist returns the distance correlation statistic.

bcdcor.dist returns the bias corrected distance correlation statistic.


Szekely, G.J. and Rizzo, M.L. (2013). The distance correlation t-test of independence in high dimension. Journal of Multivariate Analysis, Volume 117, pp. 193-213.

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.

See Also

metric.lp amd metric.dist.

  • dcor.xy
  • dcor.test
  • dcor.dist
  • bcdcor.dist
dcor.xy(x, y,test=TRUE)
dx <- metric.lp(x)
dy <- metric.lp(y)
dcor.test(dx, dy)
bcdcor.dist(dx, dy)
dcor.xy(x, y,test=FALSE)
dcor.dist(dx, dy)
# }
# }
Documentation reproduced from package fda.usc, version 2.0.1, License: GPL-2

Community examples

Looks like there are no examples yet.