Last modified: December 15, 2024

This article is written in: 🇺🇸

Autoregressive (AR) Models in Time Series Analysis

Autoregressive (AR) models are fundamental tools in time series analysis, used to describe and forecast time-dependent data. An AR model predicts future values based on a linear combination of past observations. The order of an AR model, denoted as $p$, indicates how many lagged past values are used.

Definition of Autoregressive Models

An Autoregressive model of order $p$, denoted as AR($p$), is a type of stochastic process used for analyzing and forecasting time series data. The model expresses the current value of the series as a linear combination of its previous $p$ values plus a constant and a stochastic error term. Mathematically, it is defined by the equation:

$$X_t = c + \phi_1 X_{t-1} + \phi_2 X_{t-2} + \dots + \phi_p X_{t-p} + \epsilon_t$$

Alternatively, using summation notation:

$$X_t = c + \sum_{i=1}^{p} \phi_i X_{t-i} + \epsilon_t$$

Components of the AR($p$) Model

Properties of White Noise ($\epsilon_t$)

Autoregressive (AR) Models Overview

Order of an AR Model

The order of an autoregressive model, denoted as $p$ in AR($p$), specifies the number of lagged terms (previous values) used to predict the current value.

AR(1):

A first-order autoregressive model uses the immediately preceding value.

$$X_t = c + \phi_1 X_{t-1} + \epsilon_t$$

AR(2):

A second-order autoregressive model uses the two preceding values.

$$X_t = c + \phi_1 X_{t-1} + \phi_2 X_{t-2} + \epsilon_t$$

General AR($k$):

A $k$-th order autoregressive model uses the previous $k$ values.

$$X_t = c + \sum_{i=1}^{k} \phi_i X_{t-i} + \epsilon_t$$

Example: AR(2) Model in Practice

Suppose we aim to predict the current year's measurement $y_t$ using the measurements from the previous two years $y_{t-1}$ and $y_{t-2}$. The corresponding AR(2) model is:

$$y_t = B_0 + B_1 y_{t-1} + B_2 y_{t-2} + w_t$$

Where:

This model captures the dependence of $y_t$ on its two immediate past values, allowing for more nuanced predictions compared to an AR(1) model.

General Interpretation of AR($p$) Models

In a general AR($p$) model, the current value $X_t$ is modeled as a linear function of its past $p$ values. This setup is essentially a multiple linear regression where the predictors are the lagged terms of the time series itself. The model can be succinctly expressed as:

$$X_t = c + \phi_1 X_{t-1} + \phi_2 X_{t-2} + \dots + \phi_p X_{t-p} + \epsilon_t$$

Estimation of Parameters

Methods for Estimating Parameters ($c$ and $\phi_i$):

Least Squares Estimation:

Yule-Walker Equations:

Maximum Likelihood Estimation (MLE):

Model Selection for Autoregressive (AR) Models

Selecting the appropriate order $p$ for an Autoregressive (AR) model is essential for accurate time series forecasting. The order $p$ determines how many lagged values of the series are used to predict the current value. This section outlines the methodologies and criteria used to determine the optimal order of an AR model.

Autocorrelation Function (ACF)

The Autocorrelation Function (ACF) measures the correlation between the time series and its lagged versions. For a given lag $k$, the ACF is defined as:

$$r_k = \frac{\sum_{i=1}^{n-k} (Y_i - \overline{Y})(Y_{i+k} - \overline{Y})}{\sum_{i=1}^{n} (Y_i - \overline{Y})^2}$$

where:

In an AR($p$) process, the ACF typically shows a gradual decay as the lag increases.

For example, an AR(1) process with parameter $\phi = 0.8$ exhibits an exponential decay in the ACF.

Autocorrelation

Partial Autocorrelation Function (PACF)

The Partial Autocorrelation Function (PACF) measures the correlation between the time series and its lagged values after removing the effects of intermediate lags. Formally, the partial autocorrelation at lag $k$ is the correlation between $Y_t$ and $Y_{t-k}$ that is not explained by lags $1$ through $k-1$.

Below are ACF and PACF plots for AR(2) process:

ACF and PACF Plots

Information Criteria for Model Selection

Beyond visual inspection, statistical criteria can quantitatively assess the optimal model order by balancing model fit and complexity.

Akaike Information Criterion (AIC)

The Akaike Information Criterion (AIC) evaluates the trade-off between the goodness of fit of the model and its complexity. It is defined as:

$$\text{AIC} = -2 \ln(L) + 2k$$

where:

Bayesian Information Criterion (BIC)

The Bayesian Information Criterion (BIC) is similar to AIC but imposes a heavier penalty for models with more parameters, especially as the sample size $n$ increases. It is defined as:

$$\text{BIC} = -2 \ln(L) + k \ln(n)$$

where:

Steps for Selecting the Optimal AR Model Order

I. Plot ACF and PACF:

II. Estimate Models with Varying Orders:

Fit AR models with different orders $p$ (e.g., AR(1), AR(2), AR(3), etc.).

III. Compute AIC and BIC:

Calculate the AIC and BIC for each fitted model.

IV. Select the Model with the Lowest AIC/BIC:

Choose the model order $p$ that minimizes the AIC or BIC, balancing fit and complexity.

Example:

Suppose you have time series data and after plotting the ACF and PACF, you observe:

You then fit AR models with $p = 1, 2, 3$ and compute their AIC and BIC values:

Model AIC BIC
AR(1) 150 155
AR(2) 140 145
AR(3) 142 150

Both AIC and BIC are minimized at AR(2), indicating that an AR(2) model is the most appropriate choice.

Properties of AR Models

Stationarity in AR Models

Autocorrelation Function (ACF)

Partial Autocorrelation Function (PACF)

Example: AR(2) Model in Time Series Forecasting

Consider an AR model of order 2, denoted as AR(2). This model assumes that the value at a particular time point is a linear function of the two preceding values, plus some error term.

AR(2) Model Equation

The AR(2) model is given by:

$$X_t = c + \phi_1 X_{t-1} + \phi_2 X_{t-2} + \epsilon_t$$

Suppose we have:

Calculation

Plugging the values into the AR(2) equation:

$$X_t = 3 + 0.6 \times 10 - 0.2 \times 5 + \epsilon_t$$

$$X_t = 3 + 6 - 1 + \epsilon_t$$

$$X_t = 8 + \epsilon_t$$

Interpretation

Visualization

ar2_model

This visualization illustrates how the AR(2) model captures the underlying pattern of the time series. The model uses the two most recent values to make predictions, adjusting to the trends and fluctuations in the data.

Limitations of AR Models

Linearity Assumption

Stationarity Requirement

Sensitivity in Parameter Estimation

Complexity in Model Selection

Risk of Overfitting

Table of Contents

    Autoregressive (AR) Models in Time Series Analysis
    1. Definition of Autoregressive Models
    2. Components of the AR($p$) Model
    3. Order of an AR Model
    4. Example: AR(2) Model in Practice
    5. General Interpretation of AR($p$) Models
    6. Estimation of Parameters
    7. Model Selection for Autoregressive (AR) Models
      1. Autocorrelation Function (ACF)
      2. Partial Autocorrelation Function (PACF)
      3. Information Criteria for Model Selection
      4. Steps for Selecting the Optimal AR Model Order
    8. Properties of AR Models
    9. Example: AR(2) Model in Time Series Forecasting
      1. AR(2) Model Equation
      2. Visualization
    10. Limitations of AR Models