# PROBLEM 4
# For the AR(2) models given by X_t = 0.25X_t−2 + W_t and X_t = −0.9X_t−2 + W_t plot their ACFs.
par(mfrow = c( 1, 2))
# Given AR(2) Model : X_t = 0.25X_t−2 + W_t
p1 = ARMAacf(ar = c(0, 0.25), lag.max = 20 )
plot( 0:20, p1, main = "Model : X_t = 0.25X_t−2 + W_t", type = "h", xlab = "LAG", ylab = "ACF" )
lines(p1[-1], type="h", col=2)
points( 0:20, p1 )
abline( h = 0 )
# Red lines show the significant lags for the given AR(2) model
# Given AR(2) Model : X_t = -0.9X_t−2 + W_t
p2 = ARMAacf(ar = c(0, -0.9), lag.max = 20)
plot( 0:20, p2, main = "Model : X_t = -0.9X_t−2 + W_t",type = "h", xlab = "LAG", ylab = "ACF")
lines(p2[-1], type = "h", col = 2)
points( 0:20, p2)
abline( h = 0 )

# Red lines show the significant lags for the given AR(2) model