Artificial Intelligence in Plain English

New AI, ML and Data Science articles every day. Follow to join our 3.5M+ monthly readers.

Follow publication

A brief introduction to ARIMA models for time series forecasting

Photo by Carlos Muza (Unsplash)

What are ARIMA models?

ARIMA stands for Auto-Regressive Integrated Moving Average. It is a model used for statistical analysis of the time-series data. It helps to gain better insights into the data and predict future trends. It works very well with sales data. It is the generalization of the ARMA (autoregressive moving average) model.

  • A series is an ‘integrated (I)’ series if it has to be made stationary using differencing.

A dataset is stationary if it has a constant mean, variance and covariance over time. Differencing is the process of subtracting an observation from the previous time step observation until the data is stationary. There is a mathematical test ‘The Augmented Dickey-Fuller test’ to determine if the data is stationary.

  • The ‘autoregressive (AR)’ terms are the lags of the stationary series.
  • The ‘moving average (MA)’ terms are the lags of the forecast errors.

What are the types of ARIMA models?

There are two types of ARIMA models based on the type of data:

  1. Non-seasonal ARIMA — for non-seasonal data;
  2. Seasonal ARIMA — for seasonal data.

What are the steps to build an ARIMA model?

1. ARIMA models are applied to stationary data only. If the data is not stationary then it is done so by the process of differencing.

2. The autocorrelation and partial autocorrelation patterns are studied to see if there are lags in the data or forecast errors should be added in the forecasting equation.

3. Then the model is fitted and checked for residuals using the ACF and PACF plots. The pattern and the coefficients are checked.

— ACF stands for autocorrelation function. The autocorrelation plot is also called a correlogram as it depicts the correlation of the time series where the observations are lagged by k time units.

— PACF stands for partial autocorrelation function. It is a conditional correlation between the variables where there is an assumption of values of some other set of variables. If y is the output variable and x1, x2 and x3 are the input variables. Then the partial correlation between y and x3 is determined by taking into consideration the relation of y and x3 with x1 and x2.

4. The patterns in the ACF and PACF plots can help ascertain the need for AR/MA terms.

What is the “ARIMA(p,d,q)” model?

The non-seasonal ARIMA model is represented using 3 non-negative components. They are:

  • p = the number of autoregressive terms

It is the autoregressive part of the model and denotes the number of lag observations. The relation between the current observation and the previous period observations are taken into account.

  • d = the number of nonseasonal differences

It is the integrated part of the model and denotes the number of times the observations are differenced. It takes into account the differencing so as to make the data stationary.

  • q = the number of moving-average terms

It is the moving average part of the model and denotes the size of the moving average window (order of moving average). It utilizes the relation between observation and residual error from a MA.

Note: When using the ARIMA model, the goal is to figure out which component to use — AR or MA or both along with how many lags to be used for differencing.

How does ACF decide the component of the ARIMA model?

  • If the autocorrelation plot at the first lag (lag-1) shows positive autocorrelation, then the AR terms are used.
  • If the autocorrelation plot at the first lag shows negative autocorrelation, then the MA terms are used.

Note: ACF is the best way to identify a MA model.

How does PACF decide the component of the ARIMA model?

  • If there is a sharp drop in the plot after the lag ‘k’ then the AR component is used.
  • If there is a gradual decline, then the MA component is used.

Note: PACF is the best way to identify an AR model.

Reach out to me: LinkedIn

Check out my other work: GitHub

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Published in Artificial Intelligence in Plain English

New AI, ML and Data Science articles every day. Follow to join our 3.5M+ monthly readers.

Written by Jayashree domala

Self-driven woman who wishes to deliver creative and engaging ideas and solutions in the field of technology.

No responses yet

Write a response