Question 8.1

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

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. Explain the differences among these figures. Do they all indicate that the data are white noise?

The ACF bands become narrower as the number of numbers increase. There is no discernable pattern in the bars of the ACF charts and the bars are within the bands, which indicates the data are white noise.

  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?

It’s related to the law of large numbers. As the number of observations increase, the number of large outliers from the mean decreases. We are more certain that a large observation is really an outlier with more data.

Question 8.2

A classic example of a non-stationary series is the daily closing IBM stock price series (data set 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.

Time series with trends or with seasonality are not stationary. It is clear from the top plot that there is a trend in IBM’s stock price. The ACF will drop to zero quickly for a stationary time series. This ACF does not have that property. The gradual decrease is a tell that it is not stationary. The first PACF is almost one which is another sign that the data is not stationary.

Question 8.3

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

  1. usnetelec

The trend looks nearly linear. It will probably only need to be differenced to be stationary. I will use the ndiffs function to determine the order of differencing.*

It needed to be differenced by 1, or a first order difference. Now to check if the data is stationary.

Data IS Stationary

The p-value of 0.36 indicates the data are stationary.

  1. usgdp

Since this series is dollars we probably need to log transform it. It also looks like it needs to be differenced.

The Box Cox transformation with a lambda of 0.37 and a differencing of 1.

Data IS Stationary
  1. mcopper

This has the spike in copper prices that happened late in the the 2000’s.

The Box Cox transformation with a lambda of 0.19 and a differencing of 1.

Data IS Stationary
  1. enplanements

The variance is not constant so this series needs a Box-Cox transformation and differencing to be stationary.

The Box Cox transformation with a lambda of -0.23 and a differencing of 1 (1st order).

Data IS Stationary
  1. visitors

This series also exhibits an increasing variance and trend so Box-Cox and differencing will be needed.

The Box Cox transformation had a lambda of 0.28 and a differencing of 1 (1st order).

Data IS Stationary

Question 8.5

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.

The data is differenced with a first order difference and adjusted with a Box Cox transformation with a lambda of 0.13. The result:

Data IS Stationary

Question 8.6

Use R to simulate and plot some data from simple ARIMA models.

  1. Use the following R code to generate data from an AR(1) model with \(ϕ_1 = 0.6\) and \(σ_2 = 1\). The process starts with \(y_1=0\).
  1. Produce a time plot for the series. How does the plot change as you change \(ϕ_1\)?

In order to see the effects of a change in \(ϕ_1\) we will need to modify the code a little bit:

Now with a fixed random number seed we can see the effect. As \(ϕ_1\) increases, the distance from zero increases. It increases the autocorrelation with the preceeding value.

  1. Write your own code to generate data from an MA(1) model with \(θ_1=0.6\) and \(σ_2=1\).
  1. Produce a time plot for the series. How does the plot change as you change \(θ_1\)?

This is a bit harder to see but as \(ϕ_1\) increases, the distance from zero again increases. The \(θ_1\) deals with the error so it is not as pronounced as a change in \(ϕ_1\) though.

  1. Generate data from an ARMA(1,1) model with \(ϕ_1=0.6\), \(θ_1=0.6\) and \(σ_2=1\).
  1. Generate data from an AR(2) model with \(ϕ_1=−0.8\), \(ϕ_2=0.3\) and \(σ_2=1\). (Note that these parameters will give a non-stationary series.)
  1. Graph the latter two series and compare them.

Question 8.7

Consider wmurders, the number of women murdered each year (per 100,000 standard population) in the United States.

  1. By studying appropriate graphs of the series in R, find an appropriate ARIMA(p,d,q) model for these data.

The trends (both up and down) suggest that the series should be differenced before moving forward. ndiffs estimates that 2 differened are required to make this time series stationary.

The first lag of the PACF is the only spike which indicates the value of p in the ARIMA model should be 1. The high first value in the ACF indicates that the d is also one.

  1. Should you include a constant in the model? Explain.

No. Based on the blog post by the text book author, since the differencing term (d) is 2 if c = 0 the eventual forecast function (EFF) will follow a straight line with intercept and slope determined by the last few observations. If c != 0 then the EFF will follow a quadratic trend. Opting for the simplier model We should not include it in the model.

  1. Write this model in terms of the backshift operator.

\((1-\phi_1B) (1-B)^2y_t = c + (1 + \theta_1B)e_t\)

  1. Fit the model using R and examine the residuals. Is the model satisfactory?


    Ljung-Box test

data:  Residuals from ARIMA(1,2,1)
Q* = 12.419, df = 8, p-value = 0.1335

Model df: 2.   Total lags used: 10

The ACF show all autocorrelations are withing acceptable limits, indicating residuals are white noise. The p-value of the Ljung-Box test also indicate the residuals are white noise.

  1. Forecast three times ahead. Check your forecasts by hand to make sure that you know how they have been calculated.
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
2005 2.470660 2.200091 2.741229 2.056861 2.884459
2006 2.363106 1.993529 2.732684 1.797886 2.928327
2007 2.252833 1.774677 2.730989 1.521557 2.984110
  1. Create a plot of the series with forecasts and prediction intervals for the next three periods shown.

  1. Does auto.arima() give the same model you have chosen? If not, which model do you think is better?
Series: wmurders 
ARIMA(1,2,1) 

Coefficients:
          ar1      ma1
      -0.2434  -0.8261
s.e.   0.1553   0.1143

sigma^2 estimated as 0.04632:  log likelihood=6.44
AIC=-6.88   AICc=-6.39   BIC=-0.97

Yes auto.arima() gives the same model that I have chosen.