Data

The data used here is Canada’s GDP Growth from 1961 to 2022. It is accessible from the World Bank Open Data.

Import Packages & Data

library(readr)
library(forecast)
gdp_df <- read_csv('/Users/laykhoonyu/Documents/MSAA_AE/predictive_analytics/week_2/CA_GDP_GROWTH.csv', show_col_types = FALSE)

Data Preparation

gdp_ts <- ts(gdp_df$GDP_GROWTH, start = 1961, end = 2022, frequency = 1)

Fitting ETS Models

There were only two types of ETS model specification that were able to fit this data type due to its negative values and non-seasonal nature.

The key difference between ANN and AAN models is the presence of an additive trend component in the latter. If the data exhibits a clear trend, the AAN model may provide a better fit, whereas the ANN model is appropriate for stationary data without any trend.

# Fit ETS(ANN) model

ets_ann <- ets(gdp_ts, model = "ANN")

# Fit ETS(AAN)

ets_aan <- ets(gdp_ts, model = "AAN")

Model Summaries

summary(ets_ann)
## ETS(A,N,N) 
## 
## Call:
##  ets(y = gdp_ts, model = "ANN") 
## 
##   Smoothing parameters:
##     alpha = 0.1446 
## 
##   Initial states:
##     l = 5.337 
## 
##   sigma:  2.4228
## 
##      AIC     AICc      BIC 
## 369.5802 369.9940 375.9616 
## 
## Training set error measures:
##                      ME     RMSE      MAE       MPE     MAPE      MASE
## Training set -0.3734225 2.383408 1.727985 -30.46411 83.59423 0.7884221
##                    ACF1
## Training set 0.03088369
summary(ets_aan)
## ETS(A,A,N) 
## 
## Call:
##  ets(y = gdp_ts, model = "AAN") 
## 
##   Smoothing parameters:
##     alpha = 5e-04 
##     beta  = 5e-04 
## 
##   Initial states:
##     l = 5.3236 
##     b = -0.0695 
## 
##   sigma:  2.3462
## 
##      AIC     AICc      BIC 
## 367.4919 368.5633 378.1275 
## 
## Training set error measures:
##                      ME    RMSE      MAE       MPE     MAPE      MASE
## Training set 0.02610745 2.26921 1.638626 -16.47159 76.35144 0.7476503
##                    ACF1
## Training set 0.08891639

The AAN model has slightly lower AIC but higher BIC.

Model Visualizations

# plot ANN model
autoplot(ets_ann,  main = "ETS(A,N,N) Model")

# plot AAN model
autoplot(ets_aan,  main = "ETS(A,A,N) Model")