library(xts) library(TTR) load("topix1991_2014.dat") topix.xts <- as.xts(read.zoo(topix1991_2014)) topix1991_2014.xts<-apply.monthly(topix.xts$Close,mean) as.vector(coredata(topix1991_2014.xts)) rep(NA,12) topix1991_2014<-c(rep(NA,12),as.vector(coredata(topix1991_2014.xts))) topix_monthly.ts<-ts(topix1991_2014,start=1990,freq=12) load("Industries_covered.dat") load("YeaOnYear_growth_rates.dat") Industries_covered.xts<-as.xts(Industries_covered.ts) YeaOnYear_growth_rates.xts<-as.xts(YeaOnYear_growth_rates.ts) topix_monthly.xts<-as.xts(topix_monthly.ts) par(mfrow=c(2,1),mar = c(2, 5, 3, 5)) plot.zoo(SMA(Industries_covered.xts,n=12),las=1,main="毎月勤労統計調査 実質賃金指数(調査産業計)",xlab="",ylab="",col="red",lwd=2,yaxt="n",ylim=c(96,112)) axis(2,las=1,col.axis="red") mtext("12ヶ月移動平均",side=2,line=3,col="red") par(new=T) plot.zoo(Industries_covered.xts,xaxt="n",yaxt="n",xlab="",ylab="") mtext("実質賃金指数(2010年平均=100)",side=4,line=3) axis(4,las=1) abline(v=as.yearmon("2009-09"),col="blue",lty=2) abline(v=as.yearmon("2012-12"),col="blue",lty=2) text(as.yearmon("2009-12"),210,"民主党政権",pos=4,col="blue",cex=1,font = 2) abline(v=as.yearmon("1997-04"),col="red",lty=3) text(as.yearmon("1996-01"),220,"消費税 5%",pos=4,col=rgb(1,0,0, alpha=0.7),cex=1,font = 2) abline(v=as.yearmon("2014-04"),col="red",lty=3) text(as.yearmon("2013-01"),220,"消費税 8%",pos=4,col=rgb(1,0,0, alpha=0.7),cex=1,font = 2) plot.zoo(YeaOnYear_growth_rates.xts,type="h",las=1,main="実質賃金指数(調査産業計) 前年比(%) & TOPIX",xlab="",ylab="前年比(%)",lwd=2.5) abline(v=as.yearmon("2009-09"),col="blue",lty=2) abline(v=as.yearmon("2012-12"),col="blue",lty=2) text(as.yearmon("2009-12"),5,"民主党政権",pos=4,col="blue",cex=1,font = 2) abline(v=as.yearmon("1997-04"),col="red",lty=3) text(as.yearmon("1996-01"),6,"消費税 5%",pos=4, col=rgb(1,0,0, alpha=0.7),cex=1,font = 2) abline(v=as.yearmon("2014-04"),col="red",lty=3) text(as.yearmon("2013-01"),6,"消費税 8%",pos=4,col=rgb(1,0,0, alpha=0.7),cex=1,font = 2) par(new=T) plot.zoo(topix_monthly.xts,xaxt="n",yaxt="n",xlab="",ylab="",col=rgb(1,0,0, alpha=1)) mtext("TOPIX",side=4,line=3) axis(4,las=1) par(mfrow=c(1,1))
|