Results

9.1

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

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

Yes, there is no patterning and no correlations exceed .05.

9.1b 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?.

They are constructed from different sample sizes. The larger the sample, the more “white noise” the sample will be.

9.2

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

The plot of the time series shows a clear trend upward. The ACF shows an extreme level of autocorrelation. The PACF shows the extreme degree to which each observation is correlated with the previous one.

9.3

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

9.3a Turkish GDP from global_economy.

The boxcox transformation is not necessary to smooth the variance, but does make the curve more linear. One difference is all that is necessary to create a stationary series.

## # A tibble: 1 × 3
##   Country lb_stat lb_pvalue
##   <fct>     <dbl>     <dbl>
## 1 Turkey     5.84     0.829

9.3b Accommodation takings in the state of Tasmania from aus_accommodation.

Two differences are necessary - including a seasonal 4 month difference.

## # A tibble: 1 × 3
##   State    lb_stat lb_pvalue
##   <chr>      <dbl>     <dbl>
## 1 Tasmania    328.         0

## # A tibble: 1 × 3
##   State    lb_stat lb_pvalue
##   <chr>      <dbl>     <dbl>
## 1 Tasmania    28.8   0.00132

9.3c Monthly sales from souvenirs.

Again, two differences are needed, including a yearly lag.

## # A tibble: 1 × 2
##   lb_stat lb_pvalue
##     <dbl>     <dbl>
## 1    30.1  0.000828

## # A tibble: 1 × 2
##   lb_stat    lb_pvalue
##     <dbl>        <dbl>
## 1    53.7 0.0000000559

9.5

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

For my series we need at least 2 differences.Even after a seasonal (12 month) difference, there still apeeared to be patterning in the acf.

## [1] 1

## # A tibble: 1 × 2
##   lb_stat lb_pvalue
##     <dbl>     <dbl>
## 1    91.7  2.44e-15

## # A tibble: 1 × 2
##   lb_stat lb_pvalue
##     <dbl>     <dbl>
## 1    36.5 0.0000682

9.6

9.6 Simulate and plot some data from simple ARIMA models.

9.6b Produce a time plot for the series. How does the plot change?

The plot becomes denser with decreasing levels of phi.

9.6c Write your own code to generate data from an MA(1) model

y <- numeric(100)\ e <- rnorm(100)\ for(i in 2:100)\ y[i] <- e[i] + 0.6*e[i-1]\ sim2 <- tsibble(idx = seq_len(100), y = y, index = idx)\

9.6d Produce a time plot for the series. How does the plot change?

The plot becomes denser with decreasing levels of phi.

__*9.6e Generate data from an ARMA(1,1) model.__*

y <- numeric(100)\ e <- rnorm(100)\ for(i in 2:100)\ y[i] <- e[i] + .6e[i-1] + 0.6y[i-1]\ sim3 <- tsibble(idx = seq_len(100), y = y, index = idx)\

9.6f Generate data from an AR(2) model.

y <- numeric(100)\ e <- rnorm(100)\ for(i in 3:100)\ y[i] <- e[i] -.8y[i-1] + .3y[i-2]\ sim4 <- tsibble(idx = seq_len(100), y = y, index = idx)\

9.6g Graph the latter two series and compare them.

The graphs are very different. The first graph looks more like a typical, cycle-driven time series. The second looks like the poster child for heteroskedasticity. It would suggest a series that is inversely related to the previous period, but positively related to the 2nd one back.

9.7

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

9.7a 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.

ARIMA(0,2,1) was selected. The residuals look like white noise.

## Series: Passengers 
## Model: ARIMA(0,2,1) 
## 
## Coefficients:
##           ma1
##       -0.8963
## s.e.   0.0594
## 
## sigma^2 estimated as 4.308:  log likelihood=-97.02
## AIC=198.04   AICc=198.32   BIC=201.65

9.7b Write the model in terms of the backshift operator.

\[\begin{equation} \tag{9.2} \begin{array}{c c c c} (1-\phi_1B - \cdots - \phi_p B^p) & (1-B)^d y_{t} &= &c + (1 + \theta_1 B + \cdots + \theta_q B^q)\varepsilon_t\\ {\uparrow} & {\uparrow} & &{\uparrow}\\ \text{AR($p$)} & \text{$d$ differences} & & \text{MA($q$)}\\ \end{array} \end{equation}\]

9.7c Plot forecasts from an ARIMA(0,1,0) model with drift and compare these to part a.

Not surprisingly, the second model climbs at a lower rate.

## Series: Passengers 
## Model: ARIMA(0,1,0) w/ drift 
## 
## Coefficients:
##       constant
##         1.4191
## s.e.    0.3014
## 
## sigma^2 estimated as 4.271:  log likelihood=-98.16
## AIC=200.31   AICc=200.59   BIC=203.97

9.7d 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.

You can plot ARIMA(1,1,2) or ARIMA(2,1,1) but not ARIMA(2,1,2) - this just gives you null.If you try (1,1,2) and remove the constant, you again get a null model.

9.7e Plot forecasts from an ARIMA(0,2,1) model with a constant. What happens?

The ARIMA(0,2,1) model does not generate a constant. If we force one, the model is null.

## Series: Passengers 
## Model: ARIMA(0,2,1) 
## 
## Coefficients:
##           ma1
##       -0.8963
## s.e.   0.0594
## 
## sigma^2 estimated as 4.308:  log likelihood=-97.02
## AIC=198.04   AICc=198.32   BIC=201.65

## Series: Passengers 
## Model: ARIMA(0,2,1) 
## 
## Coefficients:
##           ma1
##       -0.8963
## s.e.   0.0594
## 
## sigma^2 estimated as 4.308:  log likelihood=-97.02
## AIC=198.04   AICc=198.32   BIC=201.65

9.8

9.8 For the United States GDP series (from global_economy):

a. if necessary, find a suitable Box-Cox transformation for the data.

There is no need for boxcox from a variance point of view, but the transformation might make the model more linear. Lambda is .282.

## [1] 0.2819443

b. fit a suitable ARIMA model to the transformed data using ARIMA();

The model r chooses is (0,2,2) (although the residuals show a large outlier for the GDP drop in 2007).

## Series: GDP 
## Model: ARIMA(0,2,2) 
## 
## Coefficients:
##           ma1      ma2
##       -0.4206  -0.3048
## s.e.   0.1197   0.1078
## 
## sigma^2 estimated as 2.615e+22:  log likelihood=-1524.08
## AIC=3054.15   AICc=3054.61   BIC=3060.23

c. try some other plausible models by experimenting with the orders chosen

  1. 1,2,2. This model has virtually the same AIC - the AR(1) does nothing to improve the model.
## Series: GDP 
## Model: ARIMA(1,2,2) 
## 
## Coefficients:
##          ar1      ma1      ma2
##       0.2053  -0.5912  -0.1928
## s.e.  0.3008   0.2886   0.2102
## 
## sigma^2 estimated as 2.646e+22:  log likelihood=-1523.86
## AIC=3055.72   AICc=3056.51   BIC=3063.82

  1. 0,1,2. This model has a higher AIC and the residuals are not centered at zero. The forecast does not account for the trend.
## Series: GDP 
## Model: ARIMA(0,1,2) 
## 
## Coefficients:
##          ma1     ma2
##       0.9553  0.6807
## s.e.  0.0894  0.1190
## 
## sigma^2 estimated as 5.067e+22:  log likelihood=-1570.65
## AIC=3147.29   AICc=3147.74   BIC=3153.42

d+e. choose what you think is the best model and check the residual diagnostics; produce forecasts of your fitted model. Do the forecasts look reasonable?

This was done above.

f. compare the results with what you would obtain using ETS() (with no transformation).

The residuals are white noise. The ETS model looks similar to the ARIMA model but with a larger confidence interval.

## Series: GDP 
## Model: ETS(M,M,N) 
##   Smoothing parameters:
##     alpha = 0.9998963 
##     beta  = 0.2671044 
## 
##   Initial states:
##         l[0]     b[0]
##  4.59552e+11 1.101027
## 
##   sigma^2:  6e-04
## 
##      AIC     AICc      BIC 
## 3185.757 3186.911 3196.060