3

Is there a way of running an ARIMA/Holt-Winters model in python that deals with multiple items (time series) at once?

I can run a single ARIMA/Holt-Winters model using the StatsModels package in Python, but not for multiple Time Series.

To clarify what I mean by multiple Time Series, see my dataset.

enter image description here

Majo_Jose
  • 744
  • 1
  • 10
  • 24
MRHarv
  • 491
  • 1
  • 10
  • 22

2 Answers2

1

ARIMA is one of the mostly used Models for time series forecasting but, It is suitable only for univariate time series analysis. In your dataset, there are four variables

  • X1
  • X2
  • X3
  • X4

So it is a multivariate time series.

For Handling, this kind of time series forecasting VECTOR AUTO REGRESSION is a good Choice. it is capable of handling any number of variable. Even though the computation is higher you will get a decent accuracy on the prediction.

you can easily import it from Stats_Model by the following import statement:

from statsmodels.tsa.vector_ar.var_model import VAR

VAR METHOD :

model = VAR(array_of_data)
  • where arry_of_data should be a list (each observation as a row)

Input Format of Data:

[[5737,5100,2899,7431.26],

[5779,5500,5600,5237.5],

[5782,3520,3620,6534.39]]

Before implementing it, carefully read all parameters for better result.

for more understanding read this

piet.t
  • 11,718
  • 21
  • 43
  • 52
Majo_Jose
  • 744
  • 1
  • 10
  • 24
  • 2
    Note that VAR models are best suited for finding (inter-)dependencies between the different series over time. If there isn't a reason to think that any series impacts any others over time, VAR might be over-engineering. – tb. Sep 06 '19 at 15:08
1

Try this

from statsmodels.tsa.vector_ar.var_model import VAR
import numpy as np
model = VAR(endog=np.asarray(train))
model_fit = model.fit()
prediction = model_fit.forecast(model_fit.y, steps=len(valid))
Nikhil G
  • 519
  • 4
  • 9