# Pairs Trading: What statistics to use for analysis of Cointegration using ADF Test?

I have just begun to study Pairs Trading strategy as a part of my assignment for an internship. My purpose is to analyse any two stocks/commodities for possible co-integration. I made a VBA code where I take the OLS of the data and test the residual of the data for stationarity using the ADF test but I am confused as to what statistics to use for testing the null hypothesis? Till now I am considering the distribution for no drift and no trend since the average of the residual should ideally be zero. The other two options are constant but no trend and constant plus trend. I am using the MacKinnon (1996) one-sided p-values.

Please guide me through.

Another thing that I would like to know is, how much better is GLS-ADF test against the ADF test, and where can I find the details about the former test, as I couldn't find any resource on this test.

• Are you planning on using cointegration for pairs trading? You don't need cointegration to test for pairs trading. – user46740 Jun 5 '14 at 13:58
• @user46740 if not co-integration then what do I need to identify pairs for this kind of trading? Anyways I would appreciate if you could still help me in figuring out this doubt specific to the ADF test. – user3655271 Jun 9 '14 at 5:49
• I don't see what the argument of @user46740 is. I think cointegration is the way to go, and pairs trading is a textbook example (e.g. in Tsay "Analysis of Financial Time Series" section 8.8). – Richard Hardy Feb 1 '15 at 12:23

## 2 Answers

• Choosing the ADF test specification

There are three ADF test specifications:
(1) {no constant, no trend};
(2) {constant, no trend};
(3) {constant, trend}

Which one to choose depends on what you believe the relationship between the two prices should be. For example, if you have the same stock traded on two exchanges using the same currency, you may expect that the two prices should be approximately equal at all times. You would not expect the prices to diverge linearly with time $\rightarrow$ no constant. You would not expect the prices to diverge at a quadratic rate of time $\rightarrow$ no trend. Thus you would choose (1) {no constant, no trend}. There may perhaps be other examples where (2) would be more appropriate, but I cannot think of one right now. I doubt (3) would ever be relevant for pairs trading.

If you do not want to believe in any specification in advance (although (3) really does not seem to fit the pairs trading picture), you could try (3) and see whether the trend component is statistically significant. If it is, stay with (3). If not, try (2). If in (2) the constant is significant, stay with (2). If not, try (1). This and this are related posts with more detailed explanations.

• ADF versus GLS-ADF

GLS-ADF a.k.a. DF-GLS test is said to be more powerful than the ADF test. For a technical treatment, there is the original paper by Elliott, Rothenberg and Stock. For a relatively easy read, Eric Zivot has nice lecture notes (especially pages 132-138) where you can learn more about it (there used to be a couple of typos in the formulas but the explanation is great anyway). Given these sources, it should be easier to look for more material if you need.

• @CagdasOzgenc, I don't know and I hesitate to guess. The estimators would have to be worked out and then checked whether they converge to the same quantities in the direct versus the double-step approach. You could try that out, the algebra part should not be too difficult; the convergence part could. Or you could post a new question with the algebraic results worked out and just focusing on what distributions the estimators will have. – Richard Hardy Apr 18 '17 at 12:56

I would start with throwing out VBA. You can't do a serious analysis of things like cointegration in VBA unless you want to spend all your time coding stuff that has already been coded and has very little to do with trading. Focus on the subject, i.e. trading, and let the appropriate tools do what they do best.

For instance, take a look at Johansen test. It's one of the popular cointegration tests. There are two variants of it. Get the returns of your stocks, and run the test on them. That would have been the first thing that I'd do. Obviously, I'm assuming you did the exploratory analysis already, i.e. scatter plots, histograms and such.