Get startedGet started for free

AR vs MA models

As you've seen, autoregressive (AR) and simple moving average (MA) are two useful approaches to modeling time series. But how can you determine whether an AR or MA model is more appropriate in practice?

To determine model fit, you can measure the Akaike information criterion (AIC) and Bayesian information criterion (BIC) for each model. While the math underlying the AIC and BIC is beyond the scope of this course, for your purposes the main idea is these these indicators penalize models with more estimated parameters, to avoid overfitting, and smaller values are preferred. All factors being equal, a model that produces a lower AIC or BIC than another model is considered a better fit.

To estimate these indicators, you can use the AIC() and BIC() commands, both of which require a single argument to specify the model in question.

In this exercise, you'll return to the Nile data and the AR and MA models you fitted to this data. These models and their predictions for the 1970s (AR_fit) and (MA_fit) are depicted in the plot on the right.

This exercise is part of the course

Time Series Analysis in R

View Course

Exercise instructions

  • As a first step in comparing these models, use cor() to measure the correlation between AR_fit and MA_fit.
  • Use two calls to AIC() to calculate the AIC for AR and MA, respectively.
  • Use two calls to BIC() to calculate the BIC for AR and MA, respectively.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Find correlation between AR_fit and MA_fit
cor(___, ___)

# Find AIC of AR
AIC(___)

# Find AIC of MA


# Find BIC of AR
BIC(___)

# Find BIC of MA

Edit and Run Code