Time-series

Time series is series of Data points plotted with respect to time.

What is ARIMA in time series forecasting?

By Andrew Sam

A time series data is a pattern where a metric is recorded at constant interval of time. A time series can have any granularity like based on years, quarters, months, weeks, days, hours or seconds. Time series becomes more valuable when we are able to implement forecasting in it. Forecasting brings in a lot of commercial values, just imagine how important it is to maintain demand and supply ratio. You cannot maintain demand and supply in a big supply chain management system without forecasting. 

What is ARIMA forecasting?

ARIMA stands for Auto Regressive Integrated Moving Average. ARIMA is a forecasting algorithm and depicts those informational values in the past could be used to predict the future. ARIMA models basically explain a given time series based on their past values. In ARIMA ‘AR’ stands for autoregressive, which means a model that uses the relationship between today’s datapoint and previous historical observations. ‘I’ stands for integrated, which means the use of differencing raw observations in order to make the time series stationary. ‘MA’ stands for moving average, which means a model that uses dependency on observation and the MA model on historical observation. If a time series has seasonal patterns, then Arima becomes Sarima, here it means seasonal Arima. 

What does p, d and q in Arima model mean?

Any Arima model has 3 characters namely – p, d and q where p is the order of AR term, q is the order of MA term, d is the number of differencing required to make the time series stationary. Here p means the number of lag operations included in the model, d means the number of times that the raw observations are differenced, also called the degree of differencing. Q in the end means the size of the moving average window. 

What are AR and MA models?

A pure Autoregressive model is the one in which Yt depends only on its own lags. It can be also said that Yt is the function of ‘lags of Yt’.  

We can see the equation for AR model above. In the equation Y(t-1) stand for lagged value of Y(t), B1 is the co-efficient of the lag1 that model estimates and ‘alpha-a’ is the intercept term that model estimates. 

Similarly, a pure Moving Average model is the one in which Yt depends only on the lagged forecast errors.  

In the above equations error terms are the errors of AR models of their respective lags. We get the final equation for ARIMA model by combining both of the above equations of AR and MA, in words it could be written as 

Prediction = Constant + Linear Combination Lags of Differenced TS (up to p lags) + Linear Combination of Lagged Moving Averages (up to q lags) 

What is PACF?

PACF stands for Partial Autocorrelated functions. Auto-correlation function can be considered as relation between the observation at current time spot and the observations at previous time spots. PACF is the Auto-correlation function when we take out the influence of previous observations. Example, today’s stock price can be correlated to yesterday, and yesterday can be correlated to the day before. PACF calculates the “real” correlation between today and yesterday after taking out the influence of previous days 

The ACF and PACF plots help us to verify that the Time Series is stationary, as well as help us determine the parameters for modelling. In practice we use PACF to evaluate the (Auto Regression) AR model 

How can we determine AR using PACF?

For example, if the PACF of yesterday’s stock price is significant, and all other day’s PACFs are not significant, then yesterday’s stock price will be used to predict today’s stock price. This AR model is called first-order autoregression model. If both yesterdays and the previous day’s PACFs are significant, then we use yesterdays and the day before prices to predict today’s stock price. We call that second-order autoregression, because we use two previous stock prices to predict today’s stock price. 

What is Akaike’s Information Criterion in ARIMA?

Akaike’s Information Criterion (aka AIC), is a criterion used for selecting predictors in regression. It is also useful for determining the order of an ARIMA model. It is an estimator of prediction error and therefore provide the relative quality of a statistical model. The less the AIC score, the better. 

ARIMA and SARIMA models are considered as our first step in forecasting, as they are only forecasting on themselves. Further improvements can be made by considering exogenous variables, which are variables which correlate well with our target variable. We will read about them in upcoming advanced articles.