I'm trying to use statsmodels' VAR(p) to forecast some data points in the future. Below is a snapshot of what my data looks like:

enter image description here

What I understand about VAR(p) equation in general is that when p = 3, VAR(p) will use 3 lags time to predict the future. What I'm not sure is whether it uses 3 lags time consecutively or 3 lags time at a specific time.

For example (using my data):

A. p = 3, means 2016-08-15 00:20:00, 2016-08-15 00:15:00, 2016-08-15 00:10:00


B. p = 3, means 2016-08-15 00:20:00, 2016-08-14 00:20:00, 2016-08-13 00:20:00 (same hour at different days)

Then, when it forecast the future, does it forecast the future consecutively or at same hour different days?

For example (to predict 3 data points), does VAR(p) outputs forecasted points on the following dates?

A. 2016-08-15 00:25:00, 2016-08-15 00:30:00, 2016-08-15 00:35:00


B. 2016-08-16 00:20:00, 2016-08-17 00:20:00, 2016-08-18 00:20:00

Maybe I'm just way off...I'm not sure, that's why I'm asking for clarification.

Thanks for helping.


In general (not specifically about statsmodels), a VAR(p) model is built according to your option "A".

You are correct in that the value of a series the previous day at the same time may be useful in forecasting. Generally this is referred to as "seasonality" (because if you have monthly data, the season within the year may have some predictive power...this is the same, but about the time within the day).

I don't know if your specific package will do it, but generically you can build a seasonal version of a VAR(p) model by adding a lag at the seasonal period (12 x 24 = 288 five minute intervals). For example, in your case, you could build something like:

$Y_t = A_1 Y_{t-1} + A_{288} Y_{t-288} + e_t$

This model would depend both on the value 5 minutes ago and on the value at this hour yesterday.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.