# Autoregressive–moving-average model

__: Statistical model used in time series analysis__

**Short description**

In the statistical analysis of time series, **autoregressive–moving-average** (**ARMA**) **models** provide a parsimonious description of a (weakly) stationary stochastic process in terms of two polynomials, one for the autoregression (AR) and the second for the moving average (MA). The general ARMA model was described in the 1951 thesis of Peter Whittle, *Hypothesis testing in time series analysis*, and it was popularized in the 1970 book by George E. P. Box and Gwilym Jenkins.

Given a time series of data [math]\displaystyle{ X_t }[/math], the ARMA model is a tool for understanding and, perhaps, predicting future values in this series. The AR part involves regressing the variable on its own lagged (i.e., past) values. The MA part involves modeling the error term as a linear combination of error terms occurring contemporaneously and at various times in the past. The model is usually referred to as the ARMA(*p*,*q*) model where *p* is the order of the AR part and *q* is the order of the MA part (as defined below).

ARMA models can be estimated by using the Box–Jenkins method.

## Autoregressive model

The notation AR(*p*) refers to the autoregressive model of order *p*. The AR(*p*) model is written as

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

where [math]\displaystyle{ \varphi_1, \ldots, \varphi_p }[/math] are parameters and the random variable [math]\displaystyle{ \varepsilon_t }[/math] is white noise, usually independent and identically distributed (i.i.d.) normal random variables.^{[1]}^{[2]}

In order for the model to remain stationary, the roots of its characteristic polynomial must lie outside of the unit circle. For example, processes in the AR(1) model with [math]\displaystyle{ |\varphi_1| \ge 1 }[/math] are not stationary because the root of [math]\displaystyle{ 1 - \varphi_1B = 0 }[/math] lies within the unit circle.^{[3]}

## Moving-average model

The notation MA(*q*) refers to the moving average model of order *q*:

- [math]\displaystyle{ X_t = \mu + \varepsilon_t + \sum_{i=1}^q \theta_i \varepsilon_{t-i}\, }[/math]

where the [math]\displaystyle{ \theta_1,...,\theta_q }[/math] are the parameters of the model, [math]\displaystyle{ \mu }[/math] is the expectation of [math]\displaystyle{ X_t }[/math] (often assumed to equal 0), and the [math]\displaystyle{ \varepsilon_t }[/math], [math]\displaystyle{ \varepsilon_{t-1} }[/math],... are again i.i.d. white noise error terms that are commonly normal random variables.^{[4]}

## ARMA model

The notation ARMA(*p*, *q*) refers to the model with *p* autoregressive terms and *q* moving-average terms. This model contains the AR(*p*) and MA(*q*) models,^{[5]}

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

The general ARMA model was described in the 1951 thesis of Peter Whittle, who used mathematical analysis (Laurent series and Fourier analysis) and statistical inference.^{[6]}^{[7]} ARMA models were popularized by a 1970 book by George E. P. Box and Jenkins, who expounded an iterative (Box–Jenkins) method for choosing and estimating them. This method was useful for low-order polynomials (of degree three or less).^{[8]}

The ARMA model is essentially an infinite impulse response filter applied to white noise, with some additional interpretation placed on it.

## Specification in terms of lag operator

In some texts the models will be specified in terms of the lag operator *L*.
In these terms then the AR(*p*) model is given by

- [math]\displaystyle{ \varepsilon_t = \left(1 - \sum_{i=1}^p \varphi_i L^i\right) X_t = \varphi (L) X_t\, }[/math]

where [math]\displaystyle{ \varphi }[/math] represents the polynomial

- [math]\displaystyle{ \varphi (L) = 1 - \sum_{i=1}^p \varphi_i L^i.\, }[/math]

The MA(*q*) model is given by

- [math]\displaystyle{ X_t = \left(1 + \sum_{i=1}^q \theta_i L^i\right) \varepsilon_t = \theta (L) \varepsilon_t , \, }[/math]

where [math]\displaystyle{ \theta }[/math] represents the polynomial

- [math]\displaystyle{ \theta(L)= 1 + \sum_{i=1}^q \theta_i L^i .\, }[/math]

Finally, the combined ARMA(*p*, *q*) model is given by

- [math]\displaystyle{ \left(1 - \sum_{i=1}^p \varphi_i L^i\right) X_t = \left(1 + \sum_{i=1}^q \theta_i L^i\right) \varepsilon_t \, , }[/math]

or more concisely,

- [math]\displaystyle{ \varphi(L) X_t = \theta(L) \varepsilon_t \, }[/math]

or

- [math]\displaystyle{ \frac{\varphi(L)}{\theta(L)}X_t = \varepsilon_t \, . }[/math]

### Alternative notation

Some authors, including Box, Jenkins & Reinsel use a different convention for the autoregression coefficients.^{[9]} This allows all the polynomials involving the lag operator to appear in a similar form throughout. Thus the ARMA model would be written as

- [math]\displaystyle{ \left(1 - \sum_{i=1}^p \phi_i L^i\right) X_t = \left(1 + \sum_{i=1}^q \theta_i L^i\right) \varepsilon_t \, . }[/math]

Moreover, starting summations from [math]\displaystyle{ i=0 }[/math] and setting [math]\displaystyle{ \phi_0 = -1 }[/math] and [math]\displaystyle{ \theta_0 = 1 }[/math], then we get an even more elegant formulation: [math]\displaystyle{ -\sum_{i=0}^p \phi_i L^i \; X_t = \sum_{i=0}^q \theta_i L^i \; \varepsilon_t \, . }[/math]

### Alternative interpretation

In digital signal processing, the ARMA model is represented as a digital filter with white noise at the input and the ARMA process at the output.

## Fitting models

### Choosing p and q

Finding appropriate values of *p* and *q* in the ARMA(*p*,*q*) model can be facilitated by plotting the partial autocorrelation functions for an estimate of *p*, and likewise using the autocorrelation functions for an estimate of *q*. Extended autocorrelation functions (EACF) can be used to simultaneously determine p and q.^{[10]} Further information can be gleaned by considering the same functions for the residuals of a model fitted with an initial selection of *p* and *q*.

Brockwell & Davis recommend using Akaike information criterion (AIC) for finding *p* and *q*.^{[11]} Another possible choice for order determining is the BIC criterion.

### Estimating coefficients

ARMA models in general can be, after choosing *p* and *q*, fitted by least squares regression to find the values of the parameters which minimize the error term. It is generally considered good practice to find the smallest values of *p* and *q* which provide an acceptable fit to the data. For a pure AR model the Yule-Walker equations may be used to provide a fit.

Unlike other methods of regression (i.e. OLS, 2SLS, etc.) often employed in econometric analysis, ARMA model outputs are used primarily for the cases of forecasting time-series data. Their coefficients are then as such only utilized for prediction. Other areas of econometrics look at the causal inference, time-series forecasting using ARMA is not. The coefficients should then only be seen as useful for predictive modelling.

### Implementations in statistics packages

- In R, the
*arima*function (in standard package*stats*) is documented in ARIMA Modelling of Time Series. Extension packages contain related and extended functionality, e.g., the*tseries*package includes an*arma*function, documented in "Fit ARMA Models to Time Series"; the*fracdiff*package contains*fracdiff()*for fractionally integrated ARMA processes; and the*forecast*package includes*auto.arima*for selecting a parsimonious set of*p,q*. The CRAN task view on Time Series contains links to most of these. - Mathematica has a complete library of time series functions including ARMA.
^{[12]} - MATLAB includes functions such as
*arma*and*ar*to estimate AR, ARX (autoregressive exogenous), and ARMAX models. See System Identification Toolbox and Econometrics Toolbox for more information. - Julia has some community driven packages that implement fitting with an ARMA model such as
*arma.jl*. - Statsmodels Python module includes many models and functions for time series analysis, including ARMA. Formerly part of the scikit-learn library, it is now stand-alone and integrates well with Pandas. See here for more details.
- PyFlux has a Python-based implementation of ARIMAX models, including Bayesian ARIMAX models.
- IMSL Numerical Libraries are libraries of numerical analysis functionality including ARMA and ARIMA procedures implemented in standard programming languages like C, Java, C# .NET, and Fortran.
- gretl can also estimate ARMA model, see here where it's mentioned.
- GNU Octave can estimate AR models using functions from the extra package octave-forge.
- Stata includes the function
*arima*which can estimate ARMA and ARIMA models. See here for more details. - SuanShu is a Java library of numerical methods, including comprehensive statistics packages, in which univariate/multivariate ARMA, ARIMA, ARMAX, etc. models are implemented in an object-oriented approach. These implementations are documented in "SuanShu, a Java numerical and statistical library".
- SAS has an econometric package, ETS, that estimates ARIMA models. See here for more details.

## Spectrum

The spectral density of an ARMA process is[math]\displaystyle{ S(f) = \frac{\sigma^2}{2\pi} \left\vert \frac{\theta(e^{-if})}{\phi(e^{-if})} \right\vert^2 }[/math]where [math]\displaystyle{ \sigma^2 }[/math] is the variance of the white noise, [math]\displaystyle{ \theta }[/math] is the characteristic polynomial of the moving average part of the ARMA model, and [math]\displaystyle{ \phi }[/math] is the characteristic polynomial of the autoregressive part of the ARMA model.^{[13]}^{[14]}

## Applications

ARMA is appropriate when a system is a function of a series of unobserved shocks (the MA or moving average part) as well as its own behavior. For example, stock prices may be shocked by fundamental information as well as exhibiting technical trending and mean-reversion effects due to market participants.^{[citation needed]}

## Generalizations

The dependence of [math]\displaystyle{ X_t }[/math] on past values and the error terms ε_{t} is assumed to be linear unless specified otherwise. If the dependence is nonlinear, the model is specifically called a *nonlinear moving average* (NMA), *nonlinear autoregressive* (NAR), or *nonlinear autoregressive–moving-average* (NARMA) model.

Autoregressive–moving-average models can be generalized in other ways. See also autoregressive conditional heteroskedasticity (ARCH) models and autoregressive integrated moving average (ARIMA) models. If multiple time series are to be fitted then a vector ARIMA (or VARIMA) model may be fitted. If the time-series in question exhibits long memory then fractional ARIMA (FARIMA, sometimes called ARFIMA) modelling may be appropriate: see Autoregressive fractionally integrated moving average. If the data is thought to contain seasonal effects, it may be modeled by a SARIMA (seasonal ARIMA) or a periodic ARMA model.

Another generalization is the *multiscale autoregressive* (MAR) model. A MAR model is indexed by the nodes of a tree, whereas a standard (discrete time) autoregressive model is indexed by integers.

Note that the ARMA model is a **univariate** model. Extensions for the multivariate case are the vector autoregression (VAR) and Vector Autoregression Moving-Average (VARMA).

### Autoregressive–moving-average model with exogenous inputs model (ARMAX model)

The notation ARMAX(*p*, *q*, *b*) refers to the model with *p* autoregressive terms, *q* moving average terms and *b* exogenous inputs terms. This model contains the AR(*p*) and MA(*q*) models and a linear combination of the last *b* terms of a known and external time series [math]\displaystyle{ d_t }[/math]. It is given by:

- [math]\displaystyle{ X_t = \varepsilon_t + \sum_{i=1}^p \varphi_i X_{t-i} + \sum_{i=1}^q \theta_i \varepsilon_{t-i} + \sum_{i=1}^b \eta_i d_{t-i}.\, }[/math]

where [math]\displaystyle{ \eta_1, \ldots, \eta_b }[/math] are the * parameters* of the exogenous input [math]\displaystyle{ d_t }[/math].

Some nonlinear variants of models with exogenous variables have been defined: see for example Nonlinear autoregressive exogenous model.

Statistical packages implement the ARMAX model through the use of "exogenous" (that is, independent,) variables. Care must be taken when interpreting the output of those packages, because the estimated parameters usually (for example, in R^{[15]} and gretl) refer to the regression:

- [math]\displaystyle{ X_t - m_t = \varepsilon_t + \sum_{i=1}^p \varphi_i (X_{t-i} - m_{t-i}) + \sum_{i=1}^q \theta_i \varepsilon_{t-i}.\, }[/math]

where [math]\displaystyle{ m_t }[/math] incorporates all exogenous (or independent) variables:

- [math]\displaystyle{ m_t = c + \sum_{i=0}^b \eta_i d_{t-i}.\, }[/math]

## See also

- Autoregressive integrated moving average (ARIMA)
- Exponential smoothing
- Linear predictive coding
- Predictive analytics
- Infinite impulse response
- Finite impulse response

## References

- ↑ Box, George E. P. (1994) (in en).
*Time series analysis : forecasting and control*. Gwilym M. Jenkins, Gregory C. Reinsel (3rd ed.). Englewood Cliffs, N.J.: Prentice Hall. pp. 54. ISBN 0-13-060774-6. OCLC 28888762. https://www.worldcat.org/oclc/28888762. - ↑ Shumway, Robert H. (2000) (in en).
*Time series analysis and its applications*. David S. Stoffer. New York: Springer. pp. 90-91. ISBN 0-387-98950-1. OCLC 42392178. https://www.worldcat.org/oclc/42392178. - ↑ Box, George E. P.; Jenkins, Gwilym M.; Reinsel, Gregory C. (1994) (in en).
*Time series analysis : forecasting and control*(3rd ed.). Englewood Cliffs, N.J.: Prentice Hall. pp. 54-55. ISBN 0-13-060774-6. OCLC 28888762. https://www.worldcat.org/oclc/28888762. - ↑ Box, George E. P.; Jenkins, Gwilym M.; Reinsel, Gregory C.; Ljung, Greta M. (2016) (in en).
*Time series analysis : forecasting and control*(5th ed.). Hoboken, New Jersey: John Wiley & Sons, Incorporated. pp. 53. ISBN 978-1-118-67492-5. OCLC 908107438. https://www.worldcat.org/oclc/908107438. - ↑ Shumway, Robert H. (2000) (in en).
*Time series analysis and its applications*. David S. Stoffer. New York: Springer. pp. 98. ISBN 0-387-98950-1. OCLC 42392178. https://www.worldcat.org/oclc/42392178. - ↑ Hannan, Edward James (1970).
*Multiple time series*. Wiley series in probability and mathematical statistics. New York: John Wiley and Sons. - ↑ Whittle, P. (1951).
*Hypothesis Testing in Time Series Analysis*. Almquist and Wicksell. Whittle, P. (1963).*Prediction and Regulation*. English Universities Press. ISBN 0-8166-1147-5.- Republished as: Whittle, P. (1983).
*Prediction and Regulation by Linear Least-Square Methods*. University of Minnesota Press. ISBN 0-8166-1148-3.

- Republished as: Whittle, P. (1983).
- ↑ (Hannan Deistler): Hannan, E. J.; Deistler, Manfred (1988).
*Statistical theory of linear systems*. Wiley series in probability and mathematical statistics. New York: John Wiley and Sons. - ↑ Box, George; Jenkins, Gwilym M.; Reinsel, Gregory C. (1994).
*Time Series Analysis: Forecasting and Control*(Third ed.). Prentice-Hall. ISBN 0130607746. - ↑ Missouri State University. "Model Specification, Time Series Analysis". http://people.missouristate.edu/songfengzheng/Teaching/MTH548/Time%20Series-ch06.pdf.
- ↑ Brockwell, P. J.; Davis, R. A. (2009).
*Time Series: Theory and Methods*(2nd ed.). New York: Springer. p. 273. ISBN 9781441903198. - ↑ Time series features in Mathematica
- ↑ Rosenblatt, Murray (2000) (in en).
*Gaussian and non-Gaussian linear time series and random fields*. New York: Springer. pp. 10. ISBN 0-387-98917-X. OCLC 42061096. https://www.worldcat.org/oclc/42061096. - ↑ Wei, William W. S. (1990) (in en).
*Time series analysis : univariate and multivariate methods*. Redwood City, Calif.: Addison-Wesley Pub. pp. 242-243. ISBN 0-201-15911-2. OCLC 18166355. https://www.worldcat.org/oclc/18166355. - ↑ ARIMA Modelling of Time Series, R documentation

## Further reading

- Mills, Terence C. (1990).
*Time Series Techniques for Economists*. Cambridge University Press. ISBN 0521343399. https://archive.org/details/timeseriestechni0000mill. - Percival, Donald B.; Walden, Andrew T. (1993).
*Spectral Analysis for Physical Applications*. Cambridge University Press. ISBN 052135532X. - Francq, C.; Zakoïan, J.-M. (2005), "Recent results for linear time series models with non independent innovations", in Duchesne, P.; Remillard, B.,
*Statistical Modeling and Analysis for Complex Data Problems*, Springer, pp. 241–265.