1. Learn
  2. /
  3. Courses
  4. /
  5. Time Series Analysis in Python

Exercise

Which ARMA Model is Best?

Recall from Chapter 3 that the Akaike Information Criterion (AIC) can be used to compare models with different numbers of parameters. It measures goodness-of-fit, but places a penalty on models with more parameters to discourage overfitting. Lower AIC scores are better.

Fit the temperature data to an AR(1), AR(2), and ARMA(1,1) and see which model is the best fit, using the AIC criterion. The AR(2) and ARMA(1,1) models have one more parameter than the AR(1) has.

The annual change in temperature is in a DataFrame chg_temp.

Instructions

100 XP
  • For each ARMA model, create an instance of the ARIMA class, passing the data and the order=(p,d,q). p is the autoregressive order; q is the moving average order; d is the number of times the series has been differenced.
  • Fit the model using the method .fit().
  • Print the AIC value, found in the .aic element of the results.