Problems: 3.3, 3.5 3.10

1.

By results proven in class we have that \[\rho(h) = \frac{\gamma(h)}{\gamma(0)}\] and this \[\rho(1) = \frac{\gamma(1)}{\gamma(0)}\] Moreover we have that \(\gamma(1) = \theta\) and \(\gamma(0) = 1 + \theta^2\) and so we have \[\rho(1) = \frac{\theta}{1 + \theta^2}\] and so clearly for any value \(\theta\) \(|\rho(1)| \leq .5\)

To show the max/min we will take the derivative and set equal to zero.

\[\frac{\partial}{\partial \theta} \rho(1) = \frac{1 - \theta^2}{(1 + \theta^2)^2} = 0\] \[\therefore \;\; \theta = \{-1, 1\}\] Specifically max is achieved at \(\theta = 1\) and min is achieved at \(\theta = -1\)

theta_func <- function(t) {
  t/(1 + t^2)
}
x <- seq(-2, 2, by = .1)
plot(x, theta_func(x), type = "l", xlab = "Theta Value", ylab = "ACF(1)")
points(-1, theta_func(-1), col = "red")
points(1, theta_func(1), col = "blue")

5.

To show let’s first assume that \[\phi_1 + \phi_2 < 1, \;\; \phi_2 - \phi_1 < 1, \;\; and \;\; |\phi_2| < 1\] We show that the AR(2) is causal under these assumptions.

We have that AR(2): \[(1-\phi B - \phi_2 B^2)x_t = w_t\] From which we get that \(\phi(z) = 1 - \phi_1 z + \phi_2 z^2\) In order for the process to be causal we need the roots for \(\phi(z)\) to be outside the unit circle. Using the quadratic formula: \[\left| \frac{\phi_1 \pm \sqrt{\phi_1^2 + 4\phi_2}}{-2\phi_2} \right| > 1 \] We rewrite as

\[\left| \frac{\phi_1}{-2\phi_2} \pm \sqrt{\phi_1^2 + 4\phi_2} \right| > 1 \] For easier examination, at this point it

8.

h <- 1:50

arma_11 <- function(theta, phi, h) {
  ((1 + theta * phi)*(theta + phi))/(1 + 2*theta*phi + theta^2) * phi^(h-1)
}

ar_1 <- function(theta, h) {
  theta^h
}

ma_1 <- function(theta, h) {
  theta/(1 + theta^2)
}

par(mfrow = c(3,1))

plot(h, arma_11(.9, .6, h), type = "l")
plot(h, ar_1(.9, h), type = "l")
plot(h[2:length(h)], ar_1(.9, h[2:length(h)]), type = "l")

From the above we can see that the ARMA(1,1) model has its ACF decaying a lot faster then the other two.

9.

Simulation

ar_sim <-arima.sim(list(order=c(1,0,0),ar=.6),n=100)
ma_sim<-arima.sim(list(order=c(0,0,1),ma=.9),n=100)
ARMA <-arima.sim(list(order=c(1,0,1),ar=.6,ma=.9),n=100)

#plots 
par(mfcol=c(1,2))
acf(ar_sim)
pacf(ar_sim)

par(mfcol=c(1,2))
acf(ma_sim)
pacf(ma_sim)

par(mfcol=c(1,2))
acf(ARMA)
pacf(ARMA)

10.

par(mfrow = c(1,1))
library(astsa)
library(forecast)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: timeDate
## This is forecast 7.1
## 
## Attaching package: 'forecast'
## The following object is masked from 'package:astsa':
## 
##     gas
# the way used in the book
model_fit <- ar.ols(cmort)

# we can check some fit performance 
acf(model_fit$resid, na.action = na.pass)

pacf(model_fit$resid, na.action = na.pass)

# to forecast the four period in the future
forecast_preds <- forecast.ar(model_fit, h = 4)
plot(forecast_preds)

forecast_preds
##          Point Forecast    Lo 80    Hi 80    Lo 95     Hi 95
## 1979.769       87.59986 80.31444 94.88529 76.45777  98.74196
## 1979.788       86.76349 78.83713 94.68985 74.64117  98.88581
## 1979.808       87.33714 78.19426 96.48002 73.35431 101.31997
## 1979.827       87.21350 77.48222 96.94478 72.33079 102.09621

From the final output above we can see the prediction intervals at a 95% Confidence Level.