The autoregressive moving average (ARMA) model and its generalization—the autoregressive integrated moving average (ARIMA) model—are the two most commonly used models to predict the future from time series data. The generalization of the ARIMA model comes from the integrated part: the first step of the model is to differentiate data before estimating the AR and MA parts.
To execute this recipe, you will need pandas
, NumPy
, Statsmodels
, and Matplotlib
. You will also need the data prepared in the previous recipe. No other prerequisites are required.
We wrap our process within methods so that most of the modeling is automated (the ts_arima.py
file):
def plot_functions(data, name): ''' Method to plot the ACF and PACF functions ''' # create the figure fig, ax = plt.subplots(2) # plot the functions sm.graphics.tsa.plot_acf(data, lags=18, ax=ax[0]) sm.graphics.tsa.plot_pacf(data, lags=18...