0001
0002
0003
0004
0005
0006
0007
0008 load closed_results_01022011
0009
0010 usdata
0011
0012
0013 checkplots = 1;
0014 dodecomposition = 1;
0015 checksum = 1;
0016 calibrated = 0;
0017
0018 beta = 0.99;
0019 psi = 0.1;
0020 omega = 0.0617;
0021 if calibrated
0022 rho_a = 0.9470;
0023 rho_e = 0.9625;
0024 omega = 0.0617;
0025 rho_pi = 0.3597;
0026 rho_g = 0.2536;
0027 rho_x = 0.0347;
0028 ppi_ss=0.0086;
0029 g_ss=0.0048;
0030 else
0031 rho_a = oo_.mle_mode.parameters.rho_a;
0032 rho_e = oo_.mle_mode.parameters.rho_e;
0033
0034 rho_pi = oo_.mle_mode.parameters.rho_pi;
0035 rho_g = oo_.mle_mode.parameters.rho_g;
0036 rho_x = oo_.mle_mode.parameters.rho_x;
0037 ppi_ss=ppiss;
0038 g_ss=gss;
0039 end
0040
0041
0042 ad_slope = -(1+rho_g+rho_x)/rho_pi;
0043 as_slope = psi;
0044
0045 ad_constant = ppi_ss - ad_slope*g_ss;
0046 as_constant = ppi_ss - as_slope*g_ss;
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064 if checkplots
0065 nvars = 10;
0066 nshocks = 4;
0067
0068 g0 = zeros(10);
0069 g0(1,1) = 1;
0070 g0(2,2) = 1;
0071 g0(3,3) = 1;
0072 g0(4,1) = -(1-omega)*(1-rho_a);
0073 g0(4,4) = 1;
0074 g0(4,8) = 1;
0075 g0(4,9) = -1;
0076 g0(4,10) = -1;
0077 g0(5,2) = 1;
0078 g0(5,4) = -psi;
0079 g0(5,5) = 1;
0080 g0(5,10) = -beta;
0081 g0(6,1) = omega;
0082 g0(6,4) = 1;
0083 g0(6,7) = -1;
0084 g0(7,3) = -1;
0085 g0(7,6) = 1;
0086 g0(7,7) = -1;
0087 g0(8,4) = -rho_x;
0088 g0(8,5) = -rho_pi;
0089 g0(8,6) = -rho_g;
0090 g0(8,8) = 1;
0091 g0(9,4) = 1;
0092 g0(10,5) = 1;
0093
0094 g1 = zeros(nvars);
0095 g1(1,1) = rho_a;
0096 g1(2,2) = rho_e;
0097 g1(7,7) = -1;
0098 g1(8,8) = 1;
0099 g1(9,9) = 1;
0100 g1(10,10) = 1;
0101
0102 PSI = zeros(nvars,nshocks);
0103 PSI(1,1) = 1;
0104 PSI(2,2) = 1;
0105 PSI(3,3) = 1;
0106 PSI(8,4) = 1;
0107
0108 PPI = zeros(nvars,2);
0109 PPI(9,1) = 1;
0110 PPI(10,2) = 1;
0111
0112 C0 = zeros(nvars,1);
0113
0114
0115
0116 [S0, S1, S2, S3, unique] = Smats(C0, g0, g1, PSI, PPI);
0117 end
0118
0119
0120
0121 T = max(size(ghat));
0122
0123 if calibrated == 0
0124 eps_a = oo_.SmoothedShocks.eps_a;
0125 eps_e = oo_.SmoothedShocks.eps_e;
0126 eps_z = oo_.SmoothedShocks.eps_z;
0127 eps_r = oo_.SmoothedShocks.eps_r;
0128
0129 eps_vec = [eps_a(1:end) eps_e(1:end) eps_z(1:end) eps_r(1:end)]';
0130 CC=corrcoef(eps_vec');
0131
0132 y_smats = zeros(nvars,T);
0133 y_smats(:,1) = [oo_.SmoothedVariables.a(1);
0134 oo_.SmoothedVariables.e(1);
0135 oo_.SmoothedVariables.z(1);
0136 oo_.SmoothedVariables.x(1);
0137 oo_.SmoothedVariables.ppihat(1);
0138 oo_.SmoothedVariables.ghat(1);
0139 oo_.SmoothedVariables.yhat(1);
0140 oo_.SmoothedVariables.rhat(1);
0141 oo_.SmoothedVariables.Ex(1);
0142 oo_.SmoothedVariables.Eppihat(1)];
0143
0144
0145 ast = oo_.SmoothedVariables.ast + as_constant;
0146 adt = oo_.SmoothedVariables.adt + ad_constant;
0147
0148 for t = 2:T;
0149 y_smats(:,t) = S1*y_smats(:,t-1)+S2*eps_vec(:,t);
0150 end
0151 end
0152
0153 samplesize = max(size(ghat));
0154 gmin = -.02;
0155 gmax = .02;
0156 step = .0005;
0157 gvec = gmin:step:gmax;
0158 [rows cols] = size(gvec);
0159
0160 ppi_ad = zeros(rows,cols,samplesize);
0161 ppi_as = zeros(rows,cols,samplesize);
0162
0163
0164
0165
0166
0167
0168
0169 g_ssvec = g_ss*ones(rows,cols);
0170 ppi_ssvec = ppi_ss*ones(rows,cols);
0171
0172
0173
0174 time = 1:T;
0175
0176 if checkplots
0177 figure(1)
0178 plot(time,y_smats(5,:),'b',time,ppihat,'r'), title('Inflation')
0179 figure(2)
0180 plot(time,y_smats(6,:),'b',time,ghat,'r'), title('Growth')
0181 figure(3)
0182 plot(time,y_smats(8,:),'b',time,rhat,'r'), title('Interest Rate')
0183 end
0184
0185 if dodecomposition
0186
0187 y_eps_a = zeros(nvars,T);
0188 y_eps_a(:,1) = y_smats(:,1)/4;
0189 eps_a_vec = [eps_a(1:end) 0*eps_e(1:end) 0*eps_z(1:end) 0*eps_r(1:end)]';
0190 for t = 2:T;
0191 y_eps_a(:,t) = S1*y_eps_a(:,t-1)+S2*eps_a_vec(:,t);
0192 end
0193
0194 y_eps_e = zeros(nvars,T);
0195 y_eps_e(:,1) = y_smats(:,1)/4;
0196 eps_e_vec = [0*eps_a(1:end) eps_e(1:end) 0*eps_z(1:end) 0*eps_r(1:end)]';
0197 for t = 2:T;
0198 y_eps_e(:,t) = S1*y_eps_e(:,t-1)+S2*eps_e_vec(:,t);
0199 end
0200
0201 y_eps_z = zeros(nvars,T);
0202 y_eps_z(:,1) = y_smats(:,1)/4;
0203 eps_z_vec = [0*eps_a(1:end) 0*eps_e(1:end) eps_z(1:end) 0*eps_r(1:end)]';
0204 for t = 2:T;
0205 y_eps_z(:,t) = S1*y_eps_z(:,t-1)+S2*eps_z_vec(:,t);
0206 end
0207
0208 y_eps_r = zeros(nvars,T);
0209 y_eps_r(:,1) = y_smats(:,1)/4;
0210 eps_r_vec = [0*eps_a(1:end) 0*eps_e(1:end) 0*eps_z(1:end) eps_r(1:end)]';
0211 for t = 2:T;
0212 y_eps_r(:,t) = S1*y_eps_r(:,t-1)+S2*eps_r_vec(:,t);
0213 end
0214 figure(1)
0215 subplot(3,1,1),plot(time,y_eps_a(5,:),'b',time,ppihat,'r'), legend('\epsilon_a only','data'), title('Inflation')
0216 subplot(3,1,2),plot(time,y_eps_a(6,:),'b',time,ghat,'r'), legend('\epsilon_a only','data'), title('Growth')
0217 subplot(3,1,3),plot(time,y_eps_a(8,:),'b',time,rhat,'r'), legend('\epsilon_a only','data'), title('Interest Rate')
0218 figure(2)
0219 subplot(3,1,1),plot(time,y_eps_e(5,:),'b',time,ppihat,'r'), legend('\epsilon_e only','data'), title('Inflation')
0220 subplot(3,1,2),plot(time,y_eps_e(6,:),'b',time,ghat,'r'), legend('\epsilon_e only','data'), title('Growth')
0221 subplot(3,1,3),plot(time,y_eps_e(8,:),'b',time,rhat,'r'), legend('\epsilon_e only','data'), title('Interest Rate')
0222 figure(3)
0223 subplot(3,1,1),plot(time,y_eps_z(5,:),'b',time,ppihat,'r'), legend('\epsilon_z only','data'), title('Inflation')
0224 subplot(3,1,2),plot(time,y_eps_z(6,:),'b',time,ghat,'r'), legend('\epsilon_z only','data'), title('Growth')
0225 subplot(3,1,3),plot(time,y_eps_z(8,:),'b',time,rhat,'r'), legend('\epsilon_z only','data'), title('Interest Rate')
0226 figure(4)
0227 subplot(3,1,1),plot(time,y_eps_r(5,:),'b',time,ppihat,'r'), legend('\epsilon_r only','data'), title('Inflation')
0228 subplot(3,1,2),plot(time,y_eps_r(6,:),'b',time,ghat,'r'), legend('\epsilon_r only','data'), title('Growth')
0229 subplot(3,1,3),plot(time,y_eps_r(8,:),'b',time,rhat,'r'), legend('\epsilon_r only','data'), title('Interest Rate')
0230 end
0231
0232
0233 if checksum
0234 ysum = y_eps_a + y_eps_e + y_eps_r + y_eps_z;
0235 figure(5)
0236 plot(time,ysum(5,:),'b',time,ppihat,'r'), title('Inflation')
0237 figure(6)
0238 plot(time,ysum(6,:),'b',time,ghat,'r'), title('Growth')
0239 figure(7)
0240 plot(time,ysum(8,:),'b',time,rhat,'r'), title('Interest Rate')
0241 end
0242
0243
0244
0245
0246
0247
0248