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?


2 Answers 2


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


And, Ernie Chan's website:


Energy pairs:



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.

  • $\begingroup$ Yup, that's exactly what I have done. My question is really how can I quantify the patterns? $\endgroup$ Commented Feb 25, 2011 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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