This dataset shows the employment rate of college graduates who have their Bachelor’s Degree and higher from ages 25 and over from January 1, 1992 to October 1, 2020.
library(fpp2)
## Warning: package 'fpp2' was built under R version 4.0.3
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
## -- Attaching packages ---------- fpp2 2.4 --
## v ggplot2 3.3.0 v fma 2.4
## v forecast 8.12 v expsmooth 2.3
## Warning: package 'forecast' was built under R version 4.0.2
## Warning: package 'fma' was built under R version 4.0.3
## Warning: package 'expsmooth' was built under R version 4.0.3
##
library(knitr)
library(readxl)
employment<- read_excel("C:/Users/burtkb/Downloads/LNS12027662.xls", skip = 1)
e.ts = ts(employment[,2], start=c(1992,1), end=c(2020,10), frequency = 12)
sum(is.na(e.ts))
## [1] 0
There are 0 missing values.
e.ts2 = stl(e.ts, s.window="periodic")
dets = seasadj(e.ts2)
plot(dets)
ggseasonplot(dets)
There is an increasing trend, and there seems to be a bit of seasonality as it increases slightly over the summer and ends with a larger bump in October. This is the time when recent graduates are seeking employment.
#model1
fit1 = HoltWinters(dets)
f1 = forecast(fit1, 12)
print(summary(f1))
##
## Forecast method: HoltWinters
##
## Model Information:
## Holt-Winters exponential smoothing with trend and additive seasonal component.
##
## Call:
## HoltWinters(x = dets)
##
## Smoothing parameters:
## alpha: 0.05610917
## beta : 0.6063179
## gamma: 0
##
## Coefficients:
## [,1]
## a 56876.27548
## b -943.31238
## s1 116.23702
## s2 115.13016
## s3 78.28245
## s4 26.94597
## s5 -29.52696
## s6 -117.13159
## s7 -203.04659
## s8 -161.78528
## s9 -123.83144
## s10 -194.91967
## s11 -255.78522
## s12 749.43116
##
## Error measures:
## ME RMSE MAE MPE MAPE MASE
## Training set -88.85823 1769.131 346.7189 -0.3282525 0.9129443 0.2881122
## ACF1
## Training set 0.01499644
##
## Forecasts:
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## Nov 2020 56049.20 53781.43 58316.97 52580.95 59517.45
## Dec 2020 55104.78 52827.82 57381.74 51622.47 58587.09
## Jan 2021 54124.62 51830.32 56418.92 50615.79 57633.45
## Feb 2021 53129.97 50807.80 55452.14 49578.52 56681.42
## Mar 2021 52130.19 49767.47 54492.90 48516.72 55743.65
## Apr 2021 51099.27 48681.50 53517.04 47401.62 54796.92
## May 2021 50070.04 47581.30 52558.79 46263.83 53876.25
## Jun 2021 49167.99 46591.34 51744.64 45227.34 53108.64
## Jul 2021 48262.63 45580.60 50944.67 44160.81 52364.45
## Aug 2021 47248.23 44443.18 50053.29 42958.27 51538.19
## Sep 2021 46244.05 43298.54 49189.57 41739.28 50748.83
## Oct 2021 46305.96 43202.99 49408.93 41560.38 51051.54
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## Nov 2020 56049.20 53781.43 58316.97 52580.95 59517.45
## Dec 2020 55104.78 52827.82 57381.74 51622.47 58587.09
## Jan 2021 54124.62 51830.32 56418.92 50615.79 57633.45
## Feb 2021 53129.97 50807.80 55452.14 49578.52 56681.42
## Mar 2021 52130.19 49767.47 54492.90 48516.72 55743.65
## Apr 2021 51099.27 48681.50 53517.04 47401.62 54796.92
## May 2021 50070.04 47581.30 52558.79 46263.83 53876.25
## Jun 2021 49167.99 46591.34 51744.64 45227.34 53108.64
## Jul 2021 48262.63 45580.60 50944.67 44160.81 52364.45
## Aug 2021 47248.23 44443.18 50053.29 42958.27 51538.19
## Sep 2021 46244.05 43298.54 49189.57 41739.28 50748.83
## Oct 2021 46305.96 43202.99 49408.93 41560.38 51051.54
#model2
fit2 = ets(dets)
f2 = forecast(fit2, 12)
print(summary(f2))
##
## Forecast method: ETS(M,A,N)
##
## Model Information:
## ETS(M,A,N)
##
## Call:
## ets(y = dets)
##
## Smoothing parameters:
## alpha = 0.3372
## beta = 1e-04
##
## Initial states:
## l = 26868.7998
## b = 71.989
##
## sigma: 0.03
##
## AIC AICc BIC
## 6945.923 6946.099 6965.155
##
## Error measures:
## ME RMSE MAE MPE MAPE MASE
## Training set -31.39286 1713.725 293.4481 -0.202378 0.8203071 0.2438459
## ACF1
## Training set 0.004504733
##
## Forecasts:
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## Nov 2020 48406.67 46546.95 50266.38 45562.48 51250.86
## Dec 2020 48477.57 46512.25 50442.89 45471.87 51483.27
## Jan 2021 48548.47 46482.59 50614.36 45388.98 51707.97
## Feb 2021 48619.38 46457.27 50781.48 45312.72 51926.04
## Mar 2021 48690.28 46435.73 50944.83 45242.24 52138.32
## Apr 2021 48761.18 46417.52 51104.84 45176.87 52345.50
## May 2021 48832.08 46402.29 51261.88 45116.03 52548.14
## Jun 2021 48902.99 46389.71 51416.27 45059.26 52746.71
## Jul 2021 48973.89 46379.54 51568.24 45006.17 52941.61
## Aug 2021 49044.79 46371.55 51718.04 44956.42 53133.17
## Sep 2021 49115.70 46365.56 51865.83 44909.72 53321.67
## Oct 2021 49186.60 46361.40 52011.80 44865.83 53507.37
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## Nov 2020 48406.67 46546.95 50266.38 45562.48 51250.86
## Dec 2020 48477.57 46512.25 50442.89 45471.87 51483.27
## Jan 2021 48548.47 46482.59 50614.36 45388.98 51707.97
## Feb 2021 48619.38 46457.27 50781.48 45312.72 51926.04
## Mar 2021 48690.28 46435.73 50944.83 45242.24 52138.32
## Apr 2021 48761.18 46417.52 51104.84 45176.87 52345.50
## May 2021 48832.08 46402.29 51261.88 45116.03 52548.14
## Jun 2021 48902.99 46389.71 51416.27 45059.26 52746.71
## Jul 2021 48973.89 46379.54 51568.24 45006.17 52941.61
## Aug 2021 49044.79 46371.55 51718.04 44956.42 53133.17
## Sep 2021 49115.70 46365.56 51865.83 44909.72 53321.67
## Oct 2021 49186.60 46361.40 52011.80 44865.83 53507.37
#model comparison
par(mfrow=c(1,2))
plot(forecast(f1))
plot(forecast(f2))
accuracy(f1) #MAPE = ~0.913 = 99.087% accuracy
## ME RMSE MAE MPE MAPE MASE
## Training set -88.85823 1769.131 346.7189 -0.3282525 0.9129443 0.2881122
## ACF1
## Training set 0.01499644
accuracy(f2) #MAPE = ~0.820 = 99.180% accuracy
## ME RMSE MAE MPE MAPE MASE
## Training set -31.39286 1713.725 293.4481 -0.202378 0.8203071 0.2438459
## ACF1
## Training set 0.004504733
Based on the information above, we can see that model 2 (f2) is a slightly better model than the first (f1).