正负冲击对比鲜明,
这样比较贴近你的想法.
###########PP shock
gi_pphigh=GIRF[,,5][which(hist_m[,4]>th),] #34
gi_pplow =GIRF[,,5][which(hist_m[,4]<th),] #78
##high pp shock
high_regime5=apply(gi_pphigh ,2,mean)
##low pp shock
low_regime5=apply(gi_pplow ,2,mean)
####plot PP shock on different regime
par(mfrow = c(2,1))
plot(seq(1,61),high_regime5, type="l", col = 2, ylab = expression(GIRF(h,delta,W(t-1))), xlab = 'Time Horizon')
lines(seq(1,61),low_regime5,col = 3, lty = 2)
title("PP shock on different regimes")
legend("bottomright", c("High Regime","Low Regime"), lty=1:2, col=2:3, adj = c(0, .6))
###############
###########NN shock
gi_nnhigh=GIRF[,,1][which(hist_m[,4]>th),] #34
gi_nnlow =GIRF[,,1][which(hist_m[,4]<th),] #78
##low NN shock
##high nn shock
high_regime1=apply(gi_nnhigh ,2,mean)
##low nn shock
low_regime1=apply(gi_nnlow ,2,mean)
####plot NN shock on different regimes
plot(seq(1,61),high_regime1, type="l", col = 2,ylab = expression(GIRF(h,delta,W(t-1))), xlab = 'Time Horizon')
lines(seq(1,61),low_regime1,col = 3, lty = 2)
title("NN shock on different regimes")
legend("bottomright", c("High Regime","Low Regime"), lty=1:2, col=2:3, adj = c(0, .6))
###############plot PP &NN Shock on high regime
x11()
par(mfrow = c(2,1))
plot(seq(1,61),high_regime5, type="l", col = 2,ylim=c(-0.6,0.6),
ylab = expression(GIRF(h,delta,W(t-1))), xlab = 'Time Horizon')
lines(seq(1,61),high_regime1,col = 3, lty = 2)
title("PP & NN shock on high regime")
legend("bottomright", c("PP Shock","NN Shock"), lty=1:2, col=2:3, adj = c(0, .6))
###############plot PP &NN Shock on low regime
plot(seq(1,61),low_regime5, type="l", col = 2, ylim=c(-0.55,0.55),
ylab = expression(GIRF(h,delta,W(t-1))), xlab = 'Time Horizon')
lines(seq(1,61),low_regime1,col = 3, lty = 2)
title("PP & NN shock on low regime")
legend("bottomright", c("PP Shock","NN Shock"), lty=1:2, col=2:3, adj = c(0, .6))
ps:你的数据三区的话
gi_pphigh=GIRF[,,5][which(hist_m[,7]>phi2[2,2]),] #9
gi_ppmiddle=GIRF[,,5][which(hist_m[,7]<phi2[2,2] & hist_m[,7]>phi2[1,2]),] #15
gi_pplow=GIRF[,,5][which(hist_m[,7]<phi2[1,2]),]


雷达卡

京公网安备 11010802022788号







