#Schafbestand England & Wales, 1867-1939 # mit 5, 9, 13 Punkte Gleitende Durchschnitte Sheep<- read.table("Hsheep.dat",header=T) attach(Sheep) Y<- NShp/100 mean(Y); sqrt(var(Y)) postscript(file="NShp.ps",height=16,width=8,horizontal=F) par(mfrow=c(2,1)) plot(Year,Y,type="l",lty=1,xlim=c(1860,1940),ylim=c(13,24), xlab="Jahr",ylab="Anzahl Schafe in Millionen",cex=0.90) title(main="Schafbestand England & Wales, 1867-1939",cex=0.9) points(Year,Y,pch=4,cex=0.6) abline(h=c(14,16,18,20,22),lty=2) plot(Year,Y,type="l",lty=1,xlim=c(1860,1940),ylim=c(13,24), xlab="Jahr",ylab="Anzahl Schafe in Millionen",cex=0.9) abline(h=c(14,16,18,20,22),lty=2) #title(main="Schafbestand England & Wales, 1867-1939",cex=0.9) segments(1905,22.5,1915,22.5,lty=1) points(c(1905,1910,1915),c(22.5,22.5,22.5),pch=4,cex=0.6) segments(1905,23.2,1915,23.2,lty=2) segments(1905,23.9,1915,23.9,lty=3) text(1930,22.5,"Zeitreihe Y",cex=0.8) text(1930,23.2,"5 Punkte Ausgleich",cex=0.8) text(1930,23.9,"13 Punkte Ausgleich",cex=0.8) points(Year,Y,pch=4,cex=0.6) #5,9,13 Punkte Ausgleich c5<- c(-3,12,17,12,-3); Y5<- 1:69; Z5<- 1:69 c9<- c(-21,14,39,54,59,54,39,14,-21); Y9<- 1:65; Z9<- 1:65 c13<- c(-11,0,9,16,21,24,25,24,21,16,9,0,-11); Y13<- 1:61; Z13<- 1:61 for (i in 3:71) {Y5[i-2]<- 0 {for (j in 1:5) Y5[i-2]<- Y5[i-2]+c5[j]*Y[i-3+j]/35 }} lines(Year[3:71],Y5,lty=2) for (i in 5:69) {Y9[i-4]<- 0 {for (j in 1:9) Y9[i-4]<- Y9[i-4]+c9[j]*Y[i-5+j]/231}} #lines(Year[5:69],Y9,lty=2) for (i in 7:67) {Y13[i-6]<- 0 {for (j in 1:13) Y13[i-6]<- Y13[i-6]+c13[j]*Y[i-7+j]/143 }} lines(Year[7:67],Y13,lty=3) detach(Sheep) dev.off() rm(Y,Sheep) rm(Y5,Y9,Y13,c5,c9,c13) rm(Z5,Z9,Z13)