## yt = 2yt-1 + wt ## so 2yt-1 = yt - wt ## and yt-1 = .5yt - .5wt. set.seed(184) alpha = .5 sigma = .5 par(mfrow=c(1,2)) n = 100 w = rnorm(n,mean=0,sd=sigma) x = rep(0,n) x[1] = w[1] for(i in 2:n) x[i] = alpha*x[i-1] + w[i] plot(1:n,x,type="l") y = rep(0,n) y[n] = w[1] for(i in 2:n) y[n+1-i] = alpha*y[n+2-i] - alpha * w[n+2-i] plot(1:n,y,type="l") ## Verify that yt = 2yt-1 + wt. y[1:3] w[1:3] 2*y[1]+w[2] 2*y[2]+w[3] ## For the periodogram, see the bottom of p172. library(astsa) x = soi n = length(x) P = Mod(2*fft(x)/n)^2; Fr = 0:(n-1)/n plot(Fr, P, type="o", xlab="frequency", ylab="scaled periodogram")