View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Distance correlation

4.5 | 4 ratings Rate this file 17 Downloads (last 30 days) File Size: 1.48 KB File ID: #39905 Version: 1.0

Distance correlation


Shen Liu (view profile)


Distance correlation calculation

| Watch this File

File Information

This function calculates the distance correlation between two samples x and y.

It is especially useful when x and y have weak linear dependence but strong nonlinear dependence.

For example, if
x = -10:10; x = x'
y = x.^2;
then corr(x,y) is approximately zero. However, the distance correlation between x and y is nearly 0.5.

Note: distance correlation is zero if and only if x and y are statistically independent.

Author: Shen Liu
Date: 18/01/2013


This file inspired Dcorr( X, Y ).

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
04 Aug 2016 jhgang

jhgang (view profile)

29 Mar 2016 Shaun Shi

I encountered "out of memory" error for large size of array input.Is there any possibility to optimize this function to mobilize larger size of array?

10 Mar 2015 Paolo Inglese

13 Jun 2014 Jorge

Jorge (view profile)

What is he reason for validation of dimension?

Comment only
13 Jun 2014 Jorge

Jorge (view profile)

What is he reason for validation of dimension?

13 Jun 2014 precuneus

Using bsxfun you could get this function more efficient, e.g.
A = a - bsxfun(@plus,mean(a),mean(a,2))+mean(a(:));

Comment only

Contact us