## Loading required package: expsmooth
## Loading required package: lmtest
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: tseries
##    Paperback       Hardcover    
##  Min.   :111.0   Min.   :128.0  
##  1st Qu.:167.2   1st Qu.:170.5  
##  Median :189.0   Median :200.5  
##  Mean   :186.4   Mean   :198.8  
##  3rd Qu.:207.2   3rd Qu.:222.0  
##  Max.   :247.0   Max.   :283.0

Question 1

  1. Plot the series and discuss the main features of the data. Both series appear to have an upward linear trend. No seasonal trend, which is to be expected looking at just one month’s book sales.

  2. Use simple exponential smoothing with the ses function (setting initial=“simple”) and explore different values of ???? for the paperback series. Record the within-sample SSE for the one-step forecasts. Plot SSE against ???? and find which value of ???? works best. What is the effect of ???? on the forecasts?

##    alphas     SSEs
## 1    0.00 41270.00
## 2    0.05 39244.90
## 3    0.10 37785.20
## 4    0.15 36738.44
## 5    0.20 36329.34
## 6    0.25 36438.42
## 7    0.30 36930.75
## 8    0.35 37715.63
## 9    0.40 38738.40
## 10   0.45 39967.19
## 11   0.50 41383.70
## 12   0.55 42977.49
## 13   0.60 44742.62
## 14   0.65 46675.48
## 15   0.70 48773.56
## 16   0.75 51034.58
## 17   0.80 53456.14
## 18   0.85 56035.45
## 19   0.90 58769.45
## 20   0.95 61655.09
## 21   1.00 64690.00

The SSE starts at almost 90000 before it drops to 75135, it’s lowest point, when alpha is equal to .25. There’s a steady upward trend from that point.

## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = paper, h = 4, initial = "simple") 
## 
##   Smoothing parameters:
##     alpha = 0.2125 
## 
##   Initial states:
##     l = 199 
## 
##   sigma:  34.7918
## Error measures:
##                    ME     RMSE      MAE       MPE     MAPE      MASE
## Training set 1.749509 34.79175 28.64424 -2.770157 16.56938 0.7223331
##                    ACF1
## Training set -0.1268119
## 
## Forecasts:
##    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 31       210.1537 165.5663 254.7411 141.9631 278.3443
## 32       210.1537 164.5706 255.7368 140.4404 279.8671
## 33       210.1537 163.5962 256.7112 138.9501 281.3573
## 34       210.1537 162.6418 257.6657 137.4905 282.8170
  1. Now let ses select the optimal value of ????. Use this value to generate forecasts for the next four days. Compare your results with 2.
#initial= let it select
optimal_alpha_paper = ses(paper, h=4)
summary(optimal_alpha_paper)
## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = paper, h = 4) 
## 
##   Smoothing parameters:
##     alpha = 0.1685 
## 
##   Initial states:
##     l = 170.8257 
## 
##   sigma:  33.6377
## 
##      AIC     AICc      BIC 
## 318.9747 319.8978 323.1783 
## 
## Error measures:
##                    ME     RMSE     MAE       MPE     MAPE      MASE
## Training set 7.176212 33.63769 27.8431 0.4737524 15.57782 0.7021303
##                    ACF1
## Training set -0.2117579
## 
## Forecasts:
##    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 31       207.1098 164.0013 250.2182 141.1811 273.0384
## 32       207.1098 163.3934 250.8261 140.2513 273.9682
## 33       207.1098 162.7937 251.4258 139.3342 274.8853
## 34       207.1098 162.2021 252.0174 138.4294 275.7901
  1. Repeat but with initial=“optimal”. How much difference does an optimal initial level make?
## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = paper, h = 4, initial = "optimal") 
## 
##   Smoothing parameters:
##     alpha = 0.1685 
## 
##   Initial states:
##     l = 170.8257 
## 
##   sigma:  33.6377
## 
##      AIC     AICc      BIC 
## 318.9747 319.8978 323.1783 
## 
## Error measures:
##                    ME     RMSE     MAE       MPE     MAPE      MASE
## Training set 7.176212 33.63769 27.8431 0.4737524 15.57782 0.7021303
##                    ACF1
## Training set -0.2117579
## 
## Forecasts:
##    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 31       207.1098 164.0013 250.2182 141.1811 273.0384
## 32       207.1098 163.3934 250.8261 140.2513 273.9682
## 33       207.1098 162.7937 251.4258 139.3342 274.8853
## 34       207.1098 162.2021 252.0174 138.4294 275.7901
  1. Repeat steps (b)-(d) with the hardcover series.
##    alphas2     SSEs2
## 1     0.00 154503.00
## 2     0.05  70483.46
## 3     0.10  45714.82
## 4     0.15  36814.18
## 5     0.20  33148.16
## 6     0.25  31553.85
## 7     0.30  30909.69
## 8     0.35  30758.47
## 9     0.40  30895.27
## 10    0.45  31224.35
## 11    0.50  31702.60
## 12    0.55  32314.49
## 13    0.60  33059.93
## 14    0.65  33948.03
## 15    0.70  34993.95
## 16    0.75  36217.34
## 17    0.80  37641.79
## 18    0.85  39295.05
## 19    0.90  41209.53
## 20    0.95  43423.39
## 21    1.00  45982.00

## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = hard, h = 4, initial = "simple") 
## 
##   Smoothing parameters:
##     alpha = 0.3473 
## 
##   Initial states:
##     l = 139 
## 
##   sigma:  32.0198
## Error measures:
##                   ME     RMSE      MAE      MPE     MAPE      MASE
## Training set 9.72952 32.01982 26.34467 3.104211 13.05063 0.7860035
##                    ACF1
## Training set -0.1629042
## 
## Forecasts:
##    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 31       240.3808 199.3457 281.4158 177.6231 303.1385
## 32       240.3808 196.9410 283.8206 173.9453 306.8162
## 33       240.3808 194.6625 286.0990 170.4608 310.3008
## 34       240.3808 192.4924 288.2691 167.1418 313.6197
## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = hard, h = 4, initial = "optimal") 
## 
##   Smoothing parameters:
##     alpha = 0.3283 
## 
##   Initial states:
##     l = 149.2836 
## 
##   sigma:  31.931
## 
##      AIC     AICc      BIC 
## 315.8506 316.7737 320.0542 
## 
## Error measures:
##                    ME     RMSE     MAE      MPE     MAPE      MASE
## Training set 9.166918 31.93101 26.7731 2.636328 13.39479 0.7987858
##                    ACF1
## Training set -0.1417817
## 
## Forecasts:
##    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 31       239.5602 198.6390 280.4815 176.9766 302.1439
## 32       239.5602 196.4905 282.6299 173.6908 305.4297
## 33       239.5602 194.4443 284.6762 170.5613 308.5591
## 34       239.5602 192.4869 286.6336 167.5677 311.5527

Question 2

Apply Holt’s linear method to the paperback and hardback series and compute four-day forecasts in each case.

Paperback:

## 
## Forecast method: Holt's method
## 
## Model Information:
## Holt's method 
## 
## Call:
##  holt(y = paper, h = 4, initial = "simple") 
## 
##   Smoothing parameters:
##     alpha = 0.2984 
##     beta  = 0.4984 
## 
##   Initial states:
##     l = 199 
##     b = -27 
## 
##   sigma:  39.5463
## Error measures:
##                    ME     RMSE     MAE      MPE     MAPE      MASE
## Training set 7.769844 39.54634 33.5377 1.633306 18.19621 0.8457332
##                    ACF1
## Training set -0.1088681
## 
## Forecasts:
##    Point Forecast    Lo 80    Hi 80     Lo 95    Hi 95
## 31       222.0201 171.3394 272.7007 144.51068 299.5295
## 32       229.6904 164.8872 294.4935 130.58245 328.7983
## 33       237.3606 145.1175 329.6038  96.28696 378.4343
## 34       245.0309 115.5211 374.5407  46.96280 443.0991

Hardcover:

## 
## Forecast method: Holt's method
## 
## Model Information:
## Holt's method 
## 
## Call:
##  holt(y = hard, h = 4, initial = "simple") 
## 
##   Smoothing parameters:
##     alpha = 0.439 
##     beta  = 0.1574 
## 
##   Initial states:
##     l = 139 
##     b = -11 
## 
##   sigma:  35.0438
## Error measures:
##                    ME     RMSE      MAE      MPE     MAPE      MASE
## Training set 7.193267 35.04383 27.99174 2.423793 14.18241 0.8351445
##                     ACF1
## Training set -0.07743714
## 
## Forecasts:
##    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 31       250.7889 205.8784 295.6993 182.1042 319.4735
## 32       254.7003 202.4087 306.9918 174.7273 334.6733
## 33       258.6117 196.3181 320.9052 163.3419 353.8815
## 34       262.5231 187.9903 337.0558 148.5350 376.5111
  1. Compare the SSE measures of Holt’s method for the two series to those of simple exponential smoothing in the previous question. Discuss the merits of the two forecasting methods for these data sets.

Paperback ses “simple”:

## [1] 36313.98

Paperback ses “optimal”:

## [1] 33944.82

Paperback Holt:

## [1] 46917.39

The paperback series with the “optimal” ses smoothing has the lowest SSE.

Hardcover ses “simple”:

## [1] 30758.07

Hardcover ses “optimal”:

## [1] 30587.69

Hardcover Holt:

## [1] 36842.1

The hardcover series with the “optimal” ses smoothing also has the lowest SSE.

  1. Compare the forecasts for the two series using both methods. Which do you think is best?

Plot Paperback:

Paperback accuracy of ses “simple”:

##                ME     RMSE      MAE       MPE     MAPE       ACF1
## Test set 1.749509 34.79175 28.64424 -2.770157 16.56938 -0.1268119
##          Theil's U
## Test set 0.6807692

Paperback accuracy ses “optimal”:

##                ME     RMSE     MAE       MPE     MAPE       ACF1 Theil's U
## Test set 7.176212 33.63769 27.8431 0.4737524 15.57782 -0.2117579 0.6685721

Paperback accuracy “Holt”:

##                ME     RMSE     MAE      MPE     MAPE       ACF1 Theil's U
## Test set 7.769844 39.54634 33.5377 1.633306 18.19621 -0.1088681 0.8763663

The MAPE and RMSE are both lowest when using the intial= optimal ses method.

Plot Hardcover:

Hardcover accuracy ses “inital”:

##               ME     RMSE      MAE      MPE     MAPE       ACF1 Theil's U
## Test set 9.72952 32.01982 26.34467 3.104211 13.05063 -0.1629042 0.8142204

Hardcover accuracy ses “optimal”:

##                ME     RMSE     MAE      MPE     MAPE       ACF1 Theil's U
## Test set 9.166918 31.93101 26.7731 2.636328 13.39479 -0.1417817 0.8059213

Hardcover accuracy Holt:

##                ME     RMSE      MAE      MPE     MAPE        ACF1
## Test set 7.193267 35.04383 27.99174 2.423793 14.18241 -0.07743714
##          Theil's U
## Test set 0.9150588

The MAPE is lowest when using the ses simple method, and the lowest RMSE is with the optimal method, but it’s so close to the RMSE for the simple method that I’d probably just go with the simple method for the forecasts.