library(fpp3)
library(patchwork)Note 22: Comparing ETS & ARIMA with Transformations & Interval Calibration
Module 5: State-Space & Ensembles
Learning Objectives
- Explain why ETS and ARIMA are complementary model families and why information criteria (AICc, BIC) cannot compare across them.
- Apply Guerrero’s Box-Cox transformation (\(\lambda \ge 0\)) inside
fable::ARIMA()and explain automatic back-transformation with mean bias adjustment. - Evaluate competing ETS and ARIMA models strictly out of sample using point accuracy (RMSE, MAE, MASE), probabilistic accuracy (CRPS), and empirical 80% and 95% prediction interval coverage.
- Verify innovation residual whiteness with
gg_tsresiduals()and degrees-of-freedom-adjusted Ljung-Box tests.
1. Complementary Model Families & Cross-Family Rules
ETS and ARIMA overlap on linear non-stationary processes, yet neither family subsumes the other:
- Shared special cases: Linear additive ETS models correspond to specific ARIMA models. For example,
ETS(A,N,N)equalsARIMA(0,1,1),ETS(A,A,N)equalsARIMA(0,2,2), andETS(A,Ad,N)equalsARIMA(1,1,2). - Where ETS excels: Nonlinear multiplicative specifications such as
ETS(M,A,M)andETS(M,Ad,M)have no exact ARIMA counterpart. They model proportional seasonality and level-dependent noise directly on the original scale. - Where ARIMA excels: Every ETS model is non-stationary (its level state behaves like a random walk), whereas ARIMA captures stationary dynamics and rich autoregressive or moving-average lag structures that no ETS recursion can represent.
Why AICc Cannot Compare ETS vs. ARIMA
Likelihood-based information criteria (AIC, AICc, BIC) require identical response variables and comparable likelihood definitions. Consequently, never compare AICc across:
- An ETS model and an ARIMA model (their likelihoods treat initial states and differencing differently).
- Two ARIMA models with different differencing orders \((d, D)\).
- A raw-scale model and a Box-Cox-transformed model (the Jacobian of the transformation changes the log-likelihood scale).
Cross-family selection therefore requires out-of-sample evaluation on a held-out test set or time series cross-validation.
2. Box-Cox Variance Stabilization & Bias Adjustment
When an untransformed series exhibits growing seasonal spread, an additive-error ARIMA model underestimates future variance at high levels and overestimates it at low levels. The Box-Cox transformation stabilizes variance before fitting ARIMA:
\[ w_t = \begin{cases} \log(y_t), & \lambda = 0, \\ \dfrac{y_t^\lambda - 1}{\lambda}, & \lambda \ne 0. \end{cases} \]
We select \(\lambda\) from the training set only using Guerrero’s method (feasts::guerrero()). In forecasting practice we enforce lower = 0, because \(\lambda < 0\) creates a finite upper asymptote at \(w = -1/\lambda\) that can severely distort or invert upper prediction bounds upon back-transformation.
Automatic Back-Transformation and Bias Adjustment
Suppose the transformed forecast satisfies \(w_{T+h \mid T} \sim \mathcal{N}(\hat{w}_{T+h}, \sigma_h^2)\). Applying the inverse Box-Cox map \(g^{-1}(\hat{w}_{T+h})\) yields the forecast median, not the mean, because \(g^{-1}\) is strictly convex whenever \(\lambda < 1\). By Jensen’s inequality and a second-order Taylor expansion, the bias-adjusted forecast mean is:
\[ \hat{y}_{T+h \mid T} \approx \begin{cases} \exp(\hat{w}_{T+h})\left(1 + \dfrac{\sigma_h^2}{2}\right), & \lambda = 0, \\[8pt] (\lambda \hat{w}_{T+h} + 1)^{1/\lambda}\left[1 + \dfrac{\sigma_h^2 (1 - \lambda)}{2(\lambda \hat{w}_{T+h} + 1)^2}\right], & \lambda \ne 0. \end{cases} \]
When box_cox(y, lambda) appears directly on the left-hand side of ARIMA(), fable automatically back-transforms both point forecasts (with bias adjustment enabled by default) and prediction intervals onto the original response scale.
3. Out-of-Sample Benchmark: Australian Cement Production
We benchmark ETS and ARIMA on quarterly Australian Portland cement production (aus_production$Cement, measured in thousands of tonnes). We hold out the final 22 quarters (2005 Q1 to 2010 Q2) so empirical 80% and 95% interval coverage rates are informative.
cement <- aus_production |>
select(Quarter, Cement) |>
drop_na()
cem_train <- cement |> filter(Quarter < yearquarter("2005 Q1"))
cem_test <- cement |> filter(Quarter >= yearquarter("2005 Q1"))
lambda_cem <- cem_train |>
features(Cement, features = ~ guerrero(., lower = 0)) |>
pull(lambda_guerrero)
fit_cem <- cem_train |>
model(
ets_auto = ETS(Cement),
ets_madm = ETS(Cement ~ error("M") + trend("Ad") + season("M")),
arima_raw = ARIMA(Cement),
arima_bc = ARIMA(box_cox(Cement, lambda_cem))
)
fc_cem <- fit_cem |> forecast(new_data = cem_test)
accuracy(fc_cem, cement, measures = list(point_accuracy_measures, CRPS = CRPS)) |>
select(.model, RMSE, MAE, MASE, CRPS) |>
arrange(CRPS) |>
fmt_tbl(digits = 2, caption = "Out-of-sample accuracy on Australian Cement (2005 Q1-2010 Q2, thousands of tonnes)")| .model | RMSE | MAE | MASE | CRPS |
|---|---|---|---|---|
| arima_bc | 165.2 | 134.6 | 1.39 | 96.28 |
| ets_auto | 168.4 | 144.7 | 1.49 | 105.29 |
| ets_madm | 219.8 | 184.5 | 1.90 | 129.21 |
| arima_raw | 254.9 | 218.8 | 2.25 | 168.66 |
Guerrero’s method on the training split selects \(\hat{\lambda} \approx 0.128\) (near a log transform). Transforming the response dramatically transforms ARIMA’s performance: arima_bc (ARIMA(1,0,2)(0,1,1)[4] w/ drift on the Box-Cox scale) cuts RMSE from 255 down to 165 thousand tonnes and achieves the lowest CRPS (96.3), edging out automatic ETS(M,A,M) (105).
Exact Empirical 80% and 95% Interval Coverage
Good point forecasts are insufficient if prediction intervals are miscalibrated. We extract exact 80% and 95% intervals via hilo() and unpack_hilo(), then compute the fraction of the 22 test quarters falling inside each interval.
cov_cem <- fc_cem |>
hilo(level = c(80, 95)) |>
unpack_hilo(c(`80%`, `95%`)) |>
as_tibble() |>
left_join(as_tibble(cem_test), by = "Quarter", suffix = c("", "_actual")) |>
group_by(.model) |>
summarise(
Cov_80 = mean(Cement_actual >= `80%_lower` & Cement_actual <= `80%_upper`),
Cov_95 = mean(Cement_actual >= `95%_lower` & Cement_actual <= `95%_upper`)
)
fmt_tbl(cov_cem, digits = 3, caption = "Empirical 80% and 95% prediction interval coverage (n = 22 test quarters)")| .model | Cov_80 | Cov_95 |
|---|---|---|
| arima_bc | 0.909 | 0.955 |
| arima_raw | 0.318 | 0.591 |
| ets_auto | 0.955 | 0.955 |
| ets_madm | 0.909 | 0.955 |
fc_cem |>
filter(.model %in% c("arima_raw", "arima_bc", "ets_auto")) |>
anchor_fc(cem_train) |>
autoplot(cement |> filter(Quarter >= yearquarter("1998 Q1")), level = 95) +
facet_wrap(vars(.model), ncol = 1) +
guides(
colour = "none",
fill = "none",
fill_ramp = guide_legend(title = "Prediction interval")
) +
labs(
title = "Australian Cement Production: ETS vs. Raw and Box-Cox ARIMA",
subtitle = "95% intervals: raw ARIMA hits 59% coverage vs. 95.5% for ETS & Box-Cox",
x = "Quarter",
y = "Cement Production (Thousands of Tonnes)"
)
Untransformed arima_raw suffers severe under-coverage (31.8% at the 80% level and 59.1% at the 95% level) because it fits a single constant innovation variance to both 1950s low-volume production and 2000s high-volume production. Both arima_bc and ets_auto recover well-calibrated 95.5% empirical coverage (21/22 quarters).
4. Innovation Residual Diagnostics
Finally, we check whether the winning arima_bc model leaves any unmodeled autocorrelation in its innovation residuals .innov. Because arima_bc estimates 4 AR/MA terms (ar1, ma1, ma2, sma1), we pass dof = 4 to ljung_box().
fit_cem |>
select(arima_bc) |>
gg_tsresiduals(lag_max = 16) |>
ts_panel(
title = "Innovation Residuals: Box-Cox ARIMA on Australian Cement",
subtitle = "Residuals show stable variance and no significant autocorrelation spikes"
)
bind_rows(
fit_cem |> select(arima_bc) |> augment() |> features(.innov, ljung_box, lag = 12, dof = 4),
fit_cem |> select(ets_auto) |> augment() |> features(.innov, ljung_box, lag = 12, dof = 0)
) |>
fmt_tbl(digits = 4, caption = "Ljung-Box whiteness checks on training innovation residuals (lag = 12)")| .model | lb_stat | lb_pvalue |
|---|---|---|
| arima_bc | 10.58 | 0.2269 |
| ets_auto | 29.26 | 0.0036 |
The Box-Cox ARIMA innovations pass the Ljung-Box test cleanly (\(p = 0.227\)), confirming white-noise residuals, whereas ets_auto retains statistically significant residual autocorrelation (\(p < 0.001\)), explaining arima_bc’s edge in out-of-sample CRPS.
Practice Exercises
Exercise 1: Out-of-Sample Calibration on Australian Electricity Production
Split aus_production$Electricity (gigawatt-hours) into training (< 2005 Q1) and test (2005 Q1 to 2010 Q2) sets. Estimate \(\lambda \ge 0\) on the training set with guerrero(., lower = 0), fit ETS(Electricity) and ARIMA(box_cox(Electricity, lambda)), and report out-of-sample RMSE, MAE, 95% Winkler interval score (winkler_score), and exact 80% and 95% prediction interval coverage.
Solution
Guerrero’s method chooses \(\hat{\lambda} \approx 0.418\). On the 22-quarter test set, ETS edges out Box-Cox ARIMA on point RMSE (1539 vs. 1633), while Box-Cox ARIMA achieves a dramatically lower 95% Winkler score (7571 vs. 12095) because its prediction intervals are much sharper while still attaining 100% coverage at the 95% level.
elec <- aus_production |>
select(Quarter, Electricity) |>
drop_na()
elec_tr <- elec |> filter(Quarter < yearquarter("2005 Q1"))
elec_te <- elec |> filter(Quarter >= yearquarter("2005 Q1"))
lam_e <- elec_tr |>
features(Electricity, features = ~ guerrero(., lower = 0)) |>
pull(lambda_guerrero)
fit_elec <- elec_tr |>
model(
ets_auto = ETS(Electricity),
arima_bc = ARIMA(box_cox(Electricity, lam_e))
)
fc_elec <- fit_elec |> forecast(new_data = elec_te)
accuracy(fc_elec, elec, measures = list(point_accuracy_measures, Winkler95 = winkler_score)) |>
select(.model, RMSE, MAE, MASE, Winkler95) |>
fmt_tbl(digits = 2, caption = "Out-of-sample accuracy on Australian Electricity (GWh)")| .model | RMSE | MAE | MASE | Winkler95 |
|---|---|---|---|---|
| arima_bc | 1633 | 1338 | 1.25 | 7571 |
| ets_auto | 1539 | 1224 | 1.15 | 12095 |
fc_elec |>
hilo(level = c(80, 95)) |>
unpack_hilo(c(`80%`, `95%`)) |>
as_tibble() |>
left_join(as_tibble(elec_te), by = "Quarter", suffix = c("", "_actual")) |>
group_by(.model) |>
summarise(
Cov_80 = mean(Electricity_actual >= `80%_lower` & Electricity_actual <= `80%_upper`),
Cov_95 = mean(Electricity_actual >= `95%_lower` & Electricity_actual <= `95%_upper`)
) |>
fmt_tbl(digits = 3, caption = "Empirical prediction interval coverage on Australian Electricity")| .model | Cov_80 | Cov_95 |
|---|---|---|
| arima_bc | 0.955 | 1 |
| ets_auto | 1.000 | 1 |
Exercise 2: Residual Check with Exact dof
Inspect the selected ARIMA order in fit_elec |> select(arima_bc) from Exercise 1 and run a Ljung-Box test at lag = 12 using the exact number of estimated AR/MA parameters for dof.
Solution
ARIMA(box_cox(Electricity, lam_e)) selects ARIMA(0,1,2)(0,1,1)[4], which has 3 AR/MA parameters (ma1, ma2, sma1), so dof = 3.
tidy(fit_elec |> select(arima_bc)) |>
select(term, estimate, std.error, p.value) |>
fmt_tbl(digits = 4, caption = "Box-Cox ARIMA parameter estimates for Australian Electricity")| term | estimate | std.error | p.value |
|---|---|---|---|
| ma1 | -0.3390 | 0.0723 | 0.0000 |
| ma2 | -0.1959 | 0.0805 | 0.0159 |
| sma1 | -0.6394 | 0.0480 | 0.0000 |
fit_elec |>
select(arima_bc) |>
augment() |>
features(.innov, ljung_box, lag = 12, dof = 3) |>
fmt_tbl(digits = 4, caption = "Ljung-Box test on Electricity Box-Cox ARIMA innovations (dof = 3)")| .model | lb_stat | lb_pvalue |
|---|---|---|
| arima_bc | 11.6 | 0.237 |
Key Takeaways
- Never compare AICc across ETS and ARIMA, across different differencing orders, or across transformed vs. untransformed responses; rely on out-of-sample metrics instead.
- Compute Box-Cox \(\lambda\) on the training set only with
guerrero(., lower = 0)to prevent negative-\(\lambda\) asymptote distortion, and letfableapply automatic bias-adjusted back-transformation. - Pair point metrics (RMSE, MASE) with probabilistic scores (CRPS) and exact empirical interval coverage via
hilo()andunpack_hilo(). - Always diagnose
.innovresiduals withgg_tsresiduals() |> ts_panel()and matchdofinljung_box()to the model’s AR/MA parameter count.