## 9.11 Exercises

Figure 9.31 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 is the daily closing IBM stock price series (data set

`fma::ibmclose`

). Use R to plot the daily closing prices for IBM stock and 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.

`expsmooth::usnetelec`

- United states GDP from
`global_economy`

`expsmooth::mcopper`

`expsmooth::enplanements`

`expsmooth::visitors`

For the

`expsmooth::enplanements`

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

Use R to 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

`fpp2::wmurders`

, the number of women murdered each year (per 100,000 standard population) in the United States.- By studying appropriate graphs of the series in R, find an appropriate ARIMA(\(p,d,q\)) model for these data.
- Should you include a constant in the model? Explain.
- Write this model in terms of the backshift operator.
- Fit the model using R and examine the residuals. Is the model satisfactory?
- Forecast three times ahead. Check your forecasts by hand to make sure that you know how they have been calculated.
- Create a plot of the series with forecasts and prediction intervals for the next three periods shown.
- Does
`ARIMA()`

give the same model you have chosen? If not, which model do you think is better?

Consider

`fpp2::austa`

, the total international visitors to Australia (in millions) for the period 1980-2015.- 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. - Plot forecasts from an ARIMA(0,1,1) model with no drift and compare these to part a. Remove the MA term and plot again.
- Plot forecasts from an ARIMA(2,1,3) model with drift. Remove the constant and see what happens.
- Plot forecasts from an ARIMA(0,0,1) model with a constant. Remove the MA term and plot again.
- Plot forecasts from an ARIMA(0,2,1) model with no constant.

- 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

`fpp2::austourists`

, the quarterly number of international tourists to Australia for the period 1999–2010.- Describe the time plot.
- What can you learn from the ACF graph?
- What can you learn from the PACF graph?
- Produce plots of the seasonally differenced data \((1 - B^{4})Y_{t}\). 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.

Consider

`fpp2::usmelec`

, the total net generation of electricity (in billion kilowatt hours) by the U.S. electric industry (monthly for the period January 1973 – June 2013). In general there are two peaks per year: in mid-summer and mid-winter.- Examine the 12-month moving average of this series to see what kind of trend is involved.
- 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 15 years of electricity generation by the U.S. electric industry. Get the latest figures from the EIA 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?

For the

`expsmooth::mcopper`

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

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

`fma::sheep`

, the sheep population of England and Wales from 1867–1939.Produce a time plot of the time series.

Assume you decide to fit the following model: \[ y_t = 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 \(\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 differenced data, explain why this model is appropriate.

The last five values of the series are given below:

Year 1935 1936 1937 1938 1939 Millions of sheep 1648 1665 1627 1791 1797 The estimated parameters are \(\phi_1 = 0.42\), \(\phi_2 = -0.20\), and \(\phi_3 = -0.30\). Without using the

`forecast`

function, calculate forecasts for the next three years (1940–1942).Now fit the model in R and obtain the forecasts using

`forecast`

. How are they different from yours? Why?

The annual bituminous coal production in the United States from 1920 to 1968 is in data set

`fma::bicoal`

.Produce a time plot of the data.

You decide to fit the following model to the series: \[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 \(y_t\) is the coal production 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.

The last five values of the series are given below.

Year 1964 1965 1966 1967 1968 Millions of tons 467 512 534 552 545 The estimated parameters are \(c = 162.00\), \(\phi_1 = 0.83\), \(\phi_2 = -0.34\), \(\phi_3 = 0.55\), and \(\phi_4 = -0.38\). Without using the

`forecast`

function, calculate forecasts for the next three years (1969–1971).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 each

`?????`

with the appropriate values.)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?