Reputation: 291
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?
Upvotes: 6
Views: 2119
Reputation: 350
If your time series has cycles or periodics and is continious: Look at your data as a grid. The first dimension is your time variable and your second dimension is the time series number.
In order to incorporate this concept you need to make sure that each time series has the exact same initial state and it is continious.
Here is an example: Assume power consumption in a city. You'll have 24hrs and 7 days cycles for sure in such scenarios. You can devide the time series from 0 to N:
Sat(0) ... Fri(0)
Sat(1) ... Fri(1)
. . .
Sat(N) ... Fri(N)
Instead of forecasting the end of each time series you can fore cast the N+1 data set by fitting your ARMA model over all Sat(0)...Sat(N) and obtain Sat(N+1) etc.
Repeat this for each day of the week and you'll get the next value.
If your data does't have preiodicities this method or any other method will never work.
If your time series doesn't have cycles or periodics and is segmented: You may want to use a statespace method to obtain the spectra of your dynamical system and make decsisions based on directions and magnitudes.
Upvotes: 0
Reputation: 572
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
Upvotes: 1