FHW7

Author

John Guarini

Smoothing Parameters for ETS Modeling

For ETS models there are three main parameters that an ETS model adheres to, those being the Level (lt ) , Trend (bt ), and Seasonality (sm ). The Level refers to the underlying baseline at time t, describing where and or the series is as of this moment. Level carries the the coefficient alpha (α). While the Trend is looking at the slope of the level, seeing how fast the series is increasing or decreasing over time t. Trend carries the the coefficient beta (β). Lastly the Seasonality is the pattern across the seasons of length m, looking at is a series can a have a quarterly shift or a monthly dip. Seasonality carries the the coefficient gamma (γ). With in these parameters the coefficients are bound between 0 and 1. Deeper into their function, the Level can take on two interpretations: Additive and Multiplicative. The Trend can have an Additive, Additive dampening (ϕ) (which can be another parameter), and No Trend. Seasonality follows in a similar vein but has either an Additive or No Seasonality.

Data Set Visualization

The two data sets that I will be looking at is Australian beer production, by aus_production, and US retail employment, by us_employment.

library(fpp3)
Registered S3 method overwritten by 'tsibble':
  method               from 
  as_tibble.grouped_df dplyr
── Attaching packages ──────────────────────────────────────────── fpp3 1.0.2 ──
✔ tibble      3.3.0     ✔ tsibble     1.1.6
✔ dplyr       1.1.4     ✔ tsibbledata 0.4.1
✔ tidyr       1.3.1     ✔ feasts      0.4.2
✔ lubridate   1.9.4     ✔ fable       0.4.1
✔ ggplot2     4.0.0     
── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
✖ lubridate::date()    masks base::date()
✖ dplyr::filter()      masks stats::filter()
✖ tsibble::intersect() masks base::intersect()
✖ tsibble::interval()  masks lubridate::interval()
✖ dplyr::lag()         masks stats::lag()
✖ tsibble::setdiff()   masks base::setdiff()
✖ tsibble::union()     masks base::union()
# ---- Time series 1: aus_production (pick Beer) ----
ts1 <- aus_production |> select(Quarter, Beer)

p1 <- ts1 |>
  autoplot(Beer) +
  labs(title = "aus_production: Beer", y = "Beer")

p1

ggsave("aus_production_beer.svg", p1, width = 9, height = 4)

# ---- Time series 2: us_employment (pick Retail Trade) ----
ts2 <- us_employment |>
  filter(Title == "Retail Trade") |>
  select(Month, Employed)

p2 <- ts2 |>
  autoplot(Employed) +
  labs(title = "us_employment: Retail Trade", y = "Employed")

p2

ggsave("us_employment_retail.svg", p2, width = 9, height = 4)

1.) Beer (aus_production)

By just eyeballing the modeled plot, the series seems to have mild seasonality and a small trend that levels off at the end of ~Q2 of 1970. This leveling off of the trend could be due to some dampening in the data, meaning that the trend could be additive dampening. The level seems to be slightly multiplicative rather than additive, just by the slight increase over time of the series’ fluctuations.

I would expect that the alpha value to be mild (α=~.2-.6) meaning that the level is changing moderately. While the beta value i would expect to be lower (β= ~.2-.3) as the trend seems to be weak, although it does seem to have some dampening (ϕ= ~.8-1) be it also looks to be weak. The gamma value looks to also be moderate (γ= ~.3-.6) as it seems to be stable.

2.) Retail Employment (us_employment)

With just a glance the series has a stronger trend than the previous plot. Though there seems to be no dampening happening in the is plot. The seasonality of this plot seems to look stable and symmetric, although it looks small. With that being said, it can be assumed that the level of this plot is strongly additive as the size of the seasonality trend seems to be uniform.

I would expect this alpha value to be strong (α=~.5-.9) seeing how over time the level is changing faster. With that being said I would believe that the trend would also be strong (β= ~.3-6), and since there doesn’t seem to be any dampening the phi value will reflect that (ϕ= ~1). With a small seasonality I’d expect this value to be low (γ= ~.1-.4).

Fitting ETS

# Fit ETS automatically (let the algorithm choose error/trend/season forms)
fit1 <- ts1 |> model(ets = ETS(Beer))


report(fit1)
Series: Beer 
Model: ETS(M,A,M) 
  Smoothing parameters:
    alpha = 0.2086609 
    beta  = 0.0301882 
    gamma = 0.198386 

  Initial states:
    l[0]      b[0]     s[0]     s[-1]     s[-2]    s[-3]
 255.892 0.6794953 1.182975 0.9112588 0.8613814 1.044385

  sigma^2:  0.0013

     AIC     AICc      BIC 
2354.249 2355.114 2384.709 
# Get fitted model objects (to see components + parameters)
tidy(fit1)
# A tibble: 9 × 3
  .model term  estimate
  <chr>  <chr>    <dbl>
1 ets    alpha   0.209 
2 ets    beta    0.0302
3 ets    gamma   0.198 
4 ets    l[0]  256.    
5 ets    b[0]    0.679 
6 ets    s[0]    1.18  
7 ets    s[-1]   0.911 
8 ets    s[-2]   0.861 
9 ets    s[-3]   1.04  
fit1 |> forecast(h = 8)  |> autoplot(ts1) + labs(title="ETS forecast: Beer")

Intuition vs Estimated Value

1.) Beer (aus_production): After ETS was applied the model reflected ETS(M,A,M). Meaning that the level with an alpha value of ~0.21 (low level) was multiplicative, the noise of the series grew with the alpha. The trend was seen to be additive with a beta value of ~0.0301, which means that there probably isn’t a very strong trend existing for the series (or trend at all). The seasonality was also said to be multiplicative with a gamma value of ~0.2, showing weak seasonality. Compared to what I previously predicted off a glance, (α=~.2-.6), (β= ~.2-.3), (γ= ~.3-.6), and (ϕ= ~.8-1) respectively, I may have only gotten one or two values correct. This goes to show that intuition shouldn’t be the only way to identify a plots behavior, when mathematically the results can be starkly different. Also to note, the exclusion of phi in this chart indicated that the value of phi was 1, thus being excluded since it was not used.

fit2 <- ts2 |> model(ets = ETS(Employed))

report(fit2)
Series: Employed 
Model: ETS(A,Ad,A) 
  Smoothing parameters:
    alpha = 0.5229439 
    beta  = 0.0526557 
    gamma = 0.477056 
    phi   = 0.9749184 

  Initial states:
     l[0]     b[0]     s[0]    s[-1]    s[-2]    s[-3]   s[-4]     s[-5]
 3122.659 9.584743 473.8638 230.9042 32.71821 -29.6463 -28.925 -26.95379
    s[-6]     s[-7]     s[-8]     s[-9]    s[-10]    s[-11]
 3.039879 -51.73948 -107.4174 -166.4203 -202.7419 -126.6818

  sigma^2:  2300.646

     AIC     AICc      BIC 
14182.93 14183.65 14270.70 
tidy(fit2)
# A tibble: 18 × 3
   .model term    estimate
   <chr>  <chr>      <dbl>
 1 ets    alpha     0.523 
 2 ets    beta      0.0527
 3 ets    gamma     0.477 
 4 ets    phi       0.975 
 5 ets    l[0]   3123.    
 6 ets    b[0]      9.58  
 7 ets    s[0]    474.    
 8 ets    s[-1]   231.    
 9 ets    s[-2]    32.7   
10 ets    s[-3]   -29.6   
11 ets    s[-4]   -28.9   
12 ets    s[-5]   -27.0   
13 ets    s[-6]     3.04  
14 ets    s[-7]   -51.7   
15 ets    s[-8]  -107.    
16 ets    s[-9]  -166.    
17 ets    s[-10] -203.    
18 ets    s[-11] -127.    
fit2 |> forecast(h = 24) |> autoplot(ts2) + labs(title="ETS forecast: Retail Employment")

2.) Retail Employment (us_employment): After the ETS was applied the modeling reflected an ETS(A,Ad,A). Compared with the australian beer production’s plot, this model shows its leveling to be additive rather than multiplicative with an alpha value of ~0.5 (moderate). The trend was seen to be stronger in this plot with a beta value of ~0.053 (also weak). To add to the trend, it was seen as additive dampening, the phi value was ~0.975 (very weak but still there). This plot also have relatively stable seasonality,being seen as additive, with a gamma value of ~0.477 (moderate). This plotted model was closer to my predicted values, (α=~.5-.9), (β= ~.3-6), (ϕ= ~1), (γ= ~.1-.4), but even still my predictions are off.

Comparing Modeling Values with Excel for ETS(A,N,N)

Fitting model in R

library(fpp3)

fit_ann <- ts1 |> model(ann = ETS(Beer ~ error("A") + trend("N") + season("N")))
report(fit_ann)
Series: Beer 
Model: ETS(A,N,N) 
  Smoothing parameters:
    alpha = 0.1488153 

  Initial states:
     l[0]
 259.6135

  sigma^2:  2588.814

     AIC     AICc      BIC 
2891.063 2891.175 2901.216 
# Extract alpha value cleanly
params_ann <- tidy(fit_ann)
params_ann
# A tibble: 2 × 3
  .model term  estimate
  <chr>  <chr>    <dbl>
1 ann    alpha    0.149
2 ann    l[0]   260.   
ts1 <- aus_production |> select(Quarter, Beer)

# Convert to regular data frame
df1 <- as.data.frame(ts1)

# Write to CSV
write.csv(df1, "beer_data.csv", row.names = FALSE)