Characterize the properties of moving average (MA) models
Define a moving average (MA) process
Write an MA(q) model in terms of the backward shift operator
State the mean and variance of an MA(q) process
Explain the autocorrelation function of an MA(q) process
Define an invertible MA process
Fit time series models to data and interpret fitted parameters
Determine an appropriate MA(q) model to fit to a time series based on the ACF plot
Fit an MA(q) model to data in R using the arima() function
Assess model fit by examining residual diagnostic plots
Interpret the fitted MA coefficients
Preparation
Read Sections 6.1-6.4
Learning Journal Exchange (10 min)
Review another student’s journal
What would you add to your learning journal after reading another student’s?
What would you recommend the other student add to their learning journal?
Sign the Learning Journal review sheet for your peer
Class Activity: Introduction to Moving Average (MA) Models (15 min)
Stationary Processes
In previous chapters, we have explored how to identify and remove the trend and seasonal components of a time series. After the trend and seasonal component have been properly removed, the residual should be stationary. However, these residual components may still contain autocorrelation.
In this chapter, we will explore stationary models that are appropriate when there are no obvious trends or seasonal elements. Combining the fitted stationary model with the estimated trend and seasonal components can improve our ability to make forecasts. We will build on the autoregressive (AR) models we learned in Chapter 4.
Strictly Stationary Series
First, we define a strictly stationary series.
Definition of Strict Stationarity
A time series model is said to be strictly stationary if the joint distribution of the random variables is the same as the joint distribution of for all and , so that the distribution of the values in the time series is the same after an arbitrary time shift.
If a time series is strictly stationary, then its mean and variance are constant in time. Hence, the autocovariance depends only on the lag, . We can therefore denote the covariance function as .
Note: It is possible that a series could have a constant mean and variance in time and the autocovariance depends only on the lag, but the series is not strictly stationary. This is called second-order stationary.
We will focus on the second-order properties of the time series, even though all the series we will explore in this chapter are strictly stationary.
Note: if a white noise process is Gaussian, the stochastic process is completely determined by the mean and covariance structure. This is similar to how a (univariate or multivariate) normal distribution is completely specified by the mean and variance-covariance matrix.
The concept of stationarity is a property of time series models. When we use certain models, we are assuming stationarity. Before we apply these models, it is important to check for stationarity in the time series. In other words, we check to see if there is evidence of a trend or seasonality and if so, we remove these components. We can use methods such as decomposition, Holt-Winters, or regression to remove the trend and seasonality. Hence, it is typically reasonable to consider the residual series as a stationary series. Typically the models in this chapter are applied to the residual series from a regression or similar analysis.
The time series is an autoregressive process of order , denoted as , if
where is white noise and the are the model parameters with .
The model can be expressed in terms of the backward shift operator:
Now, we consider a different, but related model, the moving average (MA) model
Definition of a Moving Average (MA) Model
We say that a time series is a moving average process of order , denoted as , if each term in the time series is a linear combination of the current white noise term and the most recent past white noise terms.
It is given as:
where is white noise with zero mean and variance , and the are the model parameters with .
Check Your Understanding
Write Equation (6.1) in terms of the backward shift operator. Your answer will be of the form:
Note
An process is comprised of a finite summation of stationary white noise terms. Hence, an process will be stationary with a time-invariante mean and autocovariance.
The mean and variance of are easily derived. The mean must be zero, because each term is a sum of scaled white noise terms with mean zero.
The variance of an process is . This can be seen, because the white noise terms are independent with the same variance.
So, the autocorrelation function is
where .
Note that the autocorrelation function is zero if , because and would be independent weighted summations of white noise processes and hence the covariance between them would be zero.
We now define an invertible process.
Definition of an Invertible Process
An process is said to be invertible if it can be expressed as a stationary autoregressive process (of infinite order) with no error term.
Example of an Invertible MA Process
Recall that
or,
if .
Now, note that the process
can be written as:
assuming that . Note that this series will not converge unless .
We have just shown that the process is invertible.
Theorem: Invertibility of an Process
The process will be invertible if the solutions to the equation are all greater than 1 in absolute value.
Does this remind you of the test for the stationarity of an model?
Note that the autocovariance function (acvf) will identify a unique process only if the process is invertible. Fortunately, the algorithm R uses to estimate an process always leads to an invertible model.
Class Activity: Simulating an Model (5 min)
The textbook gives a simulation of an process:
where , , and . This shiny app allows you to simulate from this process.
Check Your Understanding
Use the simulation above to do the following:
Generate the theoretical acf plot for the model
How does the value of the ’s affect the acf?
Simulate 1000 observations from this process.
Give the time plot of the simulated data
Plot the acf of the simulated data.
Compare the acf from the simulated data with the theoretical acf.
Class Activity: Identifying AR and MA Models from the ACF and PACF (5 min)
AR Process
Recall that on page 81, the textbook states that in general, the partial autocorrelation at lag is the coefficient of a fitted model. This implies that if the underlying process is , then all the coefficients will equal 0 whenever . So, an process will result in partial correlations that are zero after lag . So, we can look at the correlogram of partial autocorrelations to determine the order of an appropriate process to model a time series.
MA Process
Similarly, for an process, the coefficients will equal 0 whenever . Hence, an process will demonstrate autocorrelations that are 0 after lag . So, considering the correlogram of autocorrelations, we can assess if an model would be appropriate.
Bless their hearts, the textbook authors give a bad example in Section 6.4.2. They even state that it is “not a realistic realisation.” MA processes naturally arise in ratios of observed data. Multi-period asset returns (i.e. ratios of some previous term’s value) tend to follow an MA process.
For example, if there are 252 trading days in a year, then the daily series of year-over-year returns (this year’s value divided by last year’s value) follows an process. If we are comparing values observed to those from one week ago, we would have an process.
Comparison
ACF and PACF of an Process
We can use the pacf and acf plots to assess if an or model is appropriate. For an or process, we observe the following:
AR(p)
MA(q)
ACF
Tails off
Cuts off after lag
PACF
Cuts off after lag
Tails off
Class Activity: Fitting an Model to GDP Year-Over-Year Ratios (5 min)
To fit an model, we look at the acf to determine if it cuts off after lags.
Based on the acf of the residuals, is the MA model you identified a good fit to the data?
Small-Group Activity: Fitting an Model to the Trade Data (15 min)
Vessels Cleared in Foreign Trade for United States
In the homework for Chapter 1 Lesson 5, you explored data on the thousands of net tons cleared in foreign trade for the United States each month from January 1902 to December 1940. The code below computes the year-over-year change in the amount of cargo cleared for trade. This is stored in the variable ratio.
Show the code
vessels_ts <- rio::import("https://byuistats.github.io/timeseries/data/Vessels_Trade_US.csv") |># filter(-comments) |>mutate(date =yearmonth(dmy(date)),ratio = vessels /lag(vessels, 12) ) |>na.omit() |>as_tsibble(index = date)vessels_ts |>autoplot(.vars = ratio) +labs(x ="Month",y ="Ratio",title ="Year-Over-Year Change in Net Tons on Vessels Cleared for Trade" ) +theme_minimal() +theme(plot.title =element_text(hjust =0.5))
Check Your Understanding
Practice applying an model using the year-over-year amounts.
Determine which MA model is most appropriate for these data.
Fit the model you deem most appropriate.
Assess the appropriateness of applying your model to the data.
Warning: The `...` argument of `PACF()` is deprecated as of feasts 0.2.2.
ℹ ACF variables should be passed to the `y` argument. If multiple variables are
to be used, specify them using `vars(...)`.
None of the acf values are significant. The model seems appropriate.
We can write the estimated model as:
The absolute values of the roots of the right-hand side of this equation are: