# Autoregressive model

__: Representation of a type of random process__

**Short description**In statistics, econometrics and signal processing, an **autoregressive** (**AR**) **model** is a representation of a type of random process; as such, it is used to describe certain time-varying processes in nature, economics, etc. The autoregressive model specifies that the output variable depends linearly on its own previous values and on a stochastic term (an imperfectly predictable term); thus the model is in the form of a stochastic difference equation (or recurrence relation which should not be confused with differential equation). Together with the moving-average (MA) model, it is a special case and key component of the more general autoregressive–moving-average (ARMA) and autoregressive integrated moving average (ARIMA) models of time series, which have a more complicated stochastic structure; it is also a special case of the vector autoregressive model (VAR), which consists of a system of more than one interlocking stochastic difference equation in more than one evolving random variable.

Contrary to the moving-average (MA) model, the autoregressive model is not always stationary as it may contain a unit root.

## Definition

The notation [math]\displaystyle{ AR(p) }[/math] indicates an autoregressive model of order *p*. The AR(*p*) model is defined as

- [math]\displaystyle{ X_t = c + \sum_{i=1}^p \varphi_i X_{t-i}+ \varepsilon_t \, }[/math]

where [math]\displaystyle{ \varphi_1, \ldots, \varphi_p }[/math] are the *parameters* of the model, [math]\displaystyle{ c }[/math] is a constant, and [math]\displaystyle{ \varepsilon_t }[/math] is white noise. This can be equivalently written using the backshift operator *B* as

- [math]\displaystyle{ X_t = c + \sum_{i=1}^p \varphi_i B^i X_{t-1} + \varepsilon_t }[/math]

so that, moving the summation term to the left side and using polynomial notation, we have

- [math]\displaystyle{ \phi [B]X_t= c + \varepsilon_t \, . }[/math]

An autoregressive model can thus be viewed as the output of an all-pole infinite impulse response filter whose input is white noise.

Some parameter constraints are necessary for the model to remain wide-sense stationary. For example, processes in the AR(1) model with [math]\displaystyle{ |\varphi_1 | \geq 1 }[/math] are not stationary. More generally, for an AR(*p*) model to be wide-sense stationary, the roots of the polynomial [math]\displaystyle{ \Phi(z):=\textstyle 1 - \sum_{i=1}^p \varphi_i z^{i} }[/math] must lie outside the unit circle, i.e., each (complex) root [math]\displaystyle{ z_i }[/math] must satisfy [math]\displaystyle{ |z_i |\gt 1 }[/math] (see pages 89,92 ^{[1]}).

## Intertemporal effect of shocks

In an AR process, a one-time shock affects values of the evolving variable infinitely far into the future. For example, consider the AR(1) model [math]\displaystyle{ X_t = c + \varphi_1 X_{t-1} + \varepsilon_t }[/math]. A non-zero value for [math]\displaystyle{ \varepsilon_t }[/math] at say time *t*=1 affects [math]\displaystyle{ X_1 }[/math] by the amount [math]\displaystyle{ \varepsilon_1 }[/math]. Then by the AR equation for [math]\displaystyle{ X_2 }[/math] in terms of [math]\displaystyle{ X_1 }[/math], this affects [math]\displaystyle{ X_2 }[/math] by the amount [math]\displaystyle{ \varphi_1 \varepsilon_1 }[/math]. Then by the AR equation for [math]\displaystyle{ X_3 }[/math] in terms of [math]\displaystyle{ X_2 }[/math], this affects [math]\displaystyle{ X_3 }[/math] by the amount [math]\displaystyle{ \varphi_1^2 \varepsilon_1 }[/math]. Continuing this process shows that the effect of [math]\displaystyle{ \varepsilon_1 }[/math] never ends, although if the process is stationary then the effect diminishes toward zero in the limit.

Because each shock affects *X* values infinitely far into the future from when they occur, any given value *X*_{t} is affected by shocks occurring infinitely far into the past. This can also be seen by rewriting the autoregression

- [math]\displaystyle{ \phi (B)X_t= \varepsilon_t \, }[/math]

(where the constant term has been suppressed by assuming that the variable has been measured as deviations from its mean) as

- [math]\displaystyle{ X_t= \frac{1}{\phi (B)}\varepsilon_t \, . }[/math]

When the polynomial division on the right side is carried out, the polynomial in the backshift operator applied to [math]\displaystyle{ \varepsilon_t }[/math] has an infinite order—that is, an infinite number of lagged values of [math]\displaystyle{ \varepsilon_t }[/math] appear on the right side of the equation.

## Characteristic polynomial

The autocorrelation function of an AR(*p*) process can be expressed as

- [math]\displaystyle{ \rho(\tau) = \sum_{k=1}^p a_k y_k^{-|\tau|} , }[/math]

where [math]\displaystyle{ y_k }[/math] are the roots of the polynomial

- [math]\displaystyle{ \phi(B) = 1- \sum_{k=1}^p \varphi_k B^k }[/math]

where *B* is the backshift operator, where [math]\displaystyle{ \phi(\cdot) }[/math] is the function defining the autoregression, and where [math]\displaystyle{ \varphi_k }[/math] are the coefficients in the autoregression.

The autocorrelation function of an AR(*p*) process is a sum of decaying exponentials.

- Each real root contributes a component to the autocorrelation function that decays exponentially.
- Similarly, each pair of complex conjugate roots contributes an exponentially damped oscillation.

## Graphs of AR(*p*) processes

The simplest AR process is AR(0), which has no dependence between the terms. Only the error/innovation/noise term contributes to the output of the process, so in the figure, AR(0) corresponds to white noise.

For an AR(1) process with a positive [math]\displaystyle{ \varphi }[/math], only the previous term in the process and the noise term contribute to the output. If [math]\displaystyle{ \varphi }[/math] is close to 0, then the process still looks like white noise, but as [math]\displaystyle{ \varphi }[/math] approaches 1, the output gets a larger contribution from the previous term relative to the noise. This results in a "smoothing" or integration of the output, similar to a low pass filter.

For an AR(2) process, the previous two terms and the noise term contribute to the output. If both [math]\displaystyle{ \varphi_1 }[/math] and [math]\displaystyle{ \varphi_2 }[/math] are positive, the output will resemble a low pass filter, with the high frequency part of the noise decreased. If [math]\displaystyle{ \varphi_1 }[/math] is positive while [math]\displaystyle{ \varphi_2 }[/math] is negative, then the process favors changes in sign between terms of the process. The output oscillates. This can be likened to edge detection or detection of change in direction.

## Example: An AR(1) process

An AR(1) process is given by:

- [math]\displaystyle{ X_t = c + \varphi X_{t-1}+\varepsilon_t\, }[/math]

where [math]\displaystyle{ \varepsilon_t }[/math] is a white noise process with zero mean and constant variance [math]\displaystyle{ \sigma_\varepsilon^2 }[/math].
(Note: The subscript on [math]\displaystyle{ \varphi_1 }[/math] has been dropped.) The process is wide-sense stationary if [math]\displaystyle{ |\varphi|\lt 1 }[/math] since it is obtained as the output of a stable filter whose input is white noise. (If [math]\displaystyle{ \varphi=1 }[/math] then the variance of [math]\displaystyle{ X_t }[/math] depends on time lag t, so that the variance of the series diverges to infinity as t goes to infinity, and is therefore not wide sense stationary.) Assuming [math]\displaystyle{ |\varphi|\lt 1 }[/math], the mean [math]\displaystyle{ \operatorname{E} (X_t) }[/math] is identical for all values of *t* by the very definition of wide sense stationarity. If the mean is denoted by [math]\displaystyle{ \mu }[/math], it follows from

- [math]\displaystyle{ \operatorname{E} (X_t)=\operatorname{E} (c)+\varphi\operatorname{E} (X_{t-1})+\operatorname{E}(\varepsilon_t), }[/math]

that

- [math]\displaystyle{ \mu=c+\varphi\mu+0, }[/math]

and hence

- [math]\displaystyle{ \mu=\frac{c}{1-\varphi}. }[/math]

In particular, if [math]\displaystyle{ c = 0 }[/math], then the mean is 0.

The variance is

- [math]\displaystyle{ \textrm{var}(X_t)=\operatorname{E}(X_t^2)-\mu^2=\frac{\sigma_\varepsilon^2}{1-\varphi^2}, }[/math]

where [math]\displaystyle{ \sigma_\varepsilon }[/math] is the standard deviation of [math]\displaystyle{ \varepsilon_t }[/math]. This can be shown by noting that

- [math]\displaystyle{ \textrm{var}(X_t) = \varphi^2\textrm{var}(X_{t-1}) + \sigma_\varepsilon^2, }[/math]

and then by noticing that the quantity above is a stable fixed point of this relation.

The autocovariance is given by

- [math]\displaystyle{ B_n=\operatorname{E}(X_{t+n}X_t)-\mu^2=\frac{\sigma_\varepsilon^2}{1-\varphi^2}\,\,\varphi^{|n|}. }[/math]

It can be seen that the autocovariance function decays with a decay time (also called time constant) of [math]\displaystyle{ \tau=-1/\ln(\varphi) }[/math] [to see this, write [math]\displaystyle{ B_n=K\varphi^{|n|} }[/math] where [math]\displaystyle{ K }[/math] is independent of [math]\displaystyle{ n }[/math]. Then note that [math]\displaystyle{ \varphi^{|n|}=e^{|n|\ln\varphi} }[/math] and match this to the exponential decay law [math]\displaystyle{ e^{-n/\tau} }[/math]].

The spectral density function is the Fourier transform of the autocovariance function. In discrete terms this will be the discrete-time Fourier transform:

- [math]\displaystyle{ \Phi(\omega)= \frac{1}{\sqrt{2\pi}}\,\sum_{n=-\infty}^\infty B_n e^{-i\omega n} =\frac{1}{\sqrt{2\pi}}\,\left(\frac{\sigma_\varepsilon^2}{1+\varphi^2-2\varphi\cos(\omega)}\right). }[/math]

This expression is periodic due to the discrete nature of the [math]\displaystyle{ X_j }[/math], which is manifested as the cosine term in the denominator. If we assume that the sampling time ([math]\displaystyle{ \Delta t=1 }[/math]) is much smaller than the decay time ([math]\displaystyle{ \tau }[/math]), then we can use a continuum approximation to [math]\displaystyle{ B_n }[/math]:

- [math]\displaystyle{ B(t)\approx \frac{\sigma_\varepsilon^2}{1-\varphi^2}\,\,\varphi^{|t|} }[/math]

which yields a Lorentzian profile for the spectral density:

- [math]\displaystyle{ \Phi(\omega)= \frac{1}{\sqrt{2\pi}}\,\frac{\sigma_\varepsilon^2}{1-\varphi^2}\,\frac{\gamma}{\pi(\gamma^2+\omega^2)} }[/math]

where [math]\displaystyle{ \gamma=1/\tau }[/math] is the angular frequency associated with the decay time [math]\displaystyle{ \tau }[/math].

An alternative expression for [math]\displaystyle{ X_t }[/math] can be derived by first substituting [math]\displaystyle{ c+\varphi X_{t-2}+\varepsilon_{t-1} }[/math] for [math]\displaystyle{ X_{t-1} }[/math] in the defining equation. Continuing this process *N* times yields

- [math]\displaystyle{ X_t=c\sum_{k=0}^{N-1}\varphi^k+\varphi^NX_{t-N}+\sum_{k=0}^{N-1}\varphi^k\varepsilon_{t-k}. }[/math]

For *N* approaching infinity, [math]\displaystyle{ \varphi^N }[/math] will approach zero and:

- [math]\displaystyle{ X_t=\frac{c}{1-\varphi}+\sum_{k=0}^\infty\varphi^k\varepsilon_{t-k}. }[/math]

It is seen that [math]\displaystyle{ X_t }[/math] is white noise convolved with the [math]\displaystyle{ \varphi^k }[/math] kernel plus the constant mean. If the white noise [math]\displaystyle{ \varepsilon_t }[/math] is a Gaussian process then [math]\displaystyle{ X_t }[/math] is also a Gaussian process. In other cases, the central limit theorem indicates that [math]\displaystyle{ X_t }[/math] will be approximately normally distributed when [math]\displaystyle{ \varphi }[/math] is close to one.

### Explicit mean/difference form of AR(1) process

The AR(1) model is the discrete time analogy of the continuous Ornstein-Uhlenbeck process. It is therefore sometimes useful to understand the properties of the AR(1) model cast in an equivalent form. In this form, the AR(1) model, with process parameter [math]\displaystyle{ \theta }[/math] is given by:

- [math]\displaystyle{ X_{t+1} = X_t + (1-\theta)(\mu - X_t) + \epsilon_{t+1} }[/math], where [math]\displaystyle{ |\theta| \lt 1 \, }[/math] and [math]\displaystyle{ \mu }[/math] is the model mean.

By putting this in the form [math]\displaystyle{ X_{t+1} = c + \phi X_t\ +\epsilon_{t+1} }[/math], and then expanding the series for [math]\displaystyle{ X_{t+n} }[/math], one can show that:

- [math]\displaystyle{ \operatorname{E}(X_{t+n} | X_t) = \mu\left[1-\theta^n\right] + X_t\theta^n }[/math], and
- [math]\displaystyle{ \operatorname{Var} (X_{t+n} | X_t) = \sigma^2 \frac{ 1 - \theta^{2n} }{1 -\theta^2} }[/math].

## Choosing the maximum lag

The partial autocorrelation of an AR(p) process equals zero at lag which is not bigger than order of p^{[clarification needed]} and provides a good model for the correlation between [math]\displaystyle{ X_1 }[/math]and [math]\displaystyle{ X_{p+1} }[/math], so the appropriate maximum lag is the one beyond which the partial autocorrelations are all zero.

## Calculation of the AR parameters

There are many ways to estimate the coefficients, such as the ordinary least squares procedure or method of moments (through Yule–Walker equations).

The AR(*p*) model is given by the equation

- [math]\displaystyle{ X_t = \sum_{i=1}^p \varphi_i X_{t-i}+ \varepsilon_t.\, }[/math]

It is based on parameters [math]\displaystyle{ \varphi_i }[/math] where *i* = 1, ..., *p*. There is a direct correspondence between these parameters and the covariance function of the process, and this correspondence can be inverted to determine the parameters from the autocorrelation function (which is itself obtained from the covariances). This is done using the Yule–Walker equations.

### Yule–Walker equations

The Yule–Walker equations, named for Udny Yule and Gilbert Walker,^{[2]}^{[3]} are the following set of equations.^{[4]}

- [math]\displaystyle{ \gamma_m = \sum_{k=1}^p \varphi_k \gamma_{m-k} + \sigma_\varepsilon^2\delta_{m,0}, }[/math]

where *m* = 0, …, *p*, yielding *p* + 1 equations. Here [math]\displaystyle{ \gamma_m }[/math] is the autocovariance function of X_{t}, [math]\displaystyle{ \sigma_\varepsilon }[/math] is the standard deviation of the input noise process, and [math]\displaystyle{ \delta_{m,0} }[/math] is the Kronecker delta function.

Because the last part of an individual equation is non-zero only if *m* = 0, the set of equations can be solved by representing the equations for *m* > 0 in matrix form, thus getting the equation

- [math]\displaystyle{ \begin{bmatrix} \gamma_1 \\ \gamma_2 \\ \gamma_3 \\ \vdots \\ \gamma_p \\ \end{bmatrix} = \begin{bmatrix} \gamma_0 & \gamma_{-1} & \gamma_{-2} & \cdots \\ \gamma_1 & \gamma_0 & \gamma_{-1} & \cdots \\ \gamma_2 & \gamma_1 & \gamma_0 & \cdots \\ \vdots & \vdots & \vdots & \ddots \\ \gamma_{p-1} & \gamma_{p-2} & \gamma_{p-3} & \cdots \\ \end{bmatrix} \begin{bmatrix} \varphi_{1} \\ \varphi_{2} \\ \varphi_{3} \\ \vdots \\ \varphi_{p} \\ \end{bmatrix} }[/math]

which can be solved for all [math]\displaystyle{ \{\varphi_m; m=1,2, \dots ,p\}. }[/math] The remaining equation for *m* = 0 is

- [math]\displaystyle{ \gamma_0 = \sum_{k=1}^p \varphi_k \gamma_{-k} + \sigma_\varepsilon^2 , }[/math]

which, once [math]\displaystyle{ \{\varphi_m ; m=1,2, \dots ,p \} }[/math] are known, can be solved for [math]\displaystyle{ \sigma_\varepsilon^2 . }[/math]

An alternative formulation is in terms of the autocorrelation function. The AR parameters are determined by the first *p*+1 elements [math]\displaystyle{ \rho(\tau) }[/math] of the autocorrelation function. The full autocorrelation function can then be derived by recursively calculating
^{[5]}

- [math]\displaystyle{ \rho(\tau) = \sum_{k=1}^p \varphi_k \rho(k-\tau) }[/math]

Examples for some Low-order AR(*p*) processes

*p*=1- [math]\displaystyle{ \gamma_1 = \varphi_1 \gamma_0 }[/math]
- Hence [math]\displaystyle{ \rho_1 = \gamma_1 / \gamma_0 = \varphi_1 }[/math]

*p*=2- The Yule–Walker equations for an AR(2) process are
- [math]\displaystyle{ \gamma_1 = \varphi_1 \gamma_0 + \varphi_2 \gamma_{-1} }[/math]
- [math]\displaystyle{ \gamma_2 = \varphi_1 \gamma_1 + \varphi_2 \gamma_0 }[/math]

- Remember that [math]\displaystyle{ \gamma_{-k} = \gamma_k }[/math]
- Using the first equation yields [math]\displaystyle{ \rho_1 = \gamma_1 / \gamma_0 = \frac{\varphi_1}{1-\varphi_2} }[/math]
- Using the recursion formula yields [math]\displaystyle{ \rho_2 = \gamma_2 / \gamma_0 = \frac{\varphi_1^2 - \varphi_2^2 + \varphi_2}{1 - \varphi_2} }[/math]

- The Yule–Walker equations for an AR(2) process are

### Estimation of AR parameters

The above equations (the Yule–Walker equations) provide several routes to estimating the parameters of an AR(*p*) model, by replacing the theoretical covariances with estimated values.^{[6]} Some of these variants can be described as follows:

- Estimation of autocovariances or autocorrelations. Here each of these terms is estimated separately, using conventional estimates. There are different ways of doing this and the choice between these affects the properties of the estimation scheme. For example, negative estimates of the variance can be produced by some choices.
- Formulation as a least squares regression problem in which an ordinary least squares prediction problem is constructed, basing prediction of values of
*X*_{t}on the*p*previous values of the same series. This can be thought of as a forward-prediction scheme. The normal equations for this problem can be seen to correspond to an approximation of the matrix form of the Yule–Walker equations in which each appearance of an autocovariance of the same lag is replaced by a slightly different estimate. - Formulation as an extended form of ordinary least squares prediction problem. Here two sets of prediction equations are combined into a single estimation scheme and a single set of normal equations. One set is the set of forward-prediction equations and the other is a corresponding set of backward prediction equations, relating to the backward representation of the AR model:

- [math]\displaystyle{ X_t = c + \sum_{i=1}^p \varphi_i X_{t-i}+ \varepsilon^*_t \,. }[/math]

- Here predicted values of
*X*_{t}would be based on the*p*future values of the same series.^{[clarification needed]}This way of estimating the AR parameters is due to Burg,^{[7]}and is called the Burg method:^{[8]}Burg and later authors called these particular estimates "maximum entropy estimates",^{[9]}but the reasoning behind this applies to the use of any set of estimated AR parameters. Compared to the estimation scheme using only the forward prediction equations, different estimates of the autocovariances are produced, and the estimates have different stability properties. Burg estimates are particularly associated with maximum entropy spectral estimation.^{[10]}

Other possible approaches to estimation include maximum likelihood estimation. Two distinct variants of maximum likelihood are available: in one (broadly equivalent to the forward prediction least squares scheme) the likelihood function considered is that corresponding to the conditional distribution of later values in the series given the initial *p* values in the series; in the second, the likelihood function considered is that corresponding to the unconditional joint distribution of all the values in the observed series. Substantial differences in the results of these approaches can occur if the observed series is short, or if the process is close to non-stationarity.

## Spectrum

The power spectral density (PSD) of an AR(*p*) process with noise variance [math]\displaystyle{ \mathrm{Var}(Z_t) = \sigma_Z^2 }[/math] is^{[5]}

- [math]\displaystyle{ S(f) = \frac{\sigma_Z^2}{| 1-\sum_{k=1}^p \varphi_k e^{-i 2 \pi f k} |^2}. }[/math]

### AR(0)

For white noise (AR(0))

- [math]\displaystyle{ S(f) = \sigma_Z^2. }[/math]

### AR(1)

For AR(1)

- [math]\displaystyle{ S(f) = \frac{\sigma_Z^2}{| 1- \varphi_1 e^{-2 \pi i f} |^2} = \frac{\sigma_Z^2}{ 1 + \varphi_1^2 - 2 \varphi_1 \cos 2 \pi f } }[/math]

- If [math]\displaystyle{ \varphi_1 \gt 0 }[/math] there is a single spectral peak at f=0, often referred to as red noise. As [math]\displaystyle{ \varphi_1 }[/math] becomes nearer 1, there is stronger power at low frequencies, i.e. larger time lags. This is then a low-pass filter, when applied to full spectrum light, everything except for the red light will be filtered.
- If [math]\displaystyle{ \varphi_1 \lt 0 }[/math] there is a minimum at f=0, often referred to as blue noise. This similarly acts as a high-pass filter, everything except for blue light will be filtered.

### AR(2)

AR(2) processes can be split into three groups depending on the characteristics of their roots:

- [math]\displaystyle{ z_1,z_2 = -\frac{1}{2\varphi_2}\left(\varphi_1 \pm \sqrt{\varphi_1^2 + 4\varphi_2}\right) }[/math]

- When [math]\displaystyle{ \varphi_1^2 + 4\varphi_2 \lt 0 }[/math], the process has a pair of complex-conjugate roots, creating a mid-frequency peak at:

- [math]\displaystyle{ f^* = \frac{1}{2\pi}\cos^{-1}\left(\frac{\varphi_1(\varphi_2-1)}{4\varphi_2}\right) }[/math]

Otherwise the process has real roots, and:

- When [math]\displaystyle{ \varphi_1 \gt 0 }[/math] it acts as a low-pass filter on the white noise with a spectral peak at [math]\displaystyle{ f=0 }[/math]
- When [math]\displaystyle{ \varphi_1 \lt 0 }[/math] it acts as a high-pass filter on the white noise with a spectral peak at [math]\displaystyle{ f=1/2 }[/math].

The process is non-stationary when the roots are outside the unit circle. The process is stable when the roots are within the unit circle, or equivalently when the coefficients are in the triangle [math]\displaystyle{ -1 \le \varphi_2 \le 1 - |\varphi_1| }[/math].

The full PSD function can be expressed in real form as:

- [math]\displaystyle{ S(f) = \frac{\sigma_Z^2}{1 + \varphi_1^2 + \varphi_2^2 - 2\varphi_1(1-\varphi_2)\cos(2\pi f) - 2\varphi_2\cos(4\pi f)} }[/math]

## Implementations in statistics packages

- R, the
*stats*package includes an*ar*function.^{[11]} - MATLAB's Econometrics Toolbox
^{[12]}and System Identification Toolbox^{[13]}includes autoregressive models^{[14]} - Matlab and Octave: the
*TSA toolbox*contains several estimation functions for uni-variate, multivariate and adaptive autoregressive models.^{[15]} - PyMC3: the Bayesian statistics and probabilistic programming framework supports autoregressive modes with
*p*lags. *bayesloop*supports parameter inference and model selection for the AR-1 process with time-varying parameters.^{[16]}- Python: implementation in statsmodels.
^{[17]}

## Impulse response

The impulse response of a system is the change in an evolving variable in response to a change in the value of a shock term *k* periods earlier, as a function of *k*. Since the AR model is a special case of the vector autoregressive model, the computation of the impulse response in vector autoregression#impulse response applies here.

*n*-step-ahead forecasting

Once the parameters of the autoregression

- [math]\displaystyle{ X_t = c + \sum_{i=1}^p \varphi_i X_{t-i}+ \varepsilon_t \, }[/math]

have been estimated, the autoregression can be used to forecast an arbitrary number of periods into the future. First use *t* to refer to the first period for which data is not yet available; substitute the known preceding values *X*_{t-i} for *i=*1, ..., *p* into the autoregressive equation while setting the error term [math]\displaystyle{ \varepsilon_t }[/math] equal to zero (because we forecast *X*_{t} to equal its expected value, and the expected value of the unobserved error term is zero). The output of the autoregressive equation is the forecast for the first unobserved period. Next, use *t* to refer to the *next* period for which data is not yet available; again the autoregressive equation is used to make the forecast, with one difference: the value of *X* one period prior to the one now being forecast is not known, so its expected value—the predicted value arising from the previous forecasting step—is used instead. Then for future periods the same procedure is used, each time using one more forecast value on the right side of the predictive equation until, after *p* predictions, all *p* right-side values are predicted values from preceding steps.

There are four sources of uncertainty regarding predictions obtained in this manner: (1) uncertainty as to whether the autoregressive model is the correct model; (2) uncertainty about the accuracy of the forecasted values that are used as lagged values in the right side of the autoregressive equation; (3) uncertainty about the true values of the autoregressive coefficients; and (4) uncertainty about the value of the error term [math]\displaystyle{ \varepsilon_t \, }[/math] for the period being predicted. Each of the last three can be quantified and combined to give a confidence interval for the *n*-step-ahead predictions; the confidence interval will become wider as *n* increases because of the use of an increasing number of estimated values for the right-side variables.

## Evaluating the quality of forecasts

The predictive performance of the autoregressive model can be assessed as soon as estimation has been done if cross-validation is used. In this approach, some of the initially available data was used for parameter estimation purposes, and some (from available observations later in the data set) was held back for out-of-sample testing. Alternatively, after some time has passed after the parameter estimation was conducted, more data will have become available and predictive performance can be evaluated then using the new data.

In either case, there are two aspects of predictive performance that can be evaluated: one-step-ahead and *n*-step-ahead performance. For one-step-ahead performance, the estimated parameters are used in the autoregressive equation along with observed values of *X* for all periods prior to the one being predicted, and the output of the equation is the one-step-ahead forecast; this procedure is used to obtain forecasts for each of the out-of-sample observations. To evaluate the quality of *n*-step-ahead forecasts, the forecasting procedure in the previous section is employed to obtain the predictions.

Given a set of predicted values and a corresponding set of actual values for *X* for various time periods, a common evaluation technique is to use the mean squared prediction error; other measures are also available (see forecasting#forecasting accuracy).

The question of how to interpret the measured forecasting accuracy arises—for example, what is a "high" (bad) or a "low" (good) value for the mean squared prediction error? There are two possible points of comparison. First, the forecasting accuracy of an alternative model, estimated under different modeling assumptions or different estimation techniques, can be used for comparison purposes. Second, the out-of-sample accuracy measure can be compared to the same measure computed for the in-sample data points (that were used for parameter estimation) for which enough prior data values are available (that is, dropping the first *p* data points, for which *p* prior data points are not available). Since the model was estimated specifically to fit the in-sample points as well as possible, it will usually be the case that the out-of-sample predictive performance will be poorer than the in-sample predictive performance. But if the predictive quality deteriorates out-of-sample by "not very much" (which is not precisely definable), then the forecaster may be satisfied with the performance.

## See also

- Moving average model
- Linear difference equation
- Predictive analytics
- Linear predictive coding
- Resonance
- Levinson recursion
- Ornstein–Uhlenbeck process

## Notes

- ↑ Shumway, Robert; Stoffer, David (2010).
*Time series analysis and its applications : with R examples*(3rd ed.). Springer. ISBN 144197864X. - ↑ Yule, G. Udny (1927) "On a Method of Investigating Periodicities in Disturbed Series, with Special Reference to Wolfer's Sunspot Numbers",
*Philosophical Transactions of the Royal Society of London*, Ser. A, Vol. 226, 267–298.] - ↑ Walker, Gilbert (1931) "On Periodicity in Series of Related Terms",
*Proceedings of the Royal Society of London*, Ser. A, Vol. 131, 518–532. - ↑ Theodoridis, Sergios (2015-04-10). "Chapter 1. Probability and Stochastic Processes".
*Machine Learning: A Bayesian and Optimization Perspective*. Academic Press, 2015. pp. 9–51. ISBN 978-0-12-801522-3. - ↑
^{5.0}^{5.1}Von Storch, H.; F. W Zwiers (2001).*Statistical analysis in climate research*. Cambridge Univ Pr. ISBN 0-521-01230-9. - ↑ Eshel, Gidon. "The Yule Walker Equations for the AR Coefficients". http://www-stat.wharton.upenn.edu/~steele/Courses/956/Resource/YWSourceFiles/YW-Eshel.pdf.
- ↑ Burg, J. P. (1968). "A new analysis technique for time series data". In
*Modern Spectrum Analysis*(Edited by D. G. Childers), NATO Advanced Study Institute of Signal Processing with emphasis on Underwater Acoustics. IEEE Press, New York. - ↑ Brockwell, Peter J.; Dahlhaus, Rainer; Trindade, A. Alexandre (2005). "Modified Burg Algorithms for Multivariate Subset Autoregression".
*Statistica Sinica***15**: 197–213. http://www3.stat.sinica.edu.tw/statistica/oldpdf/A15n112.pdf. - ↑ Burg, J.P. (1967) "Maximum Entropy Spectral Analysis",
*Proceedings of the 37th Meeting of the Society of*Exploration Geophysicists*, Oklahoma City, Oklahoma.* - ↑ Bos, R.; De Waele, S.; Broersen, P. M. T. (2002). "Autoregressive spectral estimation by application of the burg algorithm to irregularly sampled data".
*IEEE Transactions on Instrumentation and Measurement***51**(6): 1289. doi:10.1109/TIM.2002.808031. http://resolver.tudelft.nl/uuid:870559f7-f1e9-4968-83da-edd19485eaaf. - ↑ "Fit Autoregressive Models to Time Series" (in R)
- ↑ "Econometrics Toolbox". https://www.mathworks.com/products/econometrics.html.
- ↑ "System Identification Toolbox". https://www.mathworks.com/products/sysid.html.
- ↑ "Autoregressive Model - MATLAB & Simulink". https://www.mathworks.com/help/econ/autoregressive-model.html.
- ↑ "The Time Series Analysis (TSA) toolbox for Octave and Matlab®". http://pub.ist.ac.at/~schloegl/matlab/tsa/.
- ↑ "christophmark/bayesloop". December 7, 2021. https://github.com/christophmark/bayesloop.
- ↑ "statsmodels.tsa.ar_model.AutoReg — statsmodels 0.12.2 documentation". https://www.statsmodels.org/stable/generated/statsmodels.tsa.ar_model.AutoReg.html.

## References

- Mills, Terence C. (1990).
*Time Series Techniques for Economists*. Cambridge University Press. https://archive.org/details/timeseriestechni0000mill. - Percival, Donald B.; Walden, Andrew T. (1993).
*Spectral Analysis for Physical Applications*. Cambridge University Press. - Pandit, Sudhakar M.; Wu, Shien-Ming (1983).
*Time Series and System Analysis with Applications*. John Wiley & Sons.

## External links

- AutoRegression Analysis (AR) by Paul Bourke
- Econometrics lecture (topic: Autoregressive models) on YouTube by Mark Thoma

Original source: https://en.wikipedia.org/wiki/Autoregressive model.
Read more |