set.seed(12345678)
<- aus_retail |>
myseries filter(`Series ID` == sample(aus_retail$`Series ID`,1))
Homework 7
Exponential Smoothing
Getting started
Start with the following steps:
Go to our RStudio Server at http://turing.cornellcollege.edu:8787/
Open the respective file from the shared STA364_inst_files folder mentioned above. It will be named something like hw-0X_LAST_NAME.qmd.
Then you need to save your copy. Click File -> Save as -> Navigate to the folder
STA364_Projects
(that we share) -> Change the “LAST_NAME part of the file name to your last name -> Save.Update the top of the document, called the
YAML,
with your name.
Exercises
Problems
Question 1 (fpp8_5)
The data set global_economy contains the annual Imports from many countries. Select the country you did in class.
Plot the Imports series and discuss the main features of the data.
Forecast the series using an ETS(A,N,N) model and plot the forecasts.
Compute the RMSE values for the training data.
Compare the results to those from an ETS(A,A,N) model. (Remember that the trended model is using one more parameter than the simpler model.) Discuss the merits of the two forecasting methods for this data set.
Compare the forecasts from both methods. Which do you think is best?
Calculate a 95% prediction interval for the first forecast for each model, using the RMSE values and assuming normal errors. Compare your intervals with those produced using R.
Question 2 (fpp8_6)
Forecast the Chinese GDP from the global_economy data set using an ETS model. Experiment with the options in the ETS() function to see how much the forecasts change with a damped trend or a Box-Cox transformation. Try to develop an intuition of what each is doing to the forecasts.
Use a relatively large value of h when forecasting so you can clearly see the differences between the various options when plotting the forecasts.
Question 3 (fpp8_8&9)
Recall your retail time series data:
Why is multiplicative seasonality necessary for this series?
Apply Holt-Winters’ multiplicative method to the data. Experiment with making the trend damped.
Compare the RMSE of the one-step forecasts from the two methods. Which do you prefer?
Check that the residuals from the best method look like white noise.
Now, find the test set RMSE while training the model until the end of 2010. Can you beat a seasonal naïve approach?
Try an STL decomposition applied to the Box-Cox transformed series, followed by ETS on the seasonally adjusted data. How does that compare with your best previous forecasts on the test set?
Question 4 (fpp8_10)
Compute the total domestic overnight trips across Australia from the tourism dataset.
Plot the data, but you do not need to describe the features (for time’s sake).
Decompose the series using STL and obtain the seasonally adjusted data.
Forecast the next two years of the series using an additive damped trend method applied to the seasonally adjusted data. (This can be specified using
decomposition_model()
.)Forecast the next two years of the series using an appropriate model for Holt’s linear method applied to the seasonally adjusted data (as before but without a damped trend).
Now, use ETS() to choose a seasonal model for the data.
Compare the RMSE of the ETS model’s RMSE with the models you obtained using STL decompositions. Which gives the better in-sample fits?
Question 5 (fpp8_11)
This exercise uses the quarterly number of arrivals to Australia from New Zealand, 1981 Q1 – 2012 Q3, from data set aus_arrivals.
Make a time plot of your data but you do not need to describe the features (for time’s sake).
Create a training set that withholds the last two years of available data. Forecast the test set using an appropriate model for Holt-Winters’ multiplicative method.
Why is multiplicative seasonality necessary here?
Forecast the two-year test set using each of the following methods:
- An ETS model.
- An additive ETS model applied to a log-transformed series.
- A seasonal naïve method.
- An STL decomposition applied to the log transformed data followed by an ETS model applied to the seasonally adjusted (transformed) data.
- Which method gives the best forecasts? Does it pass the residual tests?
Submission
When you are finished with your homework, be sure to Render the final document. Once rendered, you can download your file by:
- Finding the .html file in your File pane of RStudio (on the bottom right of the screen)
- Click the check box next to the file
- Click the blue gear above and then click “Export” to download
- Submit your final HTML document to the respective assignment on Moodle