Skip to content

Instantly share code, notes, and snippets.

@yogabonito
Last active January 15, 2024 10:48
Show Gist options
  • Save yogabonito/b532e20b64587c19198f1aacb5ddfca2 to your computer and use it in GitHub Desktop.
Save yogabonito/b532e20b64587c19198f1aacb5ddfca2 to your computer and use it in GitHub Desktop.
VECM example
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iTrooz
Copy link

iTrooz commented Jun 23, 2022

I had a problem with statsmodels.tsa.vecm.vecm (ModuleNotFoundError) and had to replace it with statsmodels.tsa.vector_ar.vecm (so the line would be from statsmodels.tsa.vector_ar.vecm import *) to make it work

Any idea why ?

@yogabonito
Copy link
Author

Sorry for the late reply, @iTrooz! (I'm not that often on Github.)
I just had a look the code I wrote back then and I saw that I put my VECM code in its own direcotry (statsmodels/tsa/vecm/vecm). It looks like the statsmodels team moved the VECM-related code to the vector_ar directory after my code was merged into the statsmodels repository.

@RangerShaw
Copy link

Very helpful. Thx!
I have a problem about forecast error variance decomposition (FEVD) that I didn't find relevant functions in statsmodels.tsa.vector_ar.vecm. Is FEVD not supported yet?

@yogabonito
Copy link
Author

Hi @RangerShaw,
I think the best way to ask is to open a new issue in the statsmodels repository. As I stopped working on statsmodels almost six years ago, I am not sure what features were added since then.

@Jackie00765
Copy link

Deeply thank you for your demostrartion ~~~

@AdKowal
Copy link

AdKowal commented Dec 16, 2023

Thanks for useful example

@wang8586
Copy link

Awesome and thanks for you sharing! I have a question, the function select_order is to find the best lags of VAR model based on information criteria. But the k_ar_diff in function select_coint_rank is the lagged difference (VECM function as well). Should they be subtracted one from the result of select_order? (means k_ar_diff =2 in select_coint_rank and VECM, but not 3 which is the best order in the result of select_order)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment