When it comes to comparing returns or prices of instruments like stocks/ETFs, are there any well-established formulas, or ones in common use, that place stronger emphasis on recent correlations more than on historical correlations farther in the past?

An analogy could be the relationship between a simple moving average and an exponential moving average, which weighs more recent prices more heavily.

Comments on relative usefulness also welcome. Fresh in mind is some wisdom I read elsewhere on this site.

If possible try to point out which correlation recipe it may be based off of (some examples).

  • 1
    $\begingroup$ I've never seen such a metric used at any place I've ever worked at, though I suppose you could use the EMA value in place of mean in a parametric correlation statistic. $\endgroup$ – chrisaycock Mar 10 '12 at 18:09

You can use the Exponentially Weighted Average directly aswell, finding the covariances and then normalizing back to the correlations:

$ \sigma_{t+1,jk} = (1-\lambda) \sum_{n=0}^\infty \lambda^{n} r_{j,t-n} r_{k,t-n} $

(this assumes average returns 0 etc etc. More general versions can be derived)

  • $\begingroup$ I will come back one day and attempt to repost your answer adding Ruby or R code, once I learn what's behind each of those variables (pardon my ignorance). For now, thank you $\endgroup$ – Marcos May 10 '12 at 11:32
  • 1
    $\begingroup$ Have a look at RiskMetric's "Technical Document" from 1994, it should all be explained there. It also contains a recursive formula :) If not, the r's in the formula is logreturn of stock j at time (t-n), while your lambda is the weighting constant (RiskMetrics used 0.94, and this usually works well) $\endgroup$ – AdAbsurdum May 11 '12 at 8:48

1) Calculate exponential averages (EMA) for time series A & B.

2) Calculate exponential standard deviations for A & B. My little hack for this is to calculate an EMA of squared returns, then subtract the squared EMA of simple returns, then take the square root of this.

sqrt( ema(return^2) - ema(return)^2 )

3) Apply the same concept to calculating an exponentially weighted correlation. Instead of summing the products of the two time series' comovements and dividing by the product of their standard deviations you would take A's current return minus its EMA & multiply this with B's return minus EMA. Now take an EMA of this product and divide by (A's exponential stdev times B's exponential stdev).

Sorry but I don't know LaTex, if someone would like to turn my wordy explanation into a much more elegant equation then please feel free to edit this.


Try this:

Given some time horizon of K, which can be divided into subperiods of N, you will calculate a rolling correlation coefficient of length N, then you can use the EMA to weight the more recent correlation coefficient heavier (indirectly weighting the recent relationship more, vs the medium term part).

Never came up with this problem in my work so far however it inspired me to try some stuff out :)

  • $\begingroup$ That's great! I didn't want to re-invent something I had a hard time finding, but I'm tempted to draft it up in Ruby and post it here to see where it goes, esp. for scrutiny of its usefulness. I already keep local databases of some OHLCV historical data and wanted to incorporate correlations more directly into my trading algorithms, but ones exponentially or geometrically favoring recent history over distant, yet factoring in both. Maybe it's time I break a sweat and learn R like quants here seem to use. $\endgroup$ – Marcos Mar 11 '12 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.