## 4.4 Exercises

Calculate the residuals from a seasonal naïve forecast applied to the quarterly Australian beer production data from 1992. The following code will help.

`# Extract data of interest recent_production <- aus_production %>% filter(year(Quarter) >= 1992) # Define and estimate a model fit <- recent_production %>% model(SNAIVE(Beer)) # Look at the residuals aug <- augment(fit) aug %>% autoplot(.resid) # Look a some forecasts fc <- fit %>% forecast() fc %>% autoplot(recent_production)`

Test if the residuals are white noise and normally distributed.

What do you conclude?

Repeat the exercise for the Australian Exports series from

`global_economy`

and the Bricks series from`aus_production`

. Use whichever of`NAIVE()`

or`SNAIVE()`

is more appropriate in each case.Are the following statements true or false? Explain your answer.

- Good forecast methods should have normally distributed residuals.
- A model with small residuals will give good forecasts.
- The best measure of forecast accuracy is MAPE.
- If your model doesn’t forecast well, you should make it more complicated.
- Always choose the model with the best forecast accuracy as measured on the test set.

For your retail time series (from Exercise 3 in Section 2.10):

Create a training dataset consisting of observations before 2011 using

Check that your data have been split appropriately by producing the following plot.

Calculate seasonal naïve forecasts using

`SNAIVE()`

applied to your training data (`myts_train`

).Compare the accuracy of your forecasts against the actual values.

Check the residuals.

Do the residuals appear to be uncorrelated and normally distributed?

How sensitive are the accuracy measures to the amount of training data used?

`tourism`

contains quarterly visitor nights (in thousands) from 1998 to 2017 for 76 regions of Australia.Extract data from the Gold Coast region using

`filter()`

and aggregate total overnight trips (sum over`Purpose`

) using`summarise()`

. Call this new dataset`gc_tourism`

.Using

`slice()`

or`filter()`

, create three training sets for this data excluding the last 1, 2 and 3 years. For example,`gc_train_1 <- gc_tourism %>% slice(1:(n()-4))`

.Compute one year of forecasts for each training set using the seasonal naïve (

`SNAIVE()`

) method. Call these`gc_fc_1`

,`gc_fc_2`

and`gc_fc_3`

, respectively.Use

`accuracy()`

to compare the test set forecast accuracy using MAPE. Comment on these.

Consider the number of pigs slaughted in New South Wales (data set

`aus_livestock`

).- Produce some plots of the data in order to become familiar with it.
- Create a training set of 486 observations, witholding a test set of 72 observations (6 years).
- Try using various benchmark methods to forecast the training set and compare the results on the test set. Which method did best?
- Check the residuals of your preferred method. Do they resemble white noise?

Consider the sales of new one-family houses in the USA, Jan 1973 – Nov 1995 (data set

`fma::hsales`

).- Convert the data to a tsibble using
`as_tsibble()`

.` - Produce some plots of the data in order to become familiar with it.
- Create a training set by witholding the last two years of data.
- Try using various benchmark methods to forecast the training set and compare the results on the test set. Which method did best?
- Check the residuals of your preferred method. Do they resemble white noise?

- Convert the data to a tsibble using