# In this program we are going to use the function "ts.sim" to simulate 200 observations of # some simple ARMA models, plot them and then plot their sample ACF's and sample PACF's. # Note that, due to sampling variation, the sample ACF's and sample PACF's will not exactly # coincide with their theoretical (population) ACF's and PACF's even though this would be # the case as the sample size goes to infinity. Again, you can adjust this program slightly # by choosing different ar and ma parameter values as long as they satisfy the stationary and # invertibility conditions. # Here we simulate an AR(1) model with ar1 = 0.7 ts.sim.1<-arima.sim(list(order=c(1,0,1), ar=0.7, ma=0.0), n=200) ts.plot(ts.sim.1) windows() par(mfrow=c(1,2)) acf(ts.sim.1) pacf(ts.sim.1) # Here we simulate a MA(1) model with ma1 = 0.6 ts.sim.2<-arima.sim(list(order=c(1,0,1), ar=0.0, ma=0.6), n=200) windows() par(mfrow=c(1,1)) ts.plot(ts.sim.2) windows() par(mfrow=c(1,2)) acf(ts.sim.2) pacf(ts.sim.2) # Here we simulate an ARMA(1,1) model with ar1 = 0.7 and ma1 = 0.6 ts.sim.3<-arima.sim(list(order=c(1,0,1), ar=0.7, ma=0.6), n=200) windows() par(mfrow=c(1,1)) ts.plot(ts.sim.3) windows() par(mfrow=c(1,2)) acf(ts.sim.3) pacf(ts.sim.3)