Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to train statsmodels.tsa.ARIMA model with multiple series

The usual way to fit an ARIMA model with the statsmodels python package is:

model  = statsmodels.tsa.ARMA(series, order=(2,2))
result = model.fit(trend='nc', disp=1)

however, i have multiple time series data to train with, say, from the same underlying process, how could i do that?

like image 749
yeren1989 Avatar asked Feb 24 '18 12:02

yeren1989


People also ask

What is Statsmodels TSA Arima model?

This model is the basic interface for ARIMA-type models, including those with exogenous regressors and those with seasonal components. The most general form of the model is SARIMAX(p, d, q)x(P, D, Q, s). It also allows all specialized cases, including. autoregressive models: AR(p)

How can I improve my Arima model?

1- Check again the stationarity of the time series using augmented Dickey-Fuller (ADF) test. 2- Try to increase the number of predictors ( independent variables). 3- Try to increase the sample size (in case of monthly data, to use at least 4 years data.

What is ARIMA time series?

ARIMA is a method for forecasting or predicting future outcomes based on a historical time series. It is based on the statistical concept of serial correlation, where past data points influence future data points.

What is order in Arima model?

Non-seasonal ARIMA models are generally denoted ARIMA(p,d,q) where parameters p, d, and q are non-negative integers, p is the order (number of time lags) of the autoregressive model, d is the degree of differencing (the number of times the data have had past values subtracted), and q is the order of the moving-average ...


1 Answers

When you say, multiple time series data, it is not clear if they are of the same type. There is no straightforward way to specify multiple series in ARMA model. However you could use the 'exog' optional variable to indicate the second series.

Please refer for the actual definition of ARMA model.

model  = statsmodels.tsa.ARMA(endog = series1, exog=series2, order=(2,2))

Please refer for the explanation of the endog, exog variables.

Please see a working example of how this could be implemented

like image 77
prabhakar Avatar answered Oct 05 '22 23:10

prabhakar