# Why Engle-Granger cointegration test states cointegration between two variables but their trend in time is almost identical?

I have run the Engle-Granger cointegration test in Python between a stock's return and its index return. In this case i have run the test between QQQ returns vs CCMP returns like this:

from statsmodels.tsa.stattools import coint

results = coint(df_stock_returns['QQQ'], df_stock_returns['CCMP'])

print(results)


which yields:

(-2.7063675732286856,
0.1972968735378101,
array([-3.99084033, -3.38795719, -3.08028241]))


The p-value is huge (0.19) so we can state that the two series are not cointegrated with a 95% confidence right?

Now, if i plot the two variables' time series, this is what i get:

How in the world is this even possible? They seem to move almost identically in time, they are almost like a replica of each other. Shouldn't we we be expecting to see the two variables moving/behaving differently over time? How can we explain that despite the high p-value the two series look so correlated like this? I have been searching about this in Google but i didn't find a meaningful answer and this is driving me nuts, i would really appreciate a good explanation about this.

Thank you very much in advance.

For cointegration, you need processes with unit roots. Stock returns do not have unit roots (as you can see, they fluctuate around zero rather than wandering off and potentially never returning), so they cannot be cointegrated.

• Hi @Richard Hardy, thank you for your answer. I know this is a common practice in algorithmic trading, there are a lot of documentation about pairs trading using stock cointegration in Python. How is that stocks can't be co-integrated? Could you give a bit more of an explanation about this please? Commented Apr 28, 2021 at 22:24
• @Miguel2488, stock prices can be cointegrated, but their returns cannot. You needs to analyze prices, not returns if you want to talk about cointegration and pairs trading. Commented Apr 29, 2021 at 5:59
• Hi again @Richard Hardy, thank you very much for your clarification. I'll try with the prices and contrast the results :) Commented Apr 29, 2021 at 9:03
• @Miguel2488, you are welcome! I am glad I could help. Commented Apr 29, 2021 at 9:03

You have 2 ways to interpret this:

1. Your statistic (-2.606) > than any of the Critical values (-3.99084033, 3.38795719, -3.08028241). --> we accept the null hypothesis (=no cointegration)

2. As you say it, p-value is huge: 0.1972968735378101.. 19.72% > than 1%, 5% and 10% ---> therefore we accept the null hypothesis and the data is not cointegrated

In order to interpret our cointegration results, you need to do the following:

1. Estimate the cointegration regression.
2. Test the residuals from the cointegration regression for unit root

If the residuals contain a unit root, then there is no cointegration.