Skip to content
All library documents

Tracking Spread Mean and Variance in Cointegration Pairs Trading

Article Quant Q&A · Author: c00kiemonster

Summary

The document asks how to assess whether a cointegrated pair’s spread mean and variance remain stable over time, so entry and exit limits can be set systematically. It frames the spread as a regression residual and considers regime-switching models as a possible way to represent changing behavior, while emphasizing that the central issue is quantifying parameter stability rather than simply testing for cointegration over one sample.

The response suggests converting the price spread into a return series and examining rolling means and standard deviations for patterns that could affect the strategy. This offers a practical diagnostic for time variation, but it does not define formal stability tests, an optimal window, or a regime-switching specification. The material is therefore a pointer toward exploratory monitoring, not a complete method for estimating adaptive trading thresholds. The referenced resources are mentioned without substantive summaries, and no empirical results are provided to validate a particular approach.

Key ideas

  • The question concerns stability over time in the mean and variance of a cointegrated spread.
  • The spread is modeled as a regression residual between two prices.
  • A response recommends examining returns on the residual series rather than relying only on its price level.
  • Rolling means and standard deviations can reveal patterns that may help or hinder a pairs strategy.
  • The document does not establish formal stability tests or prescribe rolling-window settings.

Tags

Full text
# How do I incorporate time-variability in a pair trading framework?


# How do I incorporate time-variability in a pair trading framework?












Recently I have been looking at pair trading strategies from a cointegration perspective, as described in chapter 5 of Carol Alexander's Market Risk Analysis volume 2. As most quantitative finance texts the science is well explained, but the description of applications is a bit on the light side.

Theoretically it's pretty straightforward and easy to run the tests for a given time period to see whether a certain pair is likely to be conintegrated or not. To apply the theory to an actual pairs trade however, I would like to add the time dimension to my parameters.

If I simply model the spread as $residuals = y - \alpha - \beta x$, the first thing I'd like to know is the mean and variance of the residuals. In order to setup my bid/ask limits I must have a mean and some measure of the variance. In an ideal case the two would be stable, but how can I quantify this and incorporate the information into the model? Also, how can I make this analysis structural, rather than having to depend on subjective eye-balling of data?

Could anyone point me in the right direction here? My guess is that I should take a look at regime switching models. But since that topic is unknown to me, I'd appreciate very much if someone could give some pointers so I can avoid the worst pitfalls.

EDIT: Perhaps I wasn't clear enough, but my question is not how to do the tests, it's how can do can I quantify the stability of the parameters, i.e., the mean and variance of the spread?

## Answer by bill_080 (score 3)

https://quant.stackexchange.com/a/599

If you're using R and would like a few examples, here's Paul Teetor's website:

http://quanttrader.info/public/

And, Ernie Chan's website:

http://epchan.blogspot.com/

Energy pairs:

http://statistik.ets.kit.edu/download/doc_secure1/ptem342v144techreport.pdf

## Answer by Patrick Burns (score 2)

https://quant.stackexchange.com/a/600

I assume your 'x' and 'y' are prices and so 'residuals' also is in currency units. If so, then I would make a vector of the returns of 'residuals'. This gives you some (reasonably) independent observations on the process. Then you could do some rolling means and rolling standard deviations to look for patterns that might help you or trip you up.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.