I'm struggling with testing the cointegration of 2 time series (or rather interpreting the test results properly).

So I got 2 time series x and y each containing 36 monthly data points (oil prices).

From looking at those time series, I'd say they are cointegrated.

36-month time series

However when applying different cointegration tests, they don't seem to be:

1) Augmented Dickey-Fuller

 from statsmodels.tsa.stattools import adfuller
 from statsmodels.api import OLS

 ols_result = OLS(y, x).fit()
 result = adfuller(ols_result.resid)



 {'1%': -3.7238633119999998, '5%': -2.98648896, '10%': -2.6328004},

i.e. a p-value of 0.98; null hypothesis cannot be rejected, time series are not cointegrated.

2) Engle-Granger

 coint_t, p_value, _ = coint(y, x)

returns a p-value of 0.069 i.e. not cointegrated.

What am I doing wrong here?

Thanks in advance!

PS: there seems to be Granger-Causality between the 2 time series (tested using statsmodels.tsa.stattools.grangercausalitytests)

  • $\begingroup$ could you show us a plot of OLS_result.resid? $\endgroup$
    – carlo
    Commented Apr 16, 2020 at 17:36
  • $\begingroup$ thanks carlo, I added a plot $\endgroup$ Commented Apr 17, 2020 at 9:36
  • $\begingroup$ @movingabout , what makes you think that this series are intgrated in the first place? $\endgroup$ Commented Apr 18, 2020 at 11:28
  • $\begingroup$ informally speaking, they seem to move in similar patterns. a little bit more formally - just from the looks of it - a linear combination of those two series should be easily obtainable. $\endgroup$ Commented Apr 18, 2020 at 11:40
  • $\begingroup$ @movingabout In order for two time-series to be cointegrated it is a necessary condition that they both be integrated of the same order. A linear combination with well-behaved residuals can be obtained from variables that are not intergrated and there fore do not cointegrate. "Similar patterns" is certainly not a sufficient arguement. $\endgroup$ Commented Apr 18, 2020 at 12:27

1 Answer 1


What happens here is that, from a strict point of view, your series don't seem to be properly cointegrated. But this doesn't mean that their relation is spurious, fact is, cointegration has limitations as a tool for analysis. You can refer to this paper for examples and a broader treatise.

The residuals of the fitted model between x and y have higher variance when the values of x and y are higher, this makes the estimated model unstable (heteroscedasticity) and, perhaps more importantly, it makes the residuals non stationary in variance. Anyway, model's instability makes the residuals seem not to be stationary in mean too, even if they could be.

Under these circumstances, it's no surprise that EG test failed to detect the (not quite real) cointegration.


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.