hohenTp<- read.table("C:/CLIM/HohenT.txt",header=T) ### attach(hohenTp) quot<- "Hohenpeissenberg, Temperature 1781-2010"; quot postscript(file="C:/CLIM/HoTpYe.ps",height=6,width=16,horiz=F) Y<- Tyear/100 # annual means in Celsius Ja<- Year-1800 # to have smaller values #fitting polynomial of order 4 J2<- Ja*Ja; J3<- J2*Ja; J4<- J3*Ja tppol<- lm(Y~Ja+J2+J3+J4) #centered (11-years) moving averages N<- length(Y); p<- 10; m<- p/2 glD<- 1:N; su<- 1:N #glD, su vectors of dim N for (t in (m+1):(N-m)) {su[t]<- 0 { for (k in -(m-1):(m-1)) su[t]<- su[t]+ Y[t+k] }} for (t in (m+1):(N-m)) {glD[t]<- 0 #weight 1/2 at the margins glD[t]<- glD[t]+((Y[t-m]+Y[t+m])/2+su[t])/p} ytext<- "Temperature [C]"; ttext<- "Temperature Year" cabl<- c(4:8) #for horizontal lines plot(Year,Y,type="l",lty=1,xlim=c(1780,2010),ylim=c(4.5,8.5), xlab="Year",ylab=ytext,cex=1.3) title(main=quot); text(1880,8.4,ttext,cex=1.2) abline(h=cabl,lty=3); abline(h=mean(Y),lty=4) #print total mean with 3 digits into the plot: text(2010,mean(Y),round(mean(Y),3),cex=0.8) lines(Year,predict(tppol),lty=2) #polynomial fitted lines(Year[(m+1):(N-m)],glD[(m+1):(N-m)],lty=1) #moving aver. dev.off() #output of the graphic detach(hohenTp) ### rm(list=objects()) ###