1. Plot

plot(DATE, data$inflation, type = 'l')

2. Moving Average

data$MA4 <- TTR::SMA(data$inflation, n=4)

head(data, n=30)
## # A tibble: 30 x 3
##    DATE       inflation   MA4
##    <date>         <dbl> <dbl>
##  1 1960-01-01      1.46 NA   
##  2 1961-01-01      1.07 NA   
##  3 1962-01-01      1.20 NA   
##  4 1963-01-01      1.24  1.24
##  5 1964-01-01      1.28  1.20
##  6 1965-01-01      1.59  1.33
##  7 1966-01-01      3.02  1.78
##  8 1967-01-01      2.77  2.16
##  9 1968-01-01      4.27  2.91
## 10 1969-01-01      5.46  3.88
## # … with 20 more rows

B

library(ggplot2)

pl <- ggplot(data, aes(x = DATE))
pl <- pl + geom_line(aes(y=data$inflation, color = 'inflation'))
pl <- pl + geom_line(aes(y=data$MA4, color = "four period MA"))
pl
## Warning: Removed 3 row(s) containing missing values (geom_path).

3. Exponential Smoothing

ts.data <- ts(data$inflation, start = c(1960,1))
ses <- ses(ts.data, h=2)
summary(ses)
## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = ts.data, h = 2) 
## 
##   Smoothing parameters:
##     alpha = 0.9999 
## 
##   Initial states:
##     l = 1.4588 
## 
##   sigma:  1.6619
## 
##      AIC     AICc      BIC 
## 316.7011 317.1221 323.0337 
## 
## Error measures:
##                        ME     RMSE      MAE       MPE     MAPE     MASE
## Training set -0.003691289 1.634429 1.187958 -1.872906 70.54902 0.983622
##                   ACF1
## Training set 0.1589946
## 
## Forecasts:
##      Point Forecast     Lo 80    Hi 80     Lo 95    Hi 95
## 2021       1.233642 -0.896168 3.363453 -2.023622 4.490906
## 2022       1.233642 -1.778214 4.245498 -3.372594 5.839879
plot(ses)

4. Holt Winters

hw1 <- holt(ts.data, h=4)
summary(hw1)
## 
## Forecast method: Holt's method
## 
## Model Information:
## Holt's method 
## 
## Call:
##  holt(y = ts.data, h = 4) 
## 
##   Smoothing parameters:
##     alpha = 0.9998 
##     beta  = 1e-04 
## 
##   Initial states:
##     l = 0.0362 
##     b = 0.011 
## 
##   sigma:  1.7013
## 
##      AIC     AICc      BIC 
## 321.4539 322.5448 332.0083 
## 
## Error measures:
##                       ME     RMSE      MAE        MPE     MAPE    MASE
## Training set 0.008264003 1.644545 1.210022 -0.7917959 72.30846 1.00189
##                   ACF1
## Training set 0.1537244
## 
## Forecasts:
##      Point Forecast      Lo 80    Hi 80     Lo 95    Hi 95
## 2021       1.244772 -0.9354931 3.425038 -2.089656 4.579201
## 2022       1.255854 -1.8273884 4.339096 -3.459558 5.971265
## 2023       1.266935 -2.5093315 5.043202 -4.508366 7.042236
## 2024       1.278016 -3.0826005 5.638633 -5.390972 7.947005
plot(hw1)

#5

MSE for Holt Winters = 1.001 MSE for Simple smoothing = 0.98

Eventhough, the MSE for SES is lower than Holt Winters. I will still use Holt Winters for forecasting. Because the forecast values for SES are all the same as the last years value.

On the other hand, Holt Winters prediction are more realistic and hence can be used even with the higher MSE.