n <- 1500
e <- rnorm (n, sd=2.25^2) # Example 8.2.1 from Brockwell and Davies (1991)
x <- double (n)
x[1] <- 0
x[2] <- 0
for (i in 3:n)
{
x[i] <- 0.5*x[i-1]+0.2*x[i-2]+e[i]
}
x <- window(ts(x),start=501)
plot (x)
acf (x, 40, type="o", ylim=range(-1,1))
pacf (x, 40, type="o", ylim=range(-1,1))
Run the code above in your browser using DataLab