## 9.11 Exercises

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

- Explain the differences among these figures. Do they all indicate that the data are white noise?

- 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?

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.For the following series, find an appropriate Box-Cox transformation and order of differencing in order to obtain stationary data.

- Turkish GDP from
`global_economy`

. - Accommodation takings in the state of Tasmania from
`aus_accommodation`

. - Monthly sales from
`souvenirs`

.

- Turkish GDP from
For the

`souvenirs`

data, write down the differences you chose above using backshift operator notation.For your retail data (from Exercise 7 in Section 2.10), find the appropriate order of differencing (after transformation if necessary) to obtain stationary data.

Simulate and plot some data from simple ARIMA models.

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\).

Produce a time plot for the series. How does the plot change as you change \(\phi_1\)?

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

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

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

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.)

Graph the latter two series and compare them.

Consider

`aus_airpassengers`

, the total number of passengers (in millions) from Australian air carriers for the period 1970-2011.- 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. - Write the model in terms of the backshift operator.
- Plot forecasts from an ARIMA(0,1,0) model with drift and compare these to part a.
- 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.
- Plot forecasts from an ARIMA(0,2,1) model with a constant. What happens?

- Use
For the United States GDP series (from

`global_economy`

):- if necessary, find a suitable Box-Cox transformation for the data;
- fit a suitable ARIMA model to the transformed data using
`ARIMA()`

; - try some other plausible models by experimenting with the orders chosen;
- choose what you think is the best model and check the residual diagnostics;
- produce forecasts of your fitted model. Do the forecasts look reasonable?
- compare the results with what you would obtain using
`ETS()`

(with no transformation).

Consider

`aus_arrivals`

, the quarterly number of international visitors to Australia from several countries for the period 1981 Q1 – 2012 Q3.- Select one country and describe the time plot.
- Use differencing to obtain stationary data.
- What can you learn from the ACF graph of the differenced data?
- What can you learn from the PACF graph of the differenced data?
- What model do these graphs suggest?
- Does
`ARIMA()`

give the same model that you chose? If not, which model do you think is better? - Write the model in terms of the backshift operator, then without using the backshift operator.

Choose a series from

`us_employment`

, the total employment in different industries in the United States.- Produce an STL decomposition of the data and describe the trend and seasonality.
- Do the data need transforming? If so, find a suitable transformation.
- Are the data stationary? If not, find an appropriate differencing which yields stationary data.
- 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?
- 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.
- 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.
- 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?

Choose one of the following seasonal time series: the Australian production of electricity, cement, or gas (from

`aus_production`

).- Do the data need transforming? If so, find a suitable transformation.
- Are the data stationary? If not, find an appropriate differencing which yields stationary data.
- 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?
- 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.
- Forecast the next 24 months of data using your preferred model.
- Compare the forecasts obtained using
`ETS()`

.

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?

For the Australian tourism data (from

`tourism`

):- Fit ARIMA models for each time series.
- Produce forecasts of your fitted models.
- Check the forecasts for the “Snowy Mountains” and “Melbourne” regions. Do they look reasonable?

For your retail time series (Exercise 5 above):

- develop an appropriate seasonal ARIMA model;
- compare the forecasts with those you obtained in earlier chapters;
- 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?

Consider the number of Snowshoe Hare furs traded by the Hudson Bay Company between 1845 and 1935 (data set

`pelt`

).Produce a time plot of the time series.

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\))?

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

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).Now fit the model in R and obtain the forecasts using

`forecast()`

. How are they different from yours? Why?

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

`global_economy`

.Produce a time plot of the data.

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\))?

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

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).Now fit the model in R and obtain the forecasts from the same model. How are they different from yours? Why?

Before doing this exercise, you will need to install the

`Quandl`

package in R usingSelect a time series from Quandl. Then copy its short URL and import the data using

(Replace

`?????`

with the appropriate code.)Plot graphs of the data, and try to identify an appropriate ARIMA model.

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

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

Now try to identify an appropriate ETS model.

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

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

Which of the two models do you prefer?