sun.ts<-ts(round(sunspot.year[71:171])) sun.ts ts.plot(sun.ts,xlab="Year",ylab="Sunspot Activity") acf(sun.ts,lag.max=20,type="correlation") newsun<-sun.ts[12:100]-sun.ts[1:89] ts.plot(newsun,xlab="Time",ylab="11 year differences") abline(h=0) acf(newsun,lag.max=20) sun.ar<-ar.yw(newsun) sun.ar ts.plot(sun.ar$aic,xlab="Order of series",ylab="Akaike criterion") ts.plot(sun.ar$resid,xlab="Year",ylab="Residuals from ar model") abline(h=0) acf(na.omit(sun.ar$resid),lag.max=20)