{{Short description|Time series model}} {{distinguish|Moving average}}
In time series analysis, the '''moving-average model''' ('''MA model'''), also called the '''moving-average process''', is a standard approach for modeling univariate time series.<ref name="ShumwayStoffer">{{Cite book |author1-link=Robert H. Shumway |last1=Shumway |first1=Robert H. |last2=Stoffer |first2=David S. |title=Time Series Analysis and Its Applications: With R Examples |publisher=Springer |date=2017 |isbn=978-3-319-52451-1 |oclc=966563984 |author-link2=David S. Stoffer}}</ref><ref>{{Cite web |title=2.1 Moving Average Models (MA models) |url=https://online.stat.psu.edu/stat510/lesson/2/2.1 |website=PennState: Statistics Online Courses |access-date=27 February 2023}}</ref>
An MA model expresses the current value of a time series as a linear function of current and past random shocks (error terms) with finite lag length. In contrast to an autoregressive model, which regresses the variable on its past values, the moving-average model relies solely on the dependency structure of the error terms.
Together with the autoregressive (AR) model, the moving-average model is a special case and key component of the more general ARMA and ARIMA models of time series,<ref>{{Citation |last1=Shumway |first1=Robert H. |title=ARIMA Models |date=2019-05-17 |url=http://dx.doi.org/10.1201/9780429273285-5 |work=Time Series: A Data Analysis Approach Using R |pages=99–128 |access-date=2023-02-27 |place=Boca Raton : CRC Press, Taylor & Francis Group, 2019. |publisher=Chapman and Hall/CRC |isbn=978-0-429-27328-5 |last2=Stoffer |first2=David S. |doi=10.1201/9780429273285-5 |author-link2=David S. Stoffer|url-access=subscription }}</ref> which have a more complicated stochastic structure. Contrary to the AR model, the finite MA model is always stationary.
The moving-average model should not be confused with the moving average, a distinct concept despite some similarities.<ref name=":0">{{Cite book |author=Shumway, Robert H. |title=Time series analysis and its applications : with R examples |last2=Stoffer |first2=David S. |date=19 April 2017 |publisher=Springer |isbn=978-3-319-52451-1 |oclc=966563984 |author-link2=David S. Stoffer}}</ref>
== Definition == The notation MA(''q'') refers to the moving average model of order ''q'':
:<math> X_t = \mu + \varepsilon_t + \theta_1 \varepsilon_{t-1} + \cdots + \theta_q \varepsilon_{t-q} = \mu + \sum_{i=1}^q \theta_i \varepsilon_{t-i} + \varepsilon_{t}, </math>
where <math>\mu</math> is the mean of the series, the <math>\theta_1,...,\theta_q</math> are the coefficients of the model{{examples|date=December 2018}} and <math>\varepsilon_t, \varepsilon_{t-1},..., \varepsilon_{t-q}</math> are the error terms. The value of ''q'' is called the order of the MA model. This can be equivalently written in terms of the backshift operator ''B'' as<ref>{{Cite book |last1=Box |first1=George E. P. |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>
:<math>X_t = \mu + (1 + \theta_1 B + \cdots + \theta_q B^q)\varepsilon_t.</math>
Thus, a moving-average model is conceptually a linear regression of the current value of the series against current and previous (observed) white noise error terms or random shocks. The random shocks at each point are assumed to be mutually independent and to come from the same distribution, typically a normal distribution, with location at zero and constant scale.
==Interpretation==
The moving-average model is essentially a finite impulse response filter applied to white noise, with some additional interpretation placed on it.{{Clarify|reason=What is the additional interpretation?|date=February 2023}} The role of the random shocks in the MA model differs from their role in the autoregressive (AR) model in two ways. First, they are propagated to future values of the time series directly: for example, <math>\varepsilon _{t-1}</math> appears directly on the right side of the equation for <math> X_t</math>. In contrast, in an AR model <math>\varepsilon _{t-1}</math> does not appear on the right side of the <math> X_t</math> equation, but it does appear on the right side of the <math> X_{t-1}</math> equation, and <math> X_{t-1}</math> appears on the right side of the <math> X_t</math> equation, giving only an indirect effect of <math>\varepsilon_{t-1}</math> on <math> X_t</math>. Second, in the MA model a shock affects <math> X</math> values only for the current period and ''q'' periods into the future; in contrast, in the AR model a shock affects <math> X</math> values infinitely far into the future, because <math>\varepsilon _t</math> affects <math> X_t</math>, which affects <math> X_{t+1}</math>, which affects <math> X_{t+2}</math>, and so on forever (see Impulse response).
==Fitting the model== Fitting a moving-average model is generally more complicated than fitting an autoregressive model.<ref name=":1">{{Cite web |title=Autoregressive Moving Average ARMA(p, q) Models for Time Series Analysis - Part 1 {{!}} QuantStart |url=https://www.quantstart.com/articles/Autoregressive-Moving-Average-ARMA-p-q-Models-for-Time-Series-Analysis-Part-1/ |access-date=2023-02-27 |website=www.quantstart.com}}</ref> This is because the lagged error terms are not observable. This means that iterative non-linear fitting procedures need to be used in place of linear least squares. Moving average models are linear combinations of past white noise terms, while autoregressive models are linear combinations of past time series values.<ref>{{Cite web |title=Autoregressive Moving Average ARMA(p, q) Models for Time Series Analysis - Part 2 {{!}} QuantStart |url=https://www.quantstart.com/articles/Autoregressive-Moving-Average-ARMA-p-q-Models-for-Time-Series-Analysis-Part-2/ |access-date=2023-02-27 |website=www.quantstart.com}}</ref> ARMA models are more complicated than pure AR and MA models, as they combine both autoregressive and moving average components.<ref name=":1" />
The autocorrelation function (ACF) of an MA(''q'') process is zero at lag ''q'' + 1 and greater. Therefore, we determine the appropriate maximum lag for the estimation by examining the sample autocorrelation function to see where it becomes insignificantly different from zero for all lags beyond a certain lag, which is designated as the maximum lag ''q''.
Sometimes the ACF and partial autocorrelation function (PACF) will suggest that an MA model would be a better model choice and sometimes both AR and MA terms should be used in the same model (see Box–Jenkins method).
Autoregressive Integrated Moving Average (ARIMA) models are an alternative to segmented regression that can also be used for fitting a moving-average model.<ref>{{Cite journal |last1=Schaffer |first1=Andrea L. |last2=Dobbins |first2=Timothy A. |last3=Pearson |first3=Sallie-Anne |date=2021-03-22 |title=Interrupted time series analysis using autoregressive integrated moving average (ARIMA) models: a guide for evaluating large-scale health interventions |journal=BMC Medical Research Methodology |volume=21 |issue=1 |pages=58 |doi=10.1186/s12874-021-01235-8 |issn=1471-2288 |pmc=7986567 |pmid=33752604 |doi-access=free}}</ref>
==See also== *Autoregressive–moving-average model *Autoregressive integrated moving average *Autoregressive model * Finite impulse response * Infinite impulse response
==References== <references />
==Further reading== *{{cite book |last=Enders |first=Walter |chapter=Stationary Time-Series Models |title=Applied Econometric Time Series |location=New York |publisher=Wiley |edition=Second |year=2004 |isbn=0-471-45173-8 |pages=48–107 }}
==External links== *[http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc444.htm Common approaches to univariate time series]
{{Stochastic processes}} {{NIST-PD}}
Category:Time series models