library(fredr)
library(dplyr)
library(ggplot2)
library(forecast)
library(tsibble)
library(readr)
fredr_set_key(Sys.getenv("FRED_API_KEY"))ADEC7406 Module 5 Discussion
1. What are smoothing parameters in an ETS model?
In an ETS (Error, Trend, Seasonality) model, smoothing parameters control how quickly each model component updates when new observations arrive.
- \(\alpha\) (alpha): level smoothing parameter. A higher \(\alpha\) puts more weight on the most recent observation, so the level adapts quickly.
- \(\beta\) (beta): trend smoothing parameter. A higher \(\beta\) makes the estimated trend react faster to recent changes.
- \(\gamma\) (gamma): seasonal smoothing parameter. A higher \(\gamma\) updates the seasonal pattern more aggressively.
- \(\phi\) (phi): damping parameter for trend. When \(0<\phi<1\), future trend is damped (growth/decline gradually flattens). If \(\phi=1\), there is no damping.
These parameters are typically constrained to sensible ranges (usually between 0 and 1) and chosen to minimize one-step-ahead forecast errors.
2. Two time series, visualization, and explanation
I selected two monthly FRED series with clearly different dynamics:
UNRATE(U.S. Unemployment Rate),CPIAUCSL(Consumer Price Index for All Urban Consumers).
unrate_raw <- fredr(
series_id = "UNRATE",
observation_start = as.Date("1990-01-01")
)
cpi_raw <- fredr(
series_id = "CPIAUCSL",
observation_start = as.Date("1990-01-01")
)
unrate_df <- unrate_raw %>%
select(date, value) %>%
rename(unrate = value)
cpi_df <- cpi_raw %>%
select(date, value) %>%
rename(cpi = value)Vector image plots
p1 <- ggplot(unrate_df, aes(x = date, y = unrate)) +
geom_line(linewidth = 0.5) +
labs(
title = "UNRATE (FRED)",
x = NULL,
y = "Percent"
) +
theme_minimal(base_size = 12)
p2 <- ggplot(cpi_df, aes(x = date, y = cpi)) +
geom_line(linewidth = 0.5) +
labs(
title = "CPIAUCSL (FRED)",
x = NULL,
y = "Index"
) +
theme_minimal(base_size = 12)
# Save vector graphics (SVG)
ggsave("unrate.svg", plot = p1, width = 9, height = 4)
ggsave("cpiaucsl.svg", plot = p2, width = 9, height = 4)
p1p2Eyeballing-based expectations for smoothing parameters
From visual inspection:
- UNRATE: noticeable cycles and turning points, but no strong deterministic seasonality.
- Expected: moderate-to-high \(\alpha\) (level should respond to swings), moderate \(\beta\) (to capture changing slope), \(\gamma \approx 0\) (no clear seasonality), and possible damping with \(\phi<1\).
- CPIAUCSL: smooth long-run upward movement with persistent trend.
- Expected: lower-to-moderate \(\alpha\) (series is smooth), lower \(\beta\) (trend changes gradually), \(\gamma \approx 0\) (no obvious seasonal pattern), and likely little damping (\(\phi\) close to 1 if trend persists).
3. Best ETS models and reconciliation with intuition
unrate_ts <- ts(unrate_df$unrate, start = c(1990, 1), frequency = 12)
cpi_ts <- ts(cpi_df$cpi, start = c(1990, 1), frequency = 12)
# Fit best ETS by AICc
fit_unrate <- ets(unrate_ts)
fit_cpi <- ets(cpi_ts)
fit_unrateETS(M,A,N)
Call:
ets(y = unrate_ts)
Smoothing parameters:
alpha = 0.9999
beta = 0.9999
Initial states:
l = 5.0596
b = 0.2882
sigma: 0.1
AIC AICc BIC
2105.023 2105.163 2125.376
fit_cpiETS(M,Ad,N)
Call:
ets(y = cpi_ts)
Smoothing parameters:
alpha = 0.9999
beta = 0.7388
phi = 0.8003
Initial states:
l = 127.1456
b = 0.0764
sigma: 0.0026
AIC AICc BIC
2073.169 2073.366 2097.593
params_unrate <- fit_unrate$par
params_cpi <- fit_cpi$par
params_unrate alpha beta l b
0.9999000 0.9999000 5.0596489 0.2881642
params_cpi alpha beta phi l b
0.99989996 0.73879781 0.80029669 127.14559069 0.07637648
Interpretation and reconciliation
The estimated ETS models largely refine rather than contradict the initial value intuition. For UNRATE, the model selects ETS(M,A,N) with smoothing parameters \(\alpha\) and \(\beta\) both close to one. Although we initially expected only moderate responsiveness, this result reflects the shock-driven nature of unemployment dynamics. Business cycle turning points cause rapid changes in level and slope, so the model places heavy weight on the most recent observations. The absence of damping suggests that unemployment trends do not gradually fade but instead reset frequently as economic conditions change.
For CPIAUCSL, the selected ETS(M,Ad,N) model shows a different structure. While \(\alpha\) is also near one, indicating strong persistence and continuous updating, the lower \(\beta\) implies smoother trend evolution, consistent with gradual inflation adjustments. The presence of damping (\(\phi < 1\)) indicates that inflation trends persist in the short run but are not expected to grow indefinitely, reflecting long-run stabilization forces such as monetary policy and anchored expectations. Overall, the ETS estimates align with economic intuition once the differing dynamics of cyclical unemployment and persistent but bounded price growth are considered.
autoplot(forecast(fit_unrate, h = 24)) +
labs(title = "UNRATE: ETS Forecast (24 months)")autoplot(forecast(fit_cpi, h = 24)) +
labs(title = "CPIAUCSL: ETS Forecast (24 months)")This confirms the final ETS specifications and provides a practical check that the selected parameterization yields plausible short-term forecasts.