hohenTp<- read.table("C:/CLIM/HohenT.txt",header=T) ### attach(hohenTp) quot<- "Hohenpeissenberg, Temperature, 1781-2010"; quot plotAcf<- function(ACF,maxl,cylim,b1,bm){ #Needle-Plot of ACF plot(1:maxl,ACF,pch=16,ylim=cylim,xlab="lag", ylab="Auto-correlation") for (i in 1:maxl){ segments(i,0.0,i,ACF[i])} #Needles abline(h=0,lty=3); abline(h=c(-b1,-bm,b1,bm),lty=2) #Bounds text(maxl+0.1,b1+0.01,"b1",cex=0.7) text(maxl+0.1,bm+0.01,"b ",cex=0.7) text(maxl+0.25,bm+0.01,maxl,cex=0.7) } #Vector Y is the time series to be analyzed Y<- Tyear/100; n<- length(Y); maxl<- 12 #maximal lag subtxt<- "Auto-correlation function of time series"; subtxt zacf<- acf(Y,lag.max=maxl,type="corr",plot=F) #no Plot ACF<-zacf$acf[2:(maxl+1)]; ACF #Output of $r(1)...r(maxl) postscript(file="C:/CLIM/Acf.ps",height=20,width=12,horiz=F) par(mfrow=c(2,1)) cylim<- c(-0.2,0.33) b1<- qnorm(0.975)/sqrt(n); bm<- qnorm(1-0.025/maxl)/sqrt(n) plotAcf(ACF,maxl,cylim,b1,bm) #Produce Needle-Plot title(main=quot); title(sub=subtxt,cex=0.7) #---Analogously for the detrended series---------------------- dev.off() detach(hohenTp) ### rm(list=objects()) ###