# VECM predict gives forecasting results that lag behind actual data

I am using Python's statsmodels.tsa.vector_ar.vecm.VECM to estimate VECM models and generate pseudo out-of-sample forecasts with the .predict() function to compare with actual data.

For example, I would stop training data at 2012Q4 and compute a one-quarter-ahead forecast for 2013Q1. Then I would increase training data to 2013Q1, compute a one-quarter-ahead forecast for 2013Q2, and do so so-on-so-forth recursively until I have a time series of one-quarter-ahead forecasts (say from 2013Q1 to 2018Q1). Then I plot this forecast time series with actual data.

However, my forecasts appear to have a lag with the actual data. What might be the reason this is the case? I attach part of my code and the graph below.

# Try end dates from 2012Q4 to 2017Q4 and recursively estimate out-of-sample forecasts

end_dates = pd.date_range(start='2012-11-30', end='2017-12-01', freq='Q-Feb') + pd.DateOffset(months=0, days=1)

forecasts = np.empty((len(end_dates)))
for t in range(len(end_dates)):
end_date = end_dates[t]
timeseries_train = long_run_data.loc[:end_date, ['INV', 'TQ3', 'INC', 'CRE']]
model = VECM(timeseries_train, deterministic={"ci"}, k_ar_diff=2, coint_rank=1)
vecm_res = model.fit()
forecast = vecm_res.predict(steps=1)[0, 0]
forecasts[t] = forecast

forecast_index = pd.date_range(start='2013-02-28', end="2018-03-01", freq="Q-Feb")+ pd.DateOffset(months=0, days=1)
forecast_df = pd.DataFrame({'INV': forecasts},index=forecast_index)

plt.figure(figsize=(12, 6))
plt.plot(long_run_data.index, long_run_data.loc[:, 'INV'], label='Actual investment')
plt.plot(forecast_df.index, forecast_df.loc[:, 'INV'], label='INV Forecast', linestyle='--')
plt.xlabel('Date')
plt.ylabel('Value')
plt.legend()
plt.grid(True)
plt.show()


• Without looking at the code and just judging by the plot, this is close to (though certainly not exactly) what you would expect if your time series was approximately a random walk and your forecast was the last observed value. That forecast is optimal (under some conditions), even though it creates the impression that you are just lagging behind the whole time (and you are, but that is optimal). Variables in a VECM will be stationary deviations from random walks, so the picture is not unexpected. Commented Sep 11, 2023 at 11:01
• Thank you for this. What would be some ways to improve this forecast, so that forecasts are not simply close to "lagged last observed values"? I have tried selecting only VECM models that make economic sense and satisfy certain long-run relationships, and average over many VECM models to obtain forecasts, however, the averaged forecast continues to look like the lagged actual data. Commented Sep 11, 2023 at 15:57
• My point is that a good forecast likely should look like this. If it looked differently, it would suspect it is further away from optimality. Commented Sep 11, 2023 at 17:09
• Yes, but from an operational point of view, one would want the forecast to track actual data instead of lagging behind for the model to be a useful forecasting tool. From this point of view, is there something I could do? Thanks a lot for your time and suggestion! Commented Sep 12, 2023 at 9:55
• From an operational point of view, I would want the best forecast that is technically possible. Even if such a forecast lags behind, it is still better than another one by definition. I understand your sentiment, but I am afraid not much can be done about the issue if VECM is an adequate model for the time series. Commented Sep 12, 2023 at 10:02