After fitting a VECM model, I would like to study its out-of-sample behavior but haven't been able to find a way to do it.

More precisely, given `X_train`

and `X_test`

, I computed

`from statsmodels.tsa.vector_ar.vecm import VECM model = VECM(endog = X_train, k_ar_diff = 1, coint_rank = 2, deterministic = 'co') res = model.fit() X_pred = res.predict(X_test) `

However, predict does not seem to be built for this. Is there any way around this?

**Contents**hide

#### Best Answer

`from statsmodels.tsa.vector_ar.vecm import VECM model = VECM(endog = X_train, k_ar_diff = 1, coint_rank = 2, deterministic = 'co') res = model.fit() X_pred = res.predict(steps=10) `

e.g. set `steps=10`

if your want predict 10 periods

### Similar Posts:

- Solved – coint ouput in statsmodels.tsa.stattools.coint
- Solved – VECM, positive loading coefficients of EC terms
- Solved – Why are the critical values in coint_johansen in statsmodels in Python so different from the ones in ca.jo in urca in R
- Solved – Why are the critical values in coint_johansen in statsmodels in Python so different from the ones in ca.jo in urca in R
- Solved – Johansen Test in python