- Autoregressive moving average model
In

statistics ,**autoregressive moving average**(**ARMA**)**models**, sometimes called**Box-Jenkins models**after the iterativeBox-Jenkins methodology usually used to estimate them, are typically applied totime series data.Given a time series of data "X"

_{"t"}, the ARMA model is a tool for understanding and, perhaps, predicting future values in this series. The model consists of two parts, an autoregressive (AR) part and a moving average (MA) part. The model is usually then referred to as the ARMA("p","q") model where "p" is the order of the autoregressive part and "q" is the order of the moving average part (as defined below).**Autoregressive model**The notation AR("p") refers to the autoregressive model of order "p". The AR("p") model is written

:$X\_t\; =\; c\; +\; sum\_\{i=1\}^p\; varphi\_i\; X\_\{t-i\}+\; varepsilon\_t\; .,$

where $varphi\_1,\; ldots,\; varphi\_p$ are the

**"parameters**" of the model, $c$ is a constant and $varepsilon\_t$ iswhite noise . The constant term is omitted by many authors for simplicity.An autoregressive model is essentially an all-pole

infinite impulse response filter with some additional interpretation placed on it.Some constraints are necessary on the values of the parameters of this model in order that the model remains stationary. For example, processes in the AR(1) model with |"φ"

_{1}| ≥ 1 are not stationary.**Example: An AR(1)-process**An AR(1)-process is given by:

:$X\_t\; =\; c\; +\; varphi\; X\_\{t-1\}+varepsilon\_t,,$

where $varepsilon\_t$ is a white noise process with zero mean and variance $sigma^2$.(Note: The subscript on $varphi\_1$ has been dropped.) The process is

wide sense stationary if $|varphi|<1$. (If $varphi=1$ then $X\_t$ exhibits aunit root and can also be considered as arandom walk , which is not wide sense stationary.) Assuming $|varphi|<1$ and denoting the mean by $mu$, we get:$mbox\{E\}(X\_t)=mbox\{E\}(c)+varphimbox\{E\}(X\_\{t-1\})+mbox\{E\}(varepsilon\_t)Rightarrow\; mu=c+varphimu+0.$

Thus

:$mu=frac\{c\}\{1-varphi\}.$

In particular, if $c\; =\; 0$, then the mean is 0.

The

variance can be shown to equal:$extrm\{var\}(X\_t)=E(X\_t^2)-mu^2=frac\{sigma^2\}\{1-varphi^2\}.$

The

autocovariance is given by:$B\_n=E(X\_\{t+n\}X\_t)-mu^2=frac\{sigma^2\}\{1-varphi^2\},,varphi^=e^$

which yields a Lorentzian profile for the spectral density:

:$Phi(omega)=frac\{1\}\{sqrt\{2pi,frac\{sigma^2\}\{1-varphi^2\},frac\{gamma\}\{pi(gamma^2+omega^2)\}$

where $gamma=1/\; au$ is the angular frequency associated with the decay time $au$.

An alternative expression for $X\_t$ can be derived by first substituting $c+varphi\; X\_\{t-2\}+varepsilon\_\{t-1\}$ for $X\_\{t-1\}$ in the defining equation. Continuing this process "N" times yields

:$X\_t=csum\_\{k=0\}^\{N-1\}varphi^k+varphi^NX\_\{t-N\}+sum\_\{k=0\}^\{N-1\}varphi^kvarepsilon\_\{t-k\}.$

For "N" approaching infinity, $varphi^N$ will approach zero and:

:$X\_t=frac\{c\}\{1-varphi\}+sum\_\{k=0\}^inftyvarphi^kvarepsilon\_\{t-k\}.$

It is seen that $X\_t$ is white noise convolved with the $varphi^k$ kernel plus the constant mean. If the white noise $varepsilon\_t$ is a

Gaussian process then $X\_t$ is also a Gaussian process. In other cases, thecentral limit theorem indicates that $X\_t$ will be approximately normally distributed when $varphi$ is close to one.**Calculation of the AR parameters**The AR("p") model is given by the equation

:$X\_t\; =\; sum\_\{i=1\}^p\; varphi\_i\; X\_\{t-i\}+\; varepsilon\_t.,$

It is based on parameters $varphi\_i$ 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**::$gamma\_m\; =\; sum\_\{k=1\}^p\; varphi\_k\; gamma\_\{m-k\}\; +\; sigma\_varepsilon^2delta\_m$

where "m" = 0, ... , "p", yielding "p" + 1 equations. $gamma\_m$ is the autocorrelation function of X, $sigma\_varepsilon$ is the standard deviation of the input noise process, and $delta\_m$ is the

Kronecker delta function .Because the last part of the equation is non-zero only if "m" = 0, the equation is usually solved by representing it as a matrix for "m" > 0, thus getting equation

:$egin\{bmatrix\}gamma\_1\; \backslash gamma\_2\; \backslash gamma\_3\; \backslash vdots\; \backslash end\{bmatrix\}$

=

egin{bmatrix}gamma_0 & gamma_{-1} & gamma_{-2} & dots \gamma_1 & gamma_0 & gamma_{-1} & dots \gamma_2 & gamma_{1} & gamma_{0} & dots \vdots & vdots & vdots & ddots \end{bmatrix}

egin{bmatrix}varphi_{1} \varphi_{2} \varphi_{3} \ vdots \end{bmatrix}

solving all $varphi$. For "m" = 0 have

:$gamma\_0\; =\; sum\_\{k=1\}^p\; varphi\_k\; gamma\_\{-k\}\; +\; sigma\_varepsilon^2$

which allows us to solve $sigma\_varepsilon^2$.

The above equations (the Yule-Walker equations) provide one route to estimating the parameters of an AR(p) model, by replacing the theoretical covariances with estimated values. One way of specificying the estimated covariances is equivalent to a calculation using

least squares regression of values "X"_{"t"}on the "'p" previous values of the same series.**Derivation**The equation defining the AR process is

:$X\_t\; =\; sum\_\{i=1\}^p\; varphi\_i,X\_\{t-i\}+\; varepsilon\_t.,$

Multiplying both sides by "X"

_{"t" − "m"}and taking expected value yields:$E\; [X\_t\; X\_\{t-m\}]\; =\; Eleft\; [sum\_\{i=1\}^p\; varphi\_i,X\_\{t-i\}\; X\_\{t-m\}\; ight]\; +\; E\; [varepsilon\_t\; X\_\{t-m\}]\; .$

Now, E ["X"

_{"t"}"X"_{"t" − "m"}] = γ_{"m"}by definition of the autocorrelation function. The values of the noise function are independent of each other, and "X"_{"t" − "m"}is independent of ε_{t}where "m" is greater than zero. For "m" > 0, E [ε_{"t"}"X"_{"t" − "m"] = 0. For "m" = 0,}:$E\; [varepsilon\_t\; X\_\{t\}]\; =\; Eleft\; [varepsilon\_t\; left(sum\_\{i=1\}^p\; varphi\_i,X\_\{t-i\}+\; varepsilon\_t\; ight)\; ight]\; =\; sum\_\{i=1\}^p\; varphi\_i,\; E\; [varepsilon\_t,X\_\{t-i\}]\; +\; E\; [varepsilon\_t^2]\; =\; 0\; +\; sigma\_varepsilon^2,$

Now we have, for "m" ≥ 0,

:$gamma\_m\; =\; Eleft\; [sum\_\{i=1\}^p\; varphi\_i,X\_\{t-i\}\; X\_\{t-m\}\; ight]\; +\; sigma\_varepsilon^2\; delta\_m.$

Furthermore,

:$Eleft\; [sum\_\{i=1\}^p\; varphi\_i,X\_\{t-i\}\; X\_\{t-m\}\; ight]\; =\; sum\_\{i=1\}^p\; varphi\_i,E\; [X\_\{t\}\; X\_\{t-m+i\}]\; =\; sum\_\{i=1\}^p\; varphi\_i,gamma\_\{m-i\},$

which yields the Yule-Walker equations:

:$gamma\_m\; =\; sum\_\{i=1\}^p\; varphi\_i\; gamma\_\{m-i\}\; +\; sigma\_varepsilon^2\; delta\_m.$

for "m" ≥ 0. For "m" < 0,

:$gamma\_m\; =\; gamma\_\{-m\}\; =\; sum\_\{i=1\}^p\; varphi\_i\; gamma\_\{|m|-i\}\; +\; sigma\_varepsilon^2\; delta\_m.$

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

:$X\_t\; =\; varepsilon\_t\; +\; sum\_\{i=1\}^q\; heta\_i\; varepsilon\_\{t-i\},$

where the θ

_{1}, ..., θ_{"q"}are the parameters of the model and the ε_{t}, ε_{t-1},... are again, the error terms. The moving average model is essentially afinite impulse response filter with some additional interpretation placed on it.**Autoregressive moving average 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,

:$X\_t\; =\; varepsilon\_t\; +\; sum\_\{i=1\}^p\; varphi\_i\; X\_\{t-i\}\; +\; sum\_\{i=1\}^q\; heta\_i\; varepsilon\_\{t-i\}.,$

**Note about the error terms**The error terms ε

_{t}are generally assumed to beindependent identically-distributed random variables (i.i.d.) sampled from anormal distribution with zero mean: ε_{t}~ N(0,σ^{2}) where σ^{2}isthe variance. These assumptions may be weakened but doing so will change the properties of the model. In particular, a change to the i.i.d. assumption would make a rather fundamental difference.**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:$varepsilon\_t\; =\; left(1\; -\; sum\_\{i=1\}^p\; varphi\_i\; L^i\; ight)\; X\_t\; =\; varphi\; X\_t,$

where φ represents the polynomial

:$varphi\; =\; 1\; -\; sum\_\{i=1\}^p\; varphi\_i\; L^i.,$

The MA("q") model is given by

:$X\_t\; =\; left(1\; +\; sum\_\{i=1\}^q\; heta\_i\; L^i\; ight)\; varepsilon\_t\; =\; heta\; varepsilon\_t\; ,\; ,$

where θ represents the polynomial

:$heta=\; 1\; +\; sum\_\{i=1\}^q\; heta\_i\; L^i\; .,$

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

:$left(1\; -\; sum\_\{i=1\}^p\; varphi\_i\; L^i\; ight)\; X\_t\; =\; left(1\; +\; sum\_\{i=1\}^q\; heta\_i\; L^i\; ight)\; varepsilon\_t\; ,\; ,$

or more concisely,

:$varphi\; X\_t\; =\; heta\; varepsilon\_t\; ,$

**Alternative notation**Some authors, including Box, Jenkins & Reinsel (1994) use a different convention for the autoregression coefficients. This allows all the polynomials involving the lag operator to appear in a similar form throughout. Thus the ARMA model would be written as:$left(1\; +\; sum\_\{i=1\}^p\; phi\_i\; L^i\; ight)\; X\_t\; =\; left(1\; +\; sum\_\{i=1\}^q\; heta\_i\; L^i\; ight)\; varepsilon\_t\; ,\; .$

**Fitting models**ARMA models in general can, after choosing p and q, be 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.**Implementations in statistics packages*** In R, library "tseries" includes an "arma" function. The function is documented in [

*http://finzi.psych.upenn.edu/R/library/tseries/html/arma.html "Fit ARMA Models to Time Series"*] .

*MATLAB includes a function "ar" to estimate AR models, [*http://www.mathworks.com/access/helpdesk/help/toolbox/ident/index.html?/access/helpdesk/help/toolbox/ident/ref/ar.html see here for more details*] .

*gretl probably can also estimate ARMA models, [*http://constantdream.wordpress.com/2008/03/16/gnu-regression-econometrics-and-time-series-library-gretl/ see here where it's mentioned*] .**Applications**ARMA is appropriate when a system is a function of a series of unobserved shocks (the MA part)Clarifyme|date=March 2008 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.

**Generalizations**The dependence of "X"

_{"t"}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 andautoregressive 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: seeAutoregressive 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. See

multiscale autoregressive model for a list of references.Note that the ARMA model is an

**univariate**model. Extensions for the multivariate case are theVector 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 $d\_t$. It is given by:

:$X\_t\; =\; varepsilon\_t\; +\; sum\_\{i=1\}^p\; varphi\_i\; X\_\{t-i\}\; +\; sum\_\{i=1\}^q\; heta\_i\; varepsilon\_\{t-i\}\; +\; sum\_\{i=1\}^b\; eta\_i\; d\_\{t-i\}.,$where $eta\_1,\; ldots,\; eta\_b$ are the

**"parameters**" of the exogenous input $d\_t$.Some nonlinear variants of models with exogenous variables have been defined: see for example

Nonlinear autoregressive exogenous model .**ee also***

ARIMA

*Predictive analytics

*Radial basis function

*Linear predictive coding **References***

George Box ,Gwilym M. Jenkins , and Gregory C. Reinsel. "Time Series Analysis: Forecasting and Control", third edition. Prentice-Hall, 1994.

*Mills, Terence C. "Time Series Techniques for Economists." Cambridge University Press, 1990.

*Percival, Donald B. and Andrew T. Walden. "Spectral Analysis for Physical Applications." Cambridge University Press, 1993.

*Pandit, Sudhakar M. and Wu, Shien-Ming. "Time Series and System Analysis with Applications." John Wiley & Sons, Inc., 1983.**External links*** [

*http://www.statsoft.com/textbook/stathome.html Electronic Statistics Textbook*]

*Wikimedia Foundation.
2010.*