# R source code for generating data from AR(1) processes. #set the seed so we all have the same time series set.seed(1) # AR(1) series with phi = 0.1 y.10 <- arima.sim(model=list(ar=0.1), n=100) # AR(1) series with phi= 0.5 y.50 <- arima.sim(model=list(ar=0.5), n=100) # AR(1) series with phi= -0.5 y.m50 <- arima.sim(model=list(ar=-0.5), n=100) # AR(1) series with phi= 0.9 y.90 <- arima.sim(model=list(ar=.9), n=100) # set up for a 2x2 matrix of graphs par(mfrow=c(2,2)) plot(y.10) title("phi=0.1, Stationary AR(1) process") abline(h=0) plot(y.50) title("phi = 0.5, Stationary AR(1) process") abline(h=0) plot(y.m50) title("phi = -0.5, Stationary AR(1) process") abline(h=0) plot(y.90) title("phi = 0.9, Stationary AR(1) process") abline(h=0)