Jump to content

Autoregressive moving-average model: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Engheta (talk | contribs)
There is no constant "c" anywhere.
Reorder sections for flow
 
(27 intermediate revisions by 14 users not shown)
Line 2: Line 2:
{{redirect|ARMA model||ARMA (disambiguation)}}
{{redirect|ARMA model||ARMA (disambiguation)}}


In the [[statistics|statistical]] analysis of [[time series]], '''autoregressive–moving-average''' ('''ARMA''') '''models''' provide a parsimonious description of a [[stationary stochastic process|(weakly) stationary stochastic process]] in terms of two polynomials, one for the [[AR model|autoregression]] (AR) and the second for the [[MA model|moving average]] (MA). The general ARMA model was described in the 1951 thesis of [[Peter Whittle (mathematician)|Peter Whittle]], ''Hypothesis testing in time series analysis'', and it was popularized in the 1970 book by [[George E. P. Box]] and [[Gwilym Jenkins]].
In the [[statistics|statistical]] analysis of [[time series]], '''autoregressive–moving-average''' ('''ARMA''') '''models''' are a way to describe of a [[stationary stochastic process|(weakly) stationary stochastic process]] using [[AR model|autoregression]] (AR) and a [[MA model|moving average]] (MA), each with a polynomial. They are a tool for understanding a series and predicting future values. AR involves regressing the variable on its own lagged (i.e., past) values. MA involves modeling the [[errors and residuals in statistics|error]] as a [[linear combination]] of error terms occurring contemporaneously and at various times in the past. The model is usually denoted ARMA(''p'', ''q''), where ''p'' is the order of AR and ''q'' is the order of MA.


The general ARMA model was described in the 1951 thesis of [[Peter Whittle (mathematician)|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>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 [[errors and residuals in statistics|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]].
ARMA models can be estimated by using the [[Box–Jenkins method]].


== Autoregressive model ==
== Mathematical formulation ==

=== Autoregressive model ===
{{Main|Autoregressive model}}
{{Main|Autoregressive model}}
The notation AR(''p'') refers to the autoregressive model of order ''p''. The AR(''p'') model is written as
The notation AR(''p'') refers to the autoregressive model of order ''p''. The AR(''p'') model is written as
Line 14: Line 16:
:<math> X_t = \sum_{i=1}^p \varphi_i X_{t-i}+ \varepsilon_t</math>
:<math> X_t = \sum_{i=1}^p \varphi_i X_{t-i}+ \varepsilon_t</math>


where <math>\varphi_1, \ldots, \varphi_p</math> are [[parameter]]s and the random variable <math>\varepsilon_t</math> is [[white noise]], usually [[Independent and identically distributed random variables|independent and identically distributed]] (i.i.d.) [[Normal distribution|normal random variables]].<ref>{{Cite book |last=Box |first=George E. P. |url=https://www.worldcat.org/oclc/28888762 |title=Time series analysis : forecasting and control |date=1994 |publisher=Prentice Hall |others=Gwilym M. Jenkins, Gregory C. Reinsel |isbn=0-13-060774-6 |edition=3rd |location=Englewood Cliffs, N.J. |pages=54 |language=en |oclc=28888762}}</ref><ref>{{Cite book |last=Shumway |first=Robert H. |url=https://www.worldcat.org/oclc/42392178 |title=Time series analysis and its applications |date=2000 |publisher=Springer |others=David S. Stoffer |isbn=0-387-98950-1 |location=New York |pages=90-91 |language=en |oclc=42392178}}</ref>
where <math>\varphi_1, \ldots, \varphi_p</math> are [[parameter]]s and the random variable <math>\varepsilon_t</math> is [[white noise]], usually [[Independent and identically distributed random variables|independent and identically distributed]] (i.i.d.) [[Normal distribution|normal random variables]].<ref>{{Cite book |last=Box |first=George E. P. |url=https://www.worldcat.org/oclc/28888762 |title=Time series analysis : forecasting and control |date=1994 |publisher=Prentice Hall |others=Gwilym M. Jenkins, Gregory C. Reinsel |isbn=0-13-060774-6 |edition=3rd |location=Englewood Cliffs, N.J. |pages=54 |language=en |oclc=28888762}}</ref><ref>{{Cite book |last=Shumway |first=Robert H. |url=https://www.worldcat.org/oclc/42392178 |title=Time series analysis and its applications |date=2000 |publisher=Springer |others=David S. Stoffer |isbn=0-387-98950-1 |location=New York |pages=90–91 |language=en |oclc=42392178}}</ref>

In order for the model to remain [[Stationary process|stationary]], the roots of its [[Autoregressive model#Characteristic polynomial|characteristic polynomial]] must lie outside the unit circle. For example, processes in the AR(1) model with <math>|\varphi_1| \ge 1</math> are not stationary because the root of <math>1 - \varphi_1B = 0</math> lies within the unit circle.<ref>{{Cite book |last1=Box |first1=George E. P. |url=https://www.worldcat.org/oclc/28888762 |title=Time series analysis : forecasting and control |last2=Jenkins |first2=Gwilym M. |last3=Reinsel |first3=Gregory C. |date=1994 |publisher=Prentice Hall |isbn=0-13-060774-6 |edition=3rd |location=Englewood Cliffs, N.J. |pages=54–55 |language=en |oclc=28888762}}</ref>


The [[augmented Dickey–Fuller test]] assesses the stability of IMF and trend components. For stationary time series, the ARMA model is used, while for non-stationary series, LSTM models are used to derive abstract features. The final value is obtained by reconstructing the predicted outcomes of each time series.
In order for the model to remain [[Stationary process|stationary]], the roots of its [[Autoregressive model#Characteristic polynomial|characteristic polynomial]] must lie outside of the unit circle. For example, processes in the AR(1) model with <math>|\varphi_1| \ge 1</math> are not stationary because the root of <math>1 - \varphi_1B = 0</math> lies within the unit circle.<ref>{{Cite book |last=Box |first=George E. P. |url=https://www.worldcat.org/oclc/28888762 |title=Time series analysis : forecasting and control |last2=Jenkins |first2=Gwilym M. |last3=Reinsel |first3=Gregory C. |date=1994 |publisher=Prentice Hall |others= |isbn=0-13-060774-6 |edition=3rd |location=Englewood Cliffs, N.J. |pages=54-55 |language=en |oclc=28888762}}</ref>


== Moving-average model ==
=== Moving average model ===
{{Main|Moving-average model}}
{{Main|Moving-average model}}
The notation MA(''q'') refers to the moving average model of order ''q'':
The notation MA(''q'') refers to the moving average model of order ''q'':
Line 24: Line 28:
:<math> X_t = \mu + \varepsilon_t + \sum_{i=1}^q \theta_i \varepsilon_{t-i}\,</math>
:<math> X_t = \mu + \varepsilon_t + \sum_{i=1}^q \theta_i \varepsilon_{t-i}\,</math>


where the <math>\theta_1,...,\theta_q</math> are the parameters of the model, <math>\mu</math> is the expectation of <math>X_t</math> (often assumed to equal 0), and the <math>\varepsilon_t</math>, <math>\varepsilon_{t-1}</math>,... are again, i.i.d. white noise error terms that are commonly normal random variables.<ref>{{Cite book |last=Box |first=George E. P. |url=https://www.worldcat.org/oclc/908107438 |title=Time series analysis : forecasting and control |last2=Jenkins |first2=Gwilym M. |last3=Reinsel |first3=Gregory C. |last4=Ljung |first4=Greta M. |date=2016 |publisher=John Wiley & Sons, Incorporated |others= |year= |isbn=978-1-118-67492-5 |edition=5th |location=Hoboken, New Jersey |pages=53 |language=en |oclc=908107438}}</ref>
where the <math>\theta_1,...,\theta_q</math> are the parameters of the model, <math>\mu</math> is the expectation of <math>X_t</math> (often assumed to equal 0), and <math>\varepsilon_1</math>, ..., <math>\varepsilon_t</math> are i.i.d. white noise error terms that are commonly normal random variables.<ref>{{Cite book |last1=Box |first1=George E. P. |url=https://www.worldcat.org/oclc/908107438 |title=Time series analysis : forecasting and control |last2=Jenkins |first2=Gwilym M. |last3=Reinsel |first3=Gregory C. |last4=Ljung |first4=Greta M. |date=2016 |publisher=John Wiley & Sons, Incorporated |isbn=978-1-118-67492-5 |edition=5th |location=Hoboken, New Jersey |pages=53 |language=en |oclc=908107438}}</ref>

== ARMA model ==


=== 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,<ref>{{Cite book |last=Shumway |first=Robert H. |url=https://www.worldcat.org/oclc/42392178 |title=Time series analysis and its applications |date=2000 |publisher=Springer |others=David S. Stoffer |isbn=0-387-98950-1 |location=New York |pages=98 |language=en |oclc=42392178}}</ref>
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,<ref>{{Cite book |last=Shumway |first=Robert H. |url=https://www.worldcat.org/oclc/42392178 |title=Time series analysis and its applications |date=2000 |publisher=Springer |others=David S. Stoffer |isbn=0-387-98950-1 |location=New York |pages=98 |language=en |oclc=42392178}}</ref>


:<math> X_t = \varepsilon_t + \sum_{i=1}^p \varphi_i X_{t-i} + \sum_{i=1}^q \theta_i \varepsilon_{t-i}.\,</math>
:<math> X_t = \varepsilon_t + \sum_{i=1}^p \varphi_i X_{t-i} + \sum_{i=1}^q \theta_i \varepsilon_{t-i}.\,</math>


=== In terms of lag operator ===
The general ARMA model was described in the 1951 thesis of [[Peter Whittle (mathematician)|Peter Whittle]], who used mathematical analysis ([[Laurent series]] and [[Fourier analysis]]) and statistical inference.<ref>{{cite book|last=Hannan|first=Edward James|author-link=Edward James Hannan|title=Multiple time series|series=Wiley series in probability and mathematical statistics|year=1970|location=New York|publisher=John Wiley and Sons}}</ref><ref>{{cite book|title=Hypothesis Testing in Time Series Analysis|author=Whittle, P.|publisher=Almquist and Wicksell|year=1951}}
In some texts, the models is specified using the [[lag operator]] ''L''. In these terms, the AR(''p'') model is given by

{{cite book|title=Prediction and Regulation|author=Whittle, P.|publisher=English Universities Press|year=1963|isbn=0-8166-1147-5}}

:Republished as: {{cite book|title=Prediction and Regulation by Linear Least-Square Methods|author=Whittle, P.|publisher=University of Minnesota Press|year=1983|isbn=0-8166-1148-3}}</ref> 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).<ref>{{harvtxt|Hannan|Deistler|1988|loc=p. 227}}: {{cite book|last=Hannan|first=E. J.|author-link=Edward James Hannan|last2=Deistler|first2=Manfred|title=Statistical theory of linear systems|series=Wiley series in probability and mathematical statistics|year=1988|location=New York|publisher=John Wiley and Sons}}</ref>

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> \varepsilon_t = \left(1 - \sum_{i=1}^p \varphi_i L^i\right) X_t = \varphi (L) X_t\,</math>
:<math> \varepsilon_t = \left(1 - \sum_{i=1}^p \varphi_i L^i\right) X_t = \varphi (L) X_t\,</math>
Line 53: Line 46:
The MA(''q'') model is given by
The MA(''q'') model is given by


:<math> X_t = \left(1 + \sum_{i=1}^q \theta_i L^i\right) \varepsilon_t = \theta (L) \varepsilon_t , \,</math>
:<math> X_t - \mu = \left(1 + \sum_{i=1}^q \theta_i L^i\right) \varepsilon_t = \theta (L) \varepsilon_t , \,</math>


where <math>\theta</math> represents the polynomial
where <math>\theta</math> represents the polynomial
Line 70: Line 63:


:<math> \frac{\varphi(L)}{\theta(L)}X_t = \varepsilon_t \, .</math>
:<math> \frac{\varphi(L)}{\theta(L)}X_t = \varepsilon_t \, .</math>
This is the form used in [[George Box|Box]], [[Gwilym M. Jenkins|Jenkins]] & Reinsel.<ref>{{cite book |last1=Box |first1=George |title=Time Series Analysis: Forecasting and Control |last2=Jenkins |first2=Gwilym M. |last3=Reinsel |first3=Gregory C. |publisher=Prentice-Hall |year=1994 |isbn=0130607746 |edition=Third}}</ref>


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

Some authors, including [[George Box|Box]], [[Gwilym M. Jenkins|Jenkins]] & Reinsel use a different convention for the autoregression coefficients.<ref>{{cite book |first=George |last=Box |first2=Gwilym M. |last2=Jenkins |first3=Gregory C. |last3=Reinsel |title=Time Series Analysis: Forecasting and Control |edition=Third |publisher=Prentice-Hall |year=1994 |isbn=0130607746 }}</ref> This allows all the polynomials involving the lag operator to appear in a similar form throughout. Thus the ARMA model would be written as
== Spectrum ==
:<math> \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>
The [[spectral density]] of an ARMA process is<math display="block">S(f) = \frac{\sigma^2}{2\pi} \left\vert \frac{\theta(e^{-if})}{\phi(e^{-if})} \right\vert^2</math>where <math>\sigma^2</math> is the [[variance]] of the white noise, <math>\theta</math> is the characteristic polynomial of the moving average part of the ARMA model, and <math>\phi</math> is the characteristic polynomial of the autoregressive part of the ARMA model.<ref>{{Cite book |last=Rosenblatt |first=Murray |url=https://www.worldcat.org/oclc/42061096 |title=Gaussian and non-Gaussian linear time series and random fields |date=2000 |publisher=Springer |isbn=0-387-98917-X |location=New York |pages=10 |language=en |oclc=42061096}}</ref><ref>{{Cite book |last=Wei |first=William W. S. |url=https://www.worldcat.org/oclc/18166355 |title=Time series analysis : univariate and multivariate methods |date=1990 |publisher=Addison-Wesley Pub |isbn=0-201-15911-2 |location=Redwood City, Calif. |pages=242–243 |language=en |oclc=18166355}}</ref>
Moreover, starting summations from <math> i=0 </math> and setting <math> \phi_0 = -1 </math> and <math> \theta_0 = 1 </math>, then we get an even more elegant formulation:
<math> -\sum_{i=0}^p \phi_i L^i \; X_t = \sum_{i=0}^q \theta_i L^i \; \varepsilon_t \, .</math>


== Fitting models ==
== Fitting models ==


===Choosing p and q===
===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 function]]s for an estimate of ''p'', and likewise using the [[autocorrelation function]]s for an estimate of ''q''. Extended autocorrelation functions (EACF) can be used to simultaneously determine p and q.<ref>{{Cite web|last=Missouri State University|title=Model Specification, Time Series Analysis|url=http://people.missouristate.edu/songfengzheng/Teaching/MTH548/Time%20Series-ch06.pdf}}</ref> 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''.
An appropriate value of ''p'' in the ARMA(''p'', ''q'') model can be found by plotting the [[partial autocorrelation function]]s. Similarly, ''q'' can be estimated by using the [[autocorrelation function]]s. Both ''p'' and ''q'' can be determined simultaneously using extended autocorrelation functions (EACF).<ref>{{Cite web|last=Missouri State University|title=Model Specification, Time Series Analysis|url=http://people.missouristate.edu/songfengzheng/Teaching/MTH548/Time%20Series-ch06.pdf}}</ref> 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''.<ref>{{cite book |last=Brockwell |first=P. J. |last2=Davis |first2=R. A. |title=Time Series: Theory and Methods |edition=2nd |publisher=Springer |location=New York |year=2009 |page=273 |isbn=9781441903198 }}</ref> Another possible choice for order determining is the [[Bayesian information criterion|BIC]] criterion.
Brockwell & Davis recommend using [[Akaike information criterion]] (AIC) for finding ''p'' and ''q''.<ref>{{cite book |last1=Brockwell |first1=P. J. |last2=Davis |first2=R. A. |title=Time Series: Theory and Methods |edition=2nd |publisher=Springer |location=New York |year=2009 |page=273 |isbn=9781441903198 }}</ref> Another option is the [[Bayesian information criterion]] (BIC).


===Estimating coefficients===
===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 [[AR model#Calculation of the AR parameters|Yule-Walker equations]] may be used to provide a fit.
After choosing ''p'' and ''q,'' ARMA models can be fitted by [[least squares]] regression to find the values of the parameters which minimize the error term. It is 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 [[AR model#Calculation of the AR parameters|Yule-Walker equations]] may be used to provide a fit.


ARMA outputs are used primarily to forecast (predict), and not to infer causation as in other areas of econometrics and regression methods such as OLS and 2SLS.
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.


=== Software implementations ===
=== Implementations in statistics packages ===
* In [[R (programming language)|R]], the ''arima'' function (in standard package ''stats'') is documented in [http://search.r-project.org/R/library/stats/html/arima.html ARIMA Modelling of Time Series]. Extension packages contain related and extended functionality, e.g., the ''tseries'' package includes an ''arma'' function, documented in [http://finzi.psych.upenn.edu/R/library/tseries/html/arma.html "Fit ARMA Models to Time Series"]; the [https://cran.r-project.org/web/packages/fracdiff ''fracdiff'' package] contains ''fracdiff()'' for fractionally integrated ARMA processes; and the [https://cran.r-project.org/web/packages/forecast/index.html ''forecast'' package] includes ''auto.arima'' for selecting a parsimonious set of ''p,q''. The CRAN task view on [https://cran.r-project.org/web/views/TimeSeries.html Time Series] contains links to most of these.
* In [[R (programming language)|R]], standard package <code>stats</code> has function <code>arima</code>, documented in [http://search.r-project.org/R/library/stats/html/arima.html ARIMA Modelling of Time Series]. Package [https://cran.r-project.org/web/packages/astsa/index.html <code>astsa</code>] has an improved script called <code>sarima</code> for fitting ARMA models (seasonal and nonseasonal) and <code>sarima.sim</code> to simulate data from these models. Extension packages contain related and extended functionality: package <code>tseries</code> includes the function <code>arma()</code>, documented in [http://finzi.psych.upenn.edu/R/library/tseries/html/arma.html "Fit ARMA Models to Time Series"]; package[https://cran.r-project.org/web/packages/fracdiff <code>fracdiff</code>] contains <code>fracdiff()</code> for fractionally integrated ARMA processes; and package [https://cran.r-project.org/web/packages/forecast/index.html <code>forecast</code>] includes <code>auto.arima</code> for selecting a parsimonious set of ''p, q''. The CRAN task view on [https://cran.r-project.org/web/views/TimeSeries.html Time Series] contains links to most of these.
* [[Mathematica]] has a complete library of time series functions including ARMA.<ref>[http://www.wolfram.com/products/applications/timeseries/features.html Time series features in Mathematica] {{webarchive |url=https://web.archive.org/web/20111124032002/http://www.wolfram.com/products/applications/timeseries/features.html |date=November 24, 2011 }}</ref>
* [[Mathematica]] has a complete library of time series functions including ARMA.<ref>[http://www.wolfram.com/products/applications/timeseries/features.html Time series features in Mathematica] {{webarchive |url=https://web.archive.org/web/20111124032002/http://www.wolfram.com/products/applications/timeseries/features.html |date=November 24, 2011 }}</ref>
* [[MATLAB]] includes functions such as [http://www.mathworks.com/help/econ/arma-model.html ''arma''] and [http://www.mathworks.com/help/ident/ref/ar.html ''ar''] to estimate AR, ARX (autoregressive exogenous), and ARMAX models. See [http://www.mathworks.com/help/ident/ug/estimating-ar-and-arma-models.html System Identification Toolbox] and [http://www.mathworks.com/help/econ/arima.estimate.html Econometrics Toolbox] for more information.
* [[MATLAB]] includes functions such as [http://www.mathworks.com/help/econ/arma-model.html <code>arma</code>], [http://www.mathworks.com/help/ident/ref/ar.html <code>ar</code>] and [http://www.mathworks.com/help/ident/ref/arx.html <code>arx</code>] to estimate autoregressive, exogenous autoregressive and ARMAX models. See [http://www.mathworks.com/help/ident/ug/estimating-ar-and-arma-models.html System Identification Toolbox] and [http://www.mathworks.com/help/econ/arima.estimate.html Econometrics Toolbox] for details.
* [[Julia_(programming_language) | Julia]] has some community driven packages that implement fitting with an ARMA model such as [https://github.com/joefowler/ARMA.jl ''arma.jl''].
* [[Julia_(programming_language) | Julia]] has community-driven packages that implement fitting with an ARMA model such as [https://github.com/joefowler/ARMA.jl <code>arma.jl</code>].
* [[Statsmodels]] Python module includes many models and functions for time series analysis, including ARMA. Formerly part of [[Scikit-learn]] it is now stand-alone and integrates well with [[Pandas (software)|Pandas]]. [http://statsmodels.sourceforge.net/ See here for more details].
* Python has the <code>statsmodels</code>[http://statsmodels.sourceforge.net/ S] package which 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 (software)|Pandas]].
* [[PyFlux]] has a Python-based implementation of ARIMAX models, including Bayesian ARIMAX models.
* [[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.
* [[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, [http://constantdream.wordpress.com/2008/03/16/gnu-regression-econometrics-and-time-series-library-gretl/ see here where it's mentioned].
* [[gretl]] can estimate ARMA models, as mentioned [http://constantdream.wordpress.com/2008/03/16/gnu-regression-econometrics-and-time-series-library-gretl/ here]
* [[GNU Octave]] can estimate AR models using functions from the extra package [http://octave.sourceforge.net/ octave-forge].
* [[GNU Octave]] extra package [http://octave.sourceforge.net/ <code>octave-forge</code>] supports AR models.
* [[Stata]] includes the function ''arima'' which can estimate ARMA and [[Autoregressive integrated moving average|ARIMA]] models. [https://www.stata.com/help.cgi?arima. See here for more details].
* [[Stata]] includes the function <code>arima</code>. for ARMA and [[Autoregressive integrated moving average|ARIMA]] models.
* [[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 [http://www.numericalmethod.com/javadoc/suanshu/ "SuanShu, a Java numerical and statistical library"].
* [[SuanShu]] is a Java library of numerical methods that implements univariate/multivariate ARMA, ARIMA, ARMAX, etc models, documented in [http://www.numericalmethod.com/javadoc/suanshu/ "SuanShu, a Java numerical and statistical library"].
* [[SAS (software)|SAS]] has an econometric package, ETS, that estimates ARIMA models. [https://web.archive.org/web/20110930032431/http://support.sas.com/rnd/app/ets/proc/ets_arima.html See here for more details].
* [[SAS (software)|SAS]] has an econometric package, ETS, that estimates ARIMA models. [https://web.archive.org/web/20110930032431/http://support.sas.com/rnd/app/ets/proc/ets_arima.html See details].


== History and interpretations ==
== Spectrum ==
The general ARMA model was described in the 1951 thesis of [[Peter Whittle (mathematician)|Peter Whittle]], who used mathematical analysis ([[Laurent series]] and [[Fourier analysis]]) and statistical inference.<ref>{{cite book |last=Hannan |first=Edward James |author-link=Edward James Hannan |title=Multiple time series |publisher=John Wiley and Sons |year=1970 |series=Wiley series in probability and mathematical statistics |location=New York}}</ref><ref>{{cite book |author=Whittle, P. |title=Hypothesis Testing in Time Series Analysis |publisher=Almquist and Wicksell |year=1951}}
The [[spectral density]] of an ARMA process is<math display="block">S(f) = \frac{\sigma^2}{2\pi} \left\vert \frac{\theta(e^{-if})}{\phi(e^{-if})} \right\vert^2</math>where <math>\sigma^2</math> is the [[variance]] of the white noise, <math>\theta</math> is the characteristic polynomial of the moving average part of the ARMA model, and <math>\phi</math> is the characteristic polynomial of the autoregressive part of the ARMA model.<ref>{{Cite book |last=Rosenblatt |first=Murray |url=https://www.worldcat.org/oclc/42061096 |title=Gaussian and non-Gaussian linear time series and random fields |date=2000 |publisher=Springer |isbn=0-387-98917-X |location=New York |pages=10 |language=en |oclc=42061096}}</ref><ref>{{Cite book |last=Wei |first=William W. S. |url=https://www.worldcat.org/oclc/18166355 |title=Time series analysis : univariate and multivariate methods |date=1990 |publisher=Addison-Wesley Pub |isbn=0-201-15911-2 |location=Redwood City, Calif. |pages=242-243 |language=en |oclc=18166355}}</ref>

{{cite book |author=Whittle, P. |title=Prediction and Regulation |publisher=English Universities Press |year=1963 |isbn=0-8166-1147-5}}

: Republished as: {{cite book |author=Whittle, P. |title=Prediction and Regulation by Linear Least-Square Methods |publisher=University of Minnesota Press |year=1983 |isbn=0-8166-1148-3}}</ref> 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).<ref>{{harvtxt|Hannan|Deistler|1988|loc=p. 227}}: {{cite book |last1=Hannan |first1=E. J. |author-link=Edward James Hannan |title=Statistical theory of linear systems |last2=Deistler |first2=Manfred |publisher=John Wiley and Sons |year=1988 |series=Wiley series in probability and mathematical statistics |location=New York}}</ref>

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

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


== Applications ==
== Applications ==
Line 113: Line 114:
== Generalizations ==
== Generalizations ==


There are various generalizations of ARMA. '''Nonlinear''' AR (NAR), nonlinear MA (NMA) and nonlinear ARMA (NARMA) model nonlinear dependence on past values and error terms. [[vector autoregression|Vector AR]] (VAR) and vector ARMA (VARMA) model '''multivariate''' time series. [[Autoregressive integrated moving average]] (ARIMA) models non-stationary time series (that is, whose mean changes over time). [[Autoregressive conditional heteroskedasticity]] (ARCH) models time series where the variance changes. Seasonal ARIMA (SARIMA or periodic ARMA) models '''periodic''' variation. [[Autoregressive fractionally integrated moving average]] (ARFIMA, or Fractional ARIMA, FARIMA) model time-series that exhibits '''long memory'''. Multiscale AR (MAR) is indexed by the nodes of a [[Tree (graph theory)|tree]] instead of integers.
The dependence of <math>X_t</math> on past values and the error terms ε<sub>t</sub> 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.


=== {{anchor|ARMAX}}Autoregressive–moving-average model with exogenous inputs (ARMAX) === <!-- This section is linked from [[ARMAX]], so if you change the title, please also change the corresponding link in the ARMAX page -->
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.


The notation ARMAX(''p'', ''q'', ''b'') refers to a model with ''p'' autoregressive terms, ''q'' moving average terms and ''b'' exogenous inputs terms. The last term is a linear combination of the last ''b'' terms of a known and external time series <math>d_t</math>. It is given by:
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).

=== {{anchor|ARMAX}}Autoregressive–moving-average model with exogenous inputs model (ARMAX model) === <!-- This section is linked from [[ARMAX]], so if you change the title, please also change the corresponding link in the ARMAX page -->

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>d_t</math>. It is given by:


:<math> 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>
:<math> 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>
Line 130: Line 125:
Some nonlinear variants of models with exogenous variables have been defined: see for example [[Nonlinear autoregressive exogenous model]].
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 (programming language)|R]]<ref name="R.stats.arima">[http://search.r-project.org/R/library/stats/html/arima.html ARIMA Modelling of Time Series], R documentation</ref> and [[gretl]]) refer to the regression:
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 (programming language)|R]]<ref name="R.stats.arima">[http://search.r-project.org/R/library/stats/html/arima.html ARIMA Modelling of Time Series], R documentation</ref> and [[gretl]]) refer to the regression:
: <math> 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>
: <math> 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>m_t</math> incorporates all exogenous (or independent) variables:
where <math>m_t</math> incorporates all exogenous (or independent) variables:
Line 147: Line 142:
== References ==
== References ==
{{Reflist}}
{{Reflist}}



== Further reading ==
== Further reading ==
* {{cite book |last=Mills |first=Terence C. |title=Time Series Techniques for Economists |publisher=Cambridge University Press |year=1990 |isbn=0521343399 |url-access=registration |url=https://archive.org/details/timeseriestechni0000mill }}
* {{cite book |last=Mills |first=Terence C. |title=Time Series Techniques for Economists |publisher=Cambridge University Press |year=1990 |isbn=0521343399 |url-access=registration |url=https://archive.org/details/timeseriestechni0000mill }}
* {{cite book |last=Percival |first=Donald B. |first2=Andrew T. |last2=Walden |title=Spectral Analysis for Physical Applications |publisher=Cambridge University Press |year=1993 |isbn=052135532X }}
* {{cite book |last1=Percival |first1=Donald B. |first2=Andrew T. |last2=Walden |title=Spectral Analysis for Physical Applications |publisher=Cambridge University Press |year=1993 |isbn=052135532X }}
* {{citation| first1= C. | last1= Francq | first2= J.-M. | last2= Zakoïan | chapter= Recent results for linear time series models with non independent innovations | pages= 241–265 | title= Statistical Modeling and Analysis for Complex Data Problems | editor1-first= P. |editor1-last= Duchesne | editor2-first=B. | editor2-last= Remillard | publisher= Springer | year= 2005| citeseerx= 10.1.1.721.1754 }}.
* {{citation| first1= C. | last1= Francq | first2= J.-M. | last2= Zakoïan | chapter= Recent results for linear time series models with non independent innovations | pages= 241–265 | title= Statistical Modeling and Analysis for Complex Data Problems | editor1-first= P. |editor1-last= Duchesne | editor2-first=B. | editor2-last= Remillard | publisher= Springer | year= 2005| citeseerx= 10.1.1.721.1754 }}.
* [https://link.springer.com/book/10.1007/978-3-319-52452-8 Shumway, R.H. and Stoffer, D.S. (2017). ''Time Series Analysis and Its Applications with R Examples''. Springer. DOI: 10.1007/978-3-319-52452-8]


{{Stochastic processes}}
{{Stochastic processes}}

Latest revision as of 16:29, 1 October 2024

In the statistical analysis of time series, autoregressive–moving-average (ARMA) models are a way to describe of a (weakly) stationary stochastic process using autoregression (AR) and a moving average (MA), each with a polynomial. They are a tool for understanding a series and predicting future values. AR involves regressing the variable on its own lagged (i.e., past) values. MA involves modeling the error as a linear combination of error terms occurring contemporaneously and at various times in the past. The model is usually denoted ARMA(p, q), where p is the order of AR and q is the order of 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.

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

Mathematical formulation

[edit]

Autoregressive model

[edit]

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

where are parameters and the random variable 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 the unit circle. For example, processes in the AR(1) model with are not stationary because the root of lies within the unit circle.[3]

The augmented Dickey–Fuller test assesses the stability of IMF and trend components. For stationary time series, the ARMA model is used, while for non-stationary series, LSTM models are used to derive abstract features. The final value is obtained by reconstructing the predicted outcomes of each time series.

Moving average model

[edit]

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

where the are the parameters of the model, is the expectation of (often assumed to equal 0), and , ..., are i.i.d. white noise error terms that are commonly normal random variables.[4]

ARMA model

[edit]

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]

In terms of lag operator

[edit]

In some texts, the models is specified using the lag operator L. In these terms, the AR(p) model is given by

where represents the polynomial

The MA(q) model is given by

where represents the polynomial

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

or more concisely,

or

This is the form used in Box, Jenkins & Reinsel.[6]

Moreover, starting summations from and setting and , then we get an even more elegant formulation:

Spectrum

[edit]

The spectral density of an ARMA process iswhere is the variance of the white noise, is the characteristic polynomial of the moving average part of the ARMA model, and is the characteristic polynomial of the autoregressive part of the ARMA model.[7][8]

Fitting models

[edit]

Choosing p and q

[edit]

An appropriate value of p in the ARMA(p, q) model can be found by plotting the partial autocorrelation functions. Similarly, q can be estimated by using the autocorrelation functions. Both p and q can be determined simultaneously using extended autocorrelation functions (EACF).[9] 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.[10] Another option is the Bayesian information criterion (BIC).

Estimating coefficients

[edit]

After choosing p and q, ARMA models can be fitted by least squares regression to find the values of the parameters which minimize the error term. It is 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.

ARMA outputs are used primarily to forecast (predict), and not to infer causation as in other areas of econometrics and regression methods such as OLS and 2SLS.

Software implementations

[edit]
  • In R, standard package stats has function arima, documented in ARIMA Modelling of Time Series. Package astsa has an improved script called sarima for fitting ARMA models (seasonal and nonseasonal) and sarima.sim to simulate data from these models. Extension packages contain related and extended functionality: package tseries includes the function arma(), documented in "Fit ARMA Models to Time Series"; packagefracdiff contains fracdiff() for fractionally integrated ARMA processes; and package forecast 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.[11]
  • MATLAB includes functions such as arma, ar and arx to estimate autoregressive, exogenous autoregressive and ARMAX models. See System Identification Toolbox and Econometrics Toolbox for details.
  • Julia has community-driven packages that implement fitting with an ARMA model such as arma.jl.
  • Python has the statsmodelsS package which 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.
  • 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 estimate ARMA models, as mentioned here
  • GNU Octave extra package octave-forge supports AR models.
  • Stata includes the function arima. for ARMA and ARIMA models.
  • SuanShu is a Java library of numerical methods that implements univariate/multivariate ARMA, ARIMA, ARMAX, etc models, documented in "SuanShu, a Java numerical and statistical library".
  • SAS has an econometric package, ETS, that estimates ARIMA models. See details.

History and interpretations

[edit]

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.[12][13] 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).[14]

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

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

Applications

[edit]

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

[edit]

There are various generalizations of ARMA. Nonlinear AR (NAR), nonlinear MA (NMA) and nonlinear ARMA (NARMA) model nonlinear dependence on past values and error terms. Vector AR (VAR) and vector ARMA (VARMA) model multivariate time series. Autoregressive integrated moving average (ARIMA) models non-stationary time series (that is, whose mean changes over time). Autoregressive conditional heteroskedasticity (ARCH) models time series where the variance changes. Seasonal ARIMA (SARIMA or periodic ARMA) models periodic variation. Autoregressive fractionally integrated moving average (ARFIMA, or Fractional ARIMA, FARIMA) model time-series that exhibits long memory. Multiscale AR (MAR) is indexed by the nodes of a tree instead of integers.

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

[edit]

The notation ARMAX(p, q, b) refers to a model with p autoregressive terms, q moving average terms and b exogenous inputs terms. The last term is a linear combination of the last b terms of a known and external time series . It is given by:

where are the parameters of the exogenous input .

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:

where incorporates all exogenous (or independent) variables:

See also

[edit]

References

[edit]
  1. ^ Box, George E. P. (1994). Time series analysis : forecasting and control. Gwilym M. Jenkins, Gregory C. Reinsel (3rd ed.). Englewood Cliffs, N.J.: Prentice Hall. p. 54. ISBN 0-13-060774-6. OCLC 28888762.
  2. ^ Shumway, Robert H. (2000). Time series analysis and its applications. David S. Stoffer. New York: Springer. pp. 90–91. ISBN 0-387-98950-1. OCLC 42392178.
  3. ^ Box, George E. P.; Jenkins, Gwilym M.; Reinsel, Gregory C. (1994). Time series analysis : forecasting and control (3rd ed.). Englewood Cliffs, N.J.: Prentice Hall. pp. 54–55. ISBN 0-13-060774-6. OCLC 28888762.
  4. ^ Box, George E. P.; Jenkins, Gwilym M.; Reinsel, Gregory C.; Ljung, Greta M. (2016). Time series analysis : forecasting and control (5th ed.). Hoboken, New Jersey: John Wiley & Sons, Incorporated. p. 53. ISBN 978-1-118-67492-5. OCLC 908107438.
  5. ^ Shumway, Robert H. (2000). Time series analysis and its applications. David S. Stoffer. New York: Springer. p. 98. ISBN 0-387-98950-1. OCLC 42392178.
  6. ^ Box, George; Jenkins, Gwilym M.; Reinsel, Gregory C. (1994). Time Series Analysis: Forecasting and Control (Third ed.). Prentice-Hall. ISBN 0130607746.
  7. ^ Rosenblatt, Murray (2000). Gaussian and non-Gaussian linear time series and random fields. New York: Springer. p. 10. ISBN 0-387-98917-X. OCLC 42061096.
  8. ^ Wei, William W. S. (1990). Time series analysis : univariate and multivariate methods. Redwood City, Calif.: Addison-Wesley Pub. pp. 242–243. ISBN 0-201-15911-2. OCLC 18166355.
  9. ^ Missouri State University. "Model Specification, Time Series Analysis" (PDF).
  10. ^ Brockwell, P. J.; Davis, R. A. (2009). Time Series: Theory and Methods (2nd ed.). New York: Springer. p. 273. ISBN 9781441903198.
  11. ^ Time series features in Mathematica Archived November 24, 2011, at the Wayback Machine
  12. ^ Hannan, Edward James (1970). Multiple time series. Wiley series in probability and mathematical statistics. New York: John Wiley and Sons.
  13. ^ 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.
  14. ^ Hannan & Deistler (1988, p. 227): Hannan, E. J.; Deistler, Manfred (1988). Statistical theory of linear systems. Wiley series in probability and mathematical statistics. New York: John Wiley and Sons.
  15. ^ ARIMA Modelling of Time Series, R documentation


Further reading

[edit]