library(ts) data(UKDriverDeaths) plot(UKDriverDeaths) diff.1 <- diff(UKDriverDeaths,12) plot(diff.1) par(mfrow=c(1,2)) acf(diff.1,lag.max=40) pacf(diff.1,lag.max=40) seatbelt <- as.matrix(c(rep(0,169),rep(1,23))) fit <- arima0(UKDriverDeaths,order=c(1,0,1),seasonal=list(order=c(0,1,1),period=12), xreg=seatbelt) print(fit) fcast <- predict(fit,n.ahead=12,newxreg=as.matrix(rep(1,12))) plot(UKDriverDeaths,xlim=c(1969,1986),ylim=c(900,2600)) lines(fcast$pred,col=2) lines(fcast$pred + 2*fcast$se,col=3) lines(fcast$pred - 2*fcast$se,col=3)