I can't find any reference on funcionality to perform Johansen cointegration test in any Python module dealing eith statistics and time series analysis (pandas and statsmodel). Does anybpdy know if there's some code around that can perform such a test for cointegration among time series? Thanks for your help,
Maruizio
Cointegration > Johansen's test is a way to determine if three or more time series are cointegrated. More specifically, it assesses the validity of a cointegrating relationship, using a maximum likelihood estimates (MLE) approach.
Methods of Testing for CointegrationThe Engle-Granger Two-Step method starts by creating residuals based on the static regression and then testing the residuals for the presence of unit-roots. It uses the Augmented Dickey-Fuller Test (ADF) or other tests to test for stationarity units in time series.
This is now implemented in Python's statsmodels:
from statsmodels.tsa.vector_ar.vecm import coint_johansen
x = getx() # dataframe of n series for cointegration analysis
jres = coint_johansen(x, det_order=0, k_ar_diff=1)
For a full description of inputs/results, see the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With