set.seed(123) ar1<-arima.sim(model=list(ar=c(0.9)), n=200) ar1 set.seed(123) x1<-w<-rnorm(200) x1 w for(t in 2:200) x1[t]=0.9*x1[t-1]+w[t] x1.ts<-ts(x1) x1.ts par(mfrow=c(3,2)) plot(ar1[1:142], type="l", main="AR(1)") plot(x1.ts[59:200], type="l", main="AR(1)") acf(ar1, main="Yt = 0.9Yt-1+wt") acf(x1.ts, main="Yt = 0.9Yt-1+wt") pacf(ar1, main="Yt = 0.9Yt-1+wt") pacf(x1.ts, main="Yt = 0.9Yt-1+wt")