| 1 |
var z dw dx dy dc1 dc2 w x y; |
| 2 |
varexo e_w e_x e_y e_z; |
| 3 |
|
| 4 |
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; |
| 5 |
|
| 6 |
model(linear); |
| 7 |
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; |
| 8 |
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; |
| 9 |
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; |
| 10 |
z = rho_z*z(-1)+dw-dx+e_z; |
| 11 |
dc1 = dc1(-1)+dx-b*dy-c*dw; |
| 12 |
dc2 = dc2(-1)+dx-b*dy; |
| 13 |
w = w(-1) + dw; |
| 14 |
x = x(-1) + dx; |
| 15 |
y = y(-1) + dy; |
| 16 |
end; |
| 17 |
|
| 18 |
estimated_params; |
| 19 |
rho_w, normal_pdf, 0.5,0.2; |
| 20 |
rho_x, normal_pdf, 0.5,0.2; |
| 21 |
rho_y, normal_pdf, 0.5,0.2; |
| 22 |
rho_z, normal_pdf, 0.8,0.2; |
| 23 |
|
| 24 |
a1, normal_pdf, 0.1,0.2; |
| 25 |
a2, normal_pdf, -0.1,0.2; |
| 26 |
a3, normal_pdf, 0.1,0.2; |
| 27 |
b , normal_pdf, 1,0.2; |
| 28 |
c , normal_pdf, 1,0.2; |
| 29 |
|
| 30 |
stderr e_w, uniform_pdf,,, 0.01, 0.1; |
| 31 |
stderr e_x, uniform_pdf,,, 0.01, 0.1; |
| 32 |
stderr e_y, uniform_pdf,,, 0.01, 0.1; |
| 33 |
stderr e_z, inv_gamma_pdf,0.01, inf; |
| 34 |
|
| 35 |
stderr w, inv_gamma_pdf, 0.01,inf; |
| 36 |
end; |
| 37 |
|
| 38 |
varobs w x y; |
| 39 |
|
| 40 |
estimation(datafile=data_algo,first_obs=1000,silent_optimizer,nobs=200,mh_replic=0,diffuse_filter,smoothed_state_uncertainty); |
| 41 |
|
| 42 |
stoch_simul(irf=0); |
| 43 |
|
| 44 |
//checking smoother consistency |
| 45 |
X = oo_.SmoothedVariables; |
| 46 |
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y]; |
| 47 |
X = oo_.SmoothedShocks; |
| 48 |
E = [X.e_w X.e_x X.e_y X.e_z]; |
| 49 |
A = oo_.dr.ghx; |
| 50 |
B = oo_.dr.ghu; |
| 51 |
err = zeros(M_.endo_nbr,200); |
| 52 |
for t=2:200; |
| 53 |
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; |
| 54 |
end; |
| 55 |
if max(max(abs(err))) > 1e-10; |
| 56 |
error('Test fails'); |
| 57 |
end; |
| 58 |
|
| 59 |
d=load('data_algo'); |
| 60 |
dat = [d.w d.x d.y]; |
| 61 |
X = oo_.SmoothedMeasurementErrors; |
| 62 |
ME = [X.w X.x X.y]; |
| 63 |
if max(max(abs(dat(1000:1199,:)-S(:,[7:9])-ME))) > 1E-10; |
| 64 |
error('Test fails'); |
| 65 |
end; |