ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Time Series Analysis in R

Ver curso

Instrucciones del ejercicio

  • 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.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# 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

Editar y ejecutar código