## 9.11 Exercises

1. Figure 9.32 shows the ACFs for 36 random numbers, 360 random numbers and 1,000 random numbers.

1. Explain the differences among these figures. Do they all indicate that the data are white noise? Figure 9.32: Left: ACF for a white noise series of 36 numbers. Middle: ACF for a white noise series of 360 numbers. Right: ACF for a white noise series of 1,000 numbers.

1. Why are the critical values at different distances from the mean of zero? Why are the autocorrelations different in each figure when they each refer to white noise?
2. A classic example of a non-stationary series are stock prices. Plot the daily closing prices for Amazon stock (contained in gafa_stock), along with the ACF and PACF. Explain how each plot shows that the series is non-stationary and should be differenced.

3. For the following series, find an appropriate Box-Cox transformation and order of differencing in order to obtain stationary data.

1. Turkish GDP from global_economy.
2. Accommodation takings in the state of Tasmania from aus_accommodation.
3. Monthly sales from souvenirs.
4. For the souvenirs data, write down the differences you chose above using backshift operator notation.

5. For your retail data (from Exercise 8 in Section 2.10), find the appropriate order of differencing (after transformation if necessary) to obtain stationary data.

6. Simulate and plot some data from simple ARIMA models.

1. Use the following R code to generate data from an AR(1) model with $$\phi_{1} = 0.6$$ and $$\sigma^2=1$$. The process starts with $$y_1=0$$.

y <- numeric(100)
e <- rnorm(100)
for(i in 2:100)
y[i] <- 0.6*y[i-1] + e[i]
sim <- tsibble(idx = seq_len(100), y = y, index = idx)
2. Produce a time plot for the series. How does the plot change as you change $$\phi_1$$?

3. Write your own code to generate data from an MA(1) model with $$\theta_{1} = 0.6$$ and $$\sigma^2=1$$.

4. Produce a time plot for the series. How does the plot change as you change $$\theta_1$$?

5. Generate data from an ARMA(1,1) model with $$\phi_{1} = 0.6$$, $$\theta_{1} = 0.6$$ and $$\sigma^2=1$$.

6. Generate data from an AR(2) model with $$\phi_{1} =-0.8$$, $$\phi_{2} = 0.3$$ and $$\sigma^2=1$$. (Note that these parameters will give a non-stationary series.)

7. Graph the latter two series and compare them.

7. Consider aus_airpassengers, the total number of passengers (in millions) from Australian air carriers for the period 1970-2011.

1. Use ARIMA() to find an appropriate ARIMA model. What model was selected. Check that the residuals look like white noise. Plot forecasts for the next 10 periods.
2. Write the model in terms of the backshift operator.
3. Plot forecasts from an ARIMA(0,1,0) model with drift and compare these to part a.
4. Plot forecasts from an ARIMA(2,1,2) model with drift and compare these to parts a and c. Remove the constant and see what happens.
5. Plot forecasts from an ARIMA(0,2,1) model with a constant. What happens?
8. For the United States GDP series (from global_economy):

1. if necessary, find a suitable Box-Cox transformation for the data;
2. fit a suitable ARIMA model to the transformed data using ARIMA();
3. try some other plausible models by experimenting with the orders chosen;
4. choose what you think is the best model and check the residual diagnostics;
5. produce forecasts of your fitted model. Do the forecasts look reasonable?
6. compare the results with what you would obtain using ETS() (with no transformation).
9. Consider aus_arrivals, the quarterly number of international visitors to Australia from several countries for the period 1981 Q1 – 2012 Q3.

1. Select one country and describe the time plot.
2. Use differencing to obtain stationary data.
3. What can you learn from the ACF graph of the differenced data?
4. What can you learn from the PACF graph of the differenced data?
5. What model do these graphs suggest?
6. Does ARIMA() give the same model that you chose? If not, which model do you think is better?
7. Write the model in terms of the backshift operator, then without using the backshift operator.
10. Choose a series from us_employment, the total employment in different industries in the United States.

1. Produce an STL decomposition of the data and describe the trend and seasonality.
2. Do the data need transforming? If so, find a suitable transformation.
3. Are the data stationary? If not, find an appropriate differencing which yields stationary data.
4. Identify a couple of ARIMA models that might be useful in describing the time series. Which of your models is the best according to their AICc values?
5. Estimate the parameters of your best model and do diagnostic testing on the residuals. Do the residuals resemble white noise? If not, try to find another ARIMA model which fits better.
6. Forecast the next 3 years of data. Get the latest figures from https://fred.stlouisfed.org/categories/11 to check the accuracy of your forecasts.
7. Eventually, the prediction intervals are so wide that the forecasts are not particularly useful. How many years of forecasts do you think are sufficiently accurate to be usable?
11. Choose one of the following seasonal time series: the Australian production of electricity, cement, or gas (from aus_production).

1. Do the data need transforming? If so, find a suitable transformation.
2. Are the data stationary? If not, find an appropriate differencing which yields stationary data.
3. Identify a couple of ARIMA models that might be useful in describing the time series. Which of your models is the best according to their AIC values?
4. Estimate the parameters of your best model and do diagnostic testing on the residuals. Do the residuals resemble white noise? If not, try to find another ARIMA model which fits better.
5. Forecast the next 24 months of data using your preferred model.
6. Compare the forecasts obtained using ETS().
12. For the same time series you used in the previous exercise, try using a non-seasonal model applied to the seasonally adjusted data obtained from STL. Compare the forecasts with those obtained in the previous exercise. Which do you think is the best approach?

13. For the Australian tourism data (from tourism):

1. Fit ARIMA models for each time series.
2. Produce forecasts of your fitted models.
3. Check the forecasts for the “Snowy Mountains” and “Melbourne” regions. Do they look reasonable?
14. For your retail time series (Exercise 5 above):

1. develop an appropriate seasonal ARIMA model;
2. compare the forecasts with those you obtained in earlier chapters;
3. Obtain up-to-date retail data from the ABS website (Cat 8501.0, Table 11), and compare your forecasts with the actual numbers. How good were the forecasts from the various models?
15. Consider the number of Snowshoe Hare furs traded by the Hudson Bay Company between 1845 and 1935 (data set pelt).

1. Produce a time plot of the time series.

2. Assume you decide to fit the following model: $y_t = c + \phi_1 y_{t-1} + \phi_2 y_{t-2} + \phi_3 y_{t-3} + \phi_4 y_{t-4} + \varepsilon_t,$ where $$\varepsilon_t$$ is a white noise series. What sort of ARIMA model is this (i.e., what are $$p$$, $$d$$, and $$q$$)?

3. By examining the ACF and PACF of the data, explain why this model is appropriate.

4. The last five values of the series are given below:

Year

1931

1932

1933

1934

1935

Number of hare pelts

19520

82110

89760

81660

15760

The estimated parameters are $$c = 30993$$, $$\phi_1 = 0.82$$, $$\phi_2 = -0.29$$, $$\phi_3 = -0.01$$, and $$\phi_4 = -0.22$$. Without using the forecast() function, calculate forecasts for the next three years (1936–1939).

5. Now fit the model in R and obtain the forecasts using forecast(). How are they different from yours? Why?

16. The population of Switzerland from 1960 to 2017 is in data set global_economy.

1. Produce a time plot of the data.

2. You decide to fit the following model to the series: $y_t = c + y_{t-1} + \phi_1 (y_{t-1} - y_{t-2}) + \phi_2 (y_{t-2} - y_{t-3}) + \phi_3( y_{t-3} - y_{t-4}) + \varepsilon_t$ where $$y_t$$ is the Population in year $$t$$ and $$\varepsilon_t$$ is a white noise series. What sort of ARIMA model is this (i.e., what are $$p$$, $$d$$, and $$q$$)?

3. Explain why this model was chosen using the ACF and PACF of the differenced series.

4. The last five values of the series are given below.

Year

2013

2014

2015

2016

2017

Population (millions)

8.09

8.19

8.28

8.37

8.47

The estimated parameters are $$c = 0.0053$$, $$\phi_1 = 1.64$$, $$\phi_2 = -1.17$$, and $$\phi_3 = 0.45$$. Without using the forecast() function, calculate forecasts for the next three years (2018–2020).

5. Now fit the model in R and obtain the forecasts from the same model. How are they different from yours? Why?

1. Before doing this exercise, you will need to install the Quandl package in R using

install.packages("Quandl")
1. Select a time series from Quandl. Then copy its short URL and import the data using

y <- as_tsibble(Quandl::Quandl("?????"), index = Date)

(Replace ????? with the appropriate code.)

2. Plot graphs of the data, and try to identify an appropriate ARIMA model.

3. Do residual diagnostic checking of your ARIMA model. Are the residuals white noise?

4. Use your chosen ARIMA model to forecast the next four years.

5. Now try to identify an appropriate ETS model.

6. Do residual diagnostic checking of your ETS model. Are the residuals white noise?

7. Use your chosen ETS model to forecast the next four years.

8. Which of the two models do you prefer?