Problem 1

1

set.seed(1118)
z <- rnorm(202, 0, 1)
ts.plot(z)

2

x <- c()
for(t in 2:201){
  x[t] <- (1/3)*(z[t-1]+z[t]+z[t+1])
}
ts.plot(z)
lines(x, lty = "dashed", col = "red")

\(X_{t}\) and \(Z_{t}\) have similar volatility, but the noise from Z is more volatile overall compared to X.

3

Compute (ACF) of \({X_{t}}:\)

\(\rho_{x}(h)=\frac{\gamma(h)}{\gamma(0)}=\frac{cov(X_{t+h},X_{t})}{var(X_{t})}\)

h=0: \(cov(X_{t}, X_{t})=\gamma_{x}(0)=\frac{1}{9}*3=\frac{1}{3} = var(X_{t})\)

h=1: \(\gamma_x(1) = \frac{1}{9}(1+1) = \frac{2}{9}\)

h=2: \(\gamma_x(2) = \frac{1}{9}(1) = \frac{1}{9}\)

Thus, \(\rho_{x}(0) = 1, \rho_{x}(1)=\frac{2/9}{1/3}=\frac{2}{3},\rho_{x}(2)=\frac{1/9}{1/3}=\frac{1}{3}\)

4

x <- x[-1]
var <- acf(x, lag.max = 20)
s <- seq(0:20)*0
s[1] = 1
s[2] = 2/3
s[3] = 1/3
lines(0:20, s, col ='red')

The sample ACF shows a confidence interval around 0 while the theoretical ACF has values of 1, 2/3, 1/3 at lags 1, 2, 3 respectively and then stays at 0 for the remaining lags.

Problem 2

1

set.seed(1118)
z2 <- rnorm(100, 0, 1)

x2 <- c()
for(t in 0:100){
  x2[t] <- z[t]-(1/2)*(z[t-1])+(1/4)*(z[t-2])
}
ts.plot(z2,col = "orange")
lines(x2, lty = "dashed", col = "blue")

2

x2 <- x2[-2]
x2 <- x2[-1]
var2 <- acf(x2, lag.max = 20)
s2 <- seq(0:20)*0
s2[1] = 1
s2[2] = 2/3
s2[3] = 1/3
lines(0:20, s2, col ='red')

3

Based on the diagram of the sample ACF, we can tell the order of the moving average process is the second order based on the spikes at the lags. We see a spike at lag 1 and a spike at 2 which tells us this is second order.

Problem 3

set.seed(1118)
n <- 100
z3 <- rnorm(n,0,1)
b1 = 0.5
b2 = -0.2
t = 1:100

rw1 <- b1*t + cumsum(z3)
rw2 <- b2*t + cumsum(z3)

rw1_line <- c()
rw2_line <- c()

for(t in 0:100){
  rw1_line[t] = b1*t
  rw2_line[t] = b2*t
}

b = 0.5

b = -0.2

The lines y=0.5t and y=-0.2t start and end at the same points as the random walks. The simple lines do not show all the randomness that goes on in the random walk process with drift.