library(knitr)
library(fpp2)
## Warning: package 'fpp2' was built under R version 3.6.2
## Registered S3 method overwritten by 'xts':
##   method     from
##   as.zoo.xts zoo
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## ── Attaching packages ───────────────────────────────────────────────────────────────────────── fpp2 2.4 ──
## ✓ ggplot2   3.3.2     ✓ fma       2.4  
## ✓ forecast  8.13      ✓ expsmooth 2.3
## Warning: package 'ggplot2' was built under R version 3.6.2
## Warning: package 'forecast' was built under R version 3.6.2
## 
discouraged <- read.csv("/Users/nelsonwhite/Documents/ms applied economics/Predictive Analytics:Forecasting/week 3 discussion/LNU05026645.csv")
head(discouraged)
##         DATE LNU05026645
## 1 1994-01-01         600
## 2 1994-02-01         489
## 3 1994-03-01         533
## 4 1994-04-01         502
## 5 1994-05-01         436
## 6 1994-06-01         532

The data shows thousands discouraged workers not in the labor force. From the FRED: “Want a Job Now, Marginally Attached, Discouraged Workers.”

summary(discouraged)
##          DATE      LNU05026645    
##  1994-01-01:  1   Min.   : 203.0  
##  1994-02-01:  1   1st Qu.: 362.2  
##  1994-03-01:  1   Median : 449.5  
##  1994-04-01:  1   Mean   : 528.7  
##  1994-05-01:  1   3rd Qu.: 660.5  
##  1994-06-01:  1   Max.   :1318.0  
##  (Other)   :316
dis.ts <- ts(discouraged[,2], start=c(1994,01,01), frequency = 12)
autoplot(dis.ts, main = "Discouraged Workers", xlab = "Year", ylab = "Thousands of Workers") 

There is some seasonality in the data, with strong spikes after the 2008 recession and Covid.

dis.m1 <- forecast(ets(dis.ts))
autoplot(dis.m1)

summary(dis.m1)
## 
## Forecast method: ETS(M,N,M)
## 
## Model Information:
## ETS(M,N,M) 
## 
## Call:
##  ets(y = dis.ts) 
## 
##   Smoothing parameters:
##     alpha = 0.5042 
##     gamma = 1e-04 
## 
##   Initial states:
##     l = 454.9396 
##     s = 0.9948 0.9805 0.9659 0.9352 0.9932 1.0604
##            1.0276 0.9423 1.0196 1.0159 1.0177 1.0469
## 
##   sigma:  0.1171
## 
##      AIC     AICc      BIC 
## 4477.230 4478.799 4533.848 
## 
## Error measures:
##                     ME     RMSE      MAE        MPE     MAPE      MASE
## Training set 0.8393137 63.14865 45.57299 -0.7865204 8.912996 0.4498958
##                    ACF1
## Training set 0.07590007
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80    Lo 95     Hi 95
## Nov 2020       593.6694 504.5634 682.7754 457.3935  729.9453
## Dec 2020       602.3102 500.9240 703.6965 447.2533  757.3671
## Jan 2021       633.8272 516.6782 750.9763 454.6632  812.9913
## Feb 2021       616.1975 492.9449 739.4501 427.6989  804.6961
## Mar 2021       615.0654 483.3264 746.8043 413.5881  816.5426
## Apr 2021       617.3191 476.8685 757.7696 402.5185  832.1197
## May 2021       570.5212 433.5100 707.5324 360.9807  780.0618
## Jun 2021       622.1737 465.2656 779.0819 382.2034  862.1440
## Jul 2021       642.0127 472.6974 811.3281 383.0672  900.9582
## Aug 2021       601.3110 436.0633 766.5587 348.5864  854.0356
## Sep 2021       566.2128 404.5561 727.8694 318.9802  813.4453
## Oct 2021       584.8345 411.8130 757.8560 320.2209  849.4481
## Nov 2021       593.6698 412.0795 775.2601 315.9514  871.3882
## Dec 2021       602.3107 412.2100 792.4114 311.5767  893.0446
## Jan 2022       633.8277 427.7696 839.8858 318.6890  948.9664
## Feb 2022       616.1979 410.1746 822.2213 301.1124  931.2835
## Mar 2022       615.0658 403.8687 826.2629 292.0677  938.0639
## Apr 2022       617.3195 399.9001 834.7390 284.8051  949.8339
## May 2022       570.5216 364.6551 776.3882 255.6759  885.3673
## Jun 2022       622.1742 392.4015 851.9468 270.7672  973.5811
## Jul 2022       642.0132 399.5815 884.4448 271.2459 1012.7804
## Aug 2022       601.3114 369.3456 833.2772 246.5503  956.0725
## Sep 2022       566.2132 343.2497 789.1767 225.2199  907.2064
## Oct 2022       584.8349 349.9295 819.7403 225.5781  944.0917
dis.m2 <- forecast(holt(dis.ts, h=12))
autoplot(dis.m2)

summary(dis.m2)
## 
## Forecast method: Holt's method
## 
## Model Information:
## Holt's method 
## 
## Call:
##  holt(y = dis.ts, h = 12) 
## 
##   Smoothing parameters:
##     alpha = 0.5699 
##     beta  = 1e-04 
## 
##   Initial states:
##     l = 539.4208 
##     b = 0.1139 
## 
##   sigma:  65.9864
## 
##      AIC     AICc      BIC 
## 4563.385 4563.575 4582.258 
## 
## Error measures:
##                      ME     RMSE      MAE       MPE     MAPE      MASE
## Training set 0.06490358 65.57526 48.93439 -1.040589 9.544192 0.4830794
##                     ACF1
## Training set -0.01499689
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Nov 2020       586.5918 502.0269 671.1568 457.2609 715.9228
## Dec 2020       586.7078 489.3688 684.0468 437.8407 735.5749
## Jan 2021       586.8237 478.1990 695.4485 420.6966 752.9509
## Feb 2021       586.9397 468.0927 705.7867 405.1789 768.7005
## Mar 2021       587.0557 458.7954 715.3159 390.8985 783.2128
## Apr 2021       587.1716 450.1402 724.2030 377.6002 796.7430
## May 2021       587.2876 442.0109 732.5643 365.1061 809.4691
## Jun 2021       587.4035 434.3223 740.4847 353.2860 821.5210
## Jul 2021       587.5195 427.0103 748.0287 342.0418 832.9971
## Aug 2021       587.6354 420.0247 755.2462 331.2969 843.9740
## Sep 2021       587.7514 413.3256 762.1772 320.9902 854.5126
## Oct 2021       587.8673 406.8807 768.8540 311.0722 864.6625
accuracy(dis.m1)
##                     ME     RMSE      MAE        MPE     MAPE      MASE
## Training set 0.8393137 63.14865 45.57299 -0.7865204 8.912996 0.4498958
##                    ACF1
## Training set 0.07590007
accuracy(dis.m2)
##                      ME     RMSE      MAE       MPE     MAPE      MASE
## Training set 0.06490358 65.57526 48.93439 -1.040589 9.544192 0.4830794
##                     ACF1
## Training set -0.01499689

It appears that the Model 1 (ETS) performs slightly better with RMSE a bit lower. Just as in 2010 following the housing crisis, we may expect a spike of discouraged workers as a lagged effect ~2 years after the beginning of the Covid pandemic.