7.1 Consider the pigs series — the number of pigs slaughtered in Victoria each month.

A. Use the ses() function in R to find the optimal values of \(\alpha\) and \(\ell_0\), and generate forecasts for the next four months.

## Simple exponential smoothing 
## 
## Call:
##  ses(y = pigs, h = 4) 
## 
##   Smoothing parameters:
##     alpha = 0.2971 
## 
##   Initial states:
##     l = 77260.0561 
## 
##   sigma:  10308.58
## 
##      AIC     AICc      BIC 
## 4462.955 4463.086 4472.665
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Sep 1995       98816.41 85605.43 112027.4 78611.97 119020.8
## Oct 1995       98816.41 85034.52 112598.3 77738.83 119894.0
## Nov 1995       98816.41 84486.34 113146.5 76900.46 120732.4
## Dec 1995       98816.41 83958.37 113674.4 76092.99 121539.8

B. Compute a 95% prediction interval for the first forecast using \(\hat{y} \pm 1.96s\) where s is the standard deviation of the residuals. Compare your interval with the interval produced by R

## [1] "Lower Confidence Interval: 78679.97"
## [1] "Upper Confidence Interval: 118952.84"

7.5 Data set books contains the daily sales of paperback and hardcover books at the same store. The task is to forecast the next four days’ sales for paperback and hardcover books.

## Time Series:
## Start = 1 
## End = 30 
## Frequency = 1 
##    Paperback Hardcover
##  1       199       139
##  2       172       128
##  3       111       172
##  4       209       139
##  5       161       191
##  6       119       168
##  7       195       170
##  8       195       145
##  9       131       184
## 10       183       135
## 11       143       218
## 12       141       198
## 13       168       230
## 14       201       222
## 15       155       206
## 16       243       240
## 17       225       189
## 18       167       222
## 19       237       158
## 20       202       178
## 21       186       217
## 22       176       261
## 23       232       238
## 24       195       240
## 25       190       214
## 26       182       200
## 27       222       201
## 28       217       283
## 29       188       220
## 30       247       259

A. Plot the series and discuss the main features of the data.

B. Use the ses() function to forecast each series, and plot the forecasts.

##    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## 31       207.1097 162.4882 251.7311 138.8670 275.3523
## 32       207.1097 161.8589 252.3604 137.9046 276.3147
## 33       207.1097 161.2382 252.9811 136.9554 277.2639
## 34       207.1097 160.6259 253.5935 136.0188 278.2005

C. Compute the RMSE values for the training data in each case.

## [1] "RMSE values Paperback: 33.64"
## [1] "RMSE values Hardcover: 31.93"

7.6 We will continue with the daily sales of paperback and hardcover books in data set books.

B. Compare the RMSE measures of Holt’s method for the two series to those of simple exponential smoothing in the previous question. (Remember that Holt’s method is using one more parameter than SES.) Discuss the merits of the two forecasting methods for these data sets.

## [1] "Holt’s method, RMSE values Paperback: 31.14"
## [1] "Holt’s method, RMSE values Hardcover: 27.19"

Holt’s method is using one more parameter than SES which improves the RMSE value

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

Comparing both models, holt is the best model in terms of RMSE values.

D. Calculate a 95% prediction interval for the first forecast for each series, using the RMSE values and assuming normal errors. Compare your intervals with those produced using ses and holt.

PAPERBACK

## [1] "SES, Lower Confidence Interval: 141.6"
## [1] "SES, Upper Confidence Interval: 272.62"
## [1] "SES, Lower Confidence Interval from formula: 138.87"
## [1] "SES, Upper Confidence Interval from formula: 275.35"
## [1] "Holt, Lower Confidence Interval: 147.84"
## [1] "Holt, Upper Confidence Interval: 271.09"
## [1] "Holt, Lower Confidence Interval from formula: 143.91"
## [1] "Holt, Upper Confidence Interval from formula: 275.02"

Lower and Upper intervals in paperback for both the time series using ses and holt methods are comparitively similar.

HARDCOVER

## [1] "SES, Lower Confidence Interval: 178.58"
## [1] "SES, Upper Confidence Interval: 300.54"
## [1] "SES, Lower Confidence Interval from formula: 174.78"
## [1] "SES, Upper Confidence Interval from formula: 304.34"
## [1] "Holt, Lower Confidence Interval: 195.96"
## [1] "Holt, Upper Confidence Interval: 304.38"
## [1] "Holt, Lower Confidence Interval from formula: 192.92"
## [1] "Holt, Upper Confidence Interval from formula: 307.43"

Upper Confidence interval in Hardcover seems similar in both method SES and Holt. However, there is differece in lower confidence interval.

7.7 For this exercise use data set eggs, the price of a dozen eggs in the United States from 1900–1993. Experiment with the various options in the holt() function to see how much the forecasts change with damped trend, or with a Box-Cox transformation. Try to develop an intuition of what each argument is doing to the forecasts.

[Hint: use h=100 when calling holt() so you can clearly see the differences between the various options when plotting the forecasts.]

Which model gives the best RMSE?

## [1] "RMSE - Holt                : 26.58"
## [1] "RMSE - Holt damped         : 26.54"
## [1] "RMSE - Holt box-cox        : 26.39"
## [1] "RMSE - Holt damped box-cox : 26.53"

Comparing the accuracy of all four method reveals that the RMSE was almost similar, but the best method when compared to other methods is Holt’s Method with Box-Cox transformation since RMSE is lowest

7.8 Recall your retail time series data (from Exercise 3 in Section 2.10).

A. Why is multiplicative seasonality necessary for this series?

It is clear from the graph that seasonality variations are changing with increase in time. In that case, multiplicative seasonality is necessary.

C. Compare the RMSE of the one-step forecasts from the two methods. Which do you prefer?

## [1] "RMSE - Holt         : 25.2"
## [1] "RMSE - Holt damped  : 25.1"

Since RMSE is 0.1 lower for damped method campare to Holt method, it is the best method.

D. Check that the residuals from the best method look like white noise.

## 
##  Ljung-Box test
## 
## data:  Residuals from Damped Holt-Winters' multiplicative method
## Q* = 285.62, df = 7, p-value < 2.2e-16
## 
## Model df: 17.   Total lags used: 24

It doesnot seem any white Noise

E. Now find the test set RMSE, while training the model to the end of 2010. Can you beat the seasonal naïve approach from Exercise 8 in Section 3.7?

## [1] "1. RMSE - Holt damped  : "
## Training set     Test set 
##     25.68057     41.08034
## [1] "2. RMSE - naïve approach  : "
## Training set     Test set 
##     72.20702    145.46662

RMSE in Holt damped method is lower compare to snaive method. Hence, the Holt-Winter’s Multiplicative Damped method outperformed seasonal naive forecast.