---
title: "Distance Correlation: Formula, Meaning"
description: "Distance correlation, introduced by Szekely, Rizzo and Bakirov, measures dependence between two variables of any shape and is zero only if they are..."
canonical: https://www.getswoopr.com/indicators/statistical-and-quantitative/distance-correlation/
source: "Swoopr Investment: https://www.getswoopr.com"
---

## Direct Answer



> Distance correlation, introduced by Szekely, Rizzo and Bakirov, measures dependence between two variables of any shape and is zero only if they are independent. It is built from centered matrices of pairwise distances. Values lie between 0 and 1, with 0 meaning independence and 1 a strong dependence.





      


# Distance Correlation: Formula, Meaning, Signals, Examples and How to Use It



## How Is Distance Correlation Calculated?

Distance correlation, introduced by Szekely, Rizzo and Bakirov, measures dependence between two variables of any shape and is zero only if they are independent. It is built from centered matrices of pairwise distances.

**Formula:** `dCor = dCov(X, Y) / sqrt( dVar(X) * dVar(Y) ), where dCov^2, dVar^2 are averages of products of double-centered distance matrices`

**Inputs:**

- Two aligned series
- Window length
- Pairwise distance matrices

**Worked example.** A squared distance covariance of 0.18 with squared distance variances of 0.30 and 0.25 gives a distance correlation of 0.811. The inputs are illustrative numbers, not market data.

**Reading it.** Values lie between 0 and 1, with 0 meaning independence and 1 a strong dependence. Unlike Pearson correlation it has no sign, so it cannot tell whether the relationship is positive or negative.

**Limits.** It requires comparing all pairs of observations, which is expensive for long windows, and sample estimates are biased upward for small samples. Significance usually needs resampling.


      

## What is Distance Correlation?



Distance correlation, introduced by Szekely, Rizzo and Bakirov, measures dependence between two variables of any shape and is zero only if they are independent. It is built from centered matrices of pairwise distances.




## How to use Distance Correlation



Values lie between 0 and 1, with 0 meaning independence and 1 a strong dependence. Unlike Pearson correlation it has no sign, so it cannot tell whether the relationship is positive or negative. A reading alone is never a buy or sell signal; it needs context from price structure, volume, volatility and the broader market regime.




## Strengths



- It is zero only when variables are independent, so it detects nonlinear and non-monotonic dependence that Pearson correlation misses.
- It is bounded between 0 and 1, so the strength of dependence can be read on a fixed scale.
- Reproducible when the formula and data convention are fixed.




## Weaknesses and limitations



- Values are non-negative, so the measure shows strength of dependence but not whether the link is positive or negative.
- When one input is a vector of several variables, those on larger scales dominate the distances unless standardized first.
- Correlated indicators can create false confidence by repeating the same underlying information.




## Editorial and risk note



This page is educational content, not individualized investment advice. It should not imply guaranteed prediction, accuracy or outperformance.







## Frequently Asked Questions


        



Is Distance Correlation a buy or sell signal?




No. Values lie between 0 and 1, with 0 meaning independence and 1 a strong dependence. It requires comparing all pairs of observations, which is expensive for long windows, and sample estimates are biased upward for small samples. A trade built on it still needs a trigger, an invalidation rule, a position size and realistic execution assumptions.










What is the best setting for Distance Correlation?




Distance Correlation takes these inputs: two aligned series; window length; pairwise distance matrices. There is no universal best setting for the tunable ones, so test them across instruments, regimes and out-of-sample periods and favor stable parameter regions over one historical winner.










Can Distance Correlation be used by itself?




It requires comparing all pairs of observations, which is expensive for long windows, and sample estimates are biased upward for small samples. Significance usually needs resampling. For that reason it is read next to measures of direction, participation, valuation, liquidity and risk, not alone.










Does Distance Correlation work on every timeframe?




The calculation (dCor = dCov(X, Y) / sqrt( dVar(X) * dVar(Y) ), where dCov^2, dVar^2 are averages of products of double-centered distance matrices) can be run on any bar size, but behavior is not portable: a reading on a five-minute chart describes a very different market window from the same reading on a daily chart. Validate the exact timeframe before relying on it.










Why does Distance Correlation give false signals?




Values are non-negative, so the measure shows strength of dependence but not whether the link is positive or negative. When one input is a vector of several variables, those on larger scales dominate the distances unless standardized first. Lag, noise and regime changes add to this, because market participants react to new information after the reading is calculated.










How should Distance Correlation be backtested?




Rebuild Distance Correlation from two aligned series using point-in-time data, write the rules before testing, include delisted securities where relevant, model realistic fills and costs, reserve a validation sample and compare with a simpler baseline.










## References

- [The Annals of Statistics: Measuring and testing dependence by correlation of distances (2007)](https://doi.org/10.1214/009053607000000505)



S




Swoopr Editorial Team



The Swoopr Editorial Team produces independent investment education, research, and tools for understanding markets, evaluating opportunities, and managing risk. All content is educational only and does not constitute personalized investment advice.



See our [editorial policy](https://www.getswoopr.com/legal/editorial-policy/) and [corrections policy](https://www.getswoopr.com/legal/corrections-policy/).
