aseb
aseb

Reputation: 27

Statsmodels ARIMA forecasts

How does the forecasting work in case of ARIMA models? Say I have training period that ends in 2020Q1 and wants to make forecasts from 2021Q1 till 2023Q1. In this case, will the model generate forecasts from 2020Q2 till 2023Q1 (11 forcast values) as the training period ends at 2020Q1?

Upvotes: 0

Views: 49

Answers (1)

Michael Grogan
Michael Grogan

Reputation: 1026

To answer your question directly, you can set the ARIMA forecast to make predictions for any number of steps into the future. The configurations that should be used is another matter and is dependent on the data and problem you are working with.

For instance, given an ARIMA model of a certain configuration below and to make a forecast of n steps ahead using statsmodels, this can be accomplished as follows:

model=sm.tsa.statespace.sarimax.SARIMAX(endog=train_df,order=(1,0,0),seasonal_order=(2,1,0,12),trend='c',enforce_invertibility=False)
results=model.fit()
predictions=results.predict(731, 912, typ='levels')

In the below example, a forecast of monthly weather patterns for 182 months is made - but the ARIMA model was trained on 731 months of historical data in order to make these forecasts.

test vs prediction

However, if the model had only been trained on 12 prior months of data - this would not be sufficient to make predictions across a time period of 182 months.

In your case, if you are making quarterly forecasts from 2021Q1 till 2023Q1 inclusive, then h=9 since 9 quarters are being taken into account. However, if your training data ends at 2020Q1, then it would be prudent to ensure that you have a sufficient number of quarters across your training data to train the model.

Upvotes: 0

Related Questions