Commit 0f8cb188 authored by MichelJuillard's avatar MichelJuillard
Browse files

adding new tests

parent 84eaaaf7
......@@ -115,7 +115,10 @@ MODFILES = \
kalman_filter_smoother/fs2000.mod \
kalman_filter_smoother/fs2000_1.mod \
kalman_filter_smoother/fs2000_2.mod \
kalman_filter_smoother/fs2000a.mod
kalman_filter_smoother/fs2000a.mod \
second_order/burnside_1.mod \
second_order/ds1.mod \
second_order/ds2.mod
EXTRA_DIST = \
$(MODFILES) \
......
var y x;
varexo e;
parameters beta theta rho xbar;
xbar = 0.0179;
rho = -0.139;
theta = -1.5;
theta = -10;
beta = 0.95;
model;
y = beta*exp(theta*x(+1))*(1+y(+1));
x = (1-rho)*xbar + rho*x(-1)+e;
end;
shocks;
var e; stderr 0.0348;
end;
initval;
x = xbar;
y = beta*exp(theta*xbar)/(1-beta*exp(theta*xbar));
end;
resid(1);
steady;
stoch_simul(order=2,irf=0);
sigma2=M_.Sigma_e;
i = linspace(1,800,800);
a = theta*xbar*i+(theta^2*sigma2)/(2*(1-rho)^2)*(i-2*rho*(1-rho.^i)/(1-rho)+rho^2*(1-rho.^(2*i))/(1-rho^2));
a1 = theta^2*sigma2/(2*(1-rho)^2)*(i-2*rho*(1-rho.^i)/(1-rho)+rho^2*(1-rho.^(2*i))/(1-rho^2));
b = theta*rho*(1-rho.^i)/(1-rho);
dr = oo_.dr;
x1 = [dr.ghx(2); dr.ghu(2); dr.ghxx(2); dr.ghuu(2); dr.ghxu(2); dr.ghs2(2)];
x2 = [
sum(beta.^i.*exp(theta*xbar*i).*b*rho)
sum(beta.^i.*exp(theta*xbar*i).*b)
sum(beta.^i.*exp(theta*xbar*i).*(b*rho).^2)
sum(beta.^i.*exp(theta*xbar*i).*b.^2)
sum(beta.^i.*exp(theta*xbar*i).*b.^2*rho)
sum(beta.^i.*exp(theta*xbar*i).*a1*2)
];
if any(abs(x1-x2) > 1e-14);
error('burnside_1 doesn''t reproduce the analytical solution');
end;
\ No newline at end of file
@#define countries = 1:2
@#define assets = 1:2
var
@#for c in countries
yk_@{c} yl_@{c} c_@{c}
@#endfor
a ze_1 r_1
;
varexo
@#for c in countries
ek_@{c} el_@{c}
@#endfor
;
parameters rho eta omega sig_k sig_l ykbar ylbar;
rho = 1;
psi = 0.7;
eta = 0.9;
g = 0.25;
ykbar = 1;
ylbar = 1;
cbar = ykbar+ylbar;
nu = 0.5;
omega = 0.75;
sig_k = 0.02;
sig_l = 0.01;
sig_m = 0;
betabar = omega*cbar^(-eta);
model;
@#for c in countries
yk_@{c} = log(ykbar) + sig_k*ek_@{c};
yl_@{c} = log(ylbar) + sig_l*el_@{c};
exp(c_@{c})^(eta-rho) = omega*exp(c_@{c}(+1))^(-rho)*r_1(+1);
@#endfor
a = a(-1)*r_1 + exp(yk_1) + exp(yl_1) - exp(c_1);
-a = -a(-1)*r_1 + exp(yk_2) + exp(yl_2) - exp(c_2);
// r_1+ze_1 = ze_1+exp(yk_1-ze_1(-1));
r_1 = exp(yk_1-ze_1(-1));
end;
shocks;
@#for c in countries
var ek_@{c} = 1;
var el_@{c} = 1;
@#endfor
end;
initval;
@#for c in countries
yk_@{c} = log(ykbar);
yl_@{c} = log(ylbar);
c_@{c} = log(ykbar+ylbar);
@#endfor
r_1 = 1/betabar;
ze_1 = log(betabar)+yk_1;
end;
resid(1);
steady;
model_diagnostics(M_,options_,oo_);
check;
stoch_simul(order=2,irf=0);
@#define countries = 1:2
@#define assets = 1:2
var
@#for c in countries
yk_@{c} yl_@{c} c_@{c}
@#endfor
a ze_1 r_1
;
varexo
@#for c in countries
ek_@{c} el_@{c}
@#endfor
;
parameters rho eta omega sig_k sig_l ykbar ylbar;
rho = 1;
psi = 0.7;
eta = 0.9;
g = 0.25;
ykbar = 1;
ylbar = 1;
cbar = ykbar+ylbar;
nu = 0.5;
omega = 0.75;
sig_k = 0.02;
sig_l = 0.01;
sig_m = 0;
betabar = omega*cbar^(-eta);
model;
@#for c in countries
yk_@{c} = log(ykbar) + sig_k*ek_@{c};
yl_@{c} = log(ylbar) + sig_l*el_@{c};
exp(c_@{c})^(eta-rho) = omega*exp(c_@{c}(+1))^(-rho)*r_1(+1);
@#endfor
a = a(-1)*r_1 + exp(yk_1) + exp(yl_1) - exp(c_1);
-a = -a(-1)*r_1 + exp(yk_2) + exp(yl_2) - exp(c_2);
// r_1+ze_1 = ze_1+exp(yk_1-ze_1(-1));
r_1 = exp(yk_1-ze_1(-1))+ze_1-ze_1;
end;
shocks;
@#for c in countries
var ek_@{c} = 1;
var el_@{c} = 1;
@#endfor
end;
initval;
@#for c in countries
yk_@{c} = log(ykbar);
yl_@{c} = log(ylbar);
c_@{c} = log(ykbar+ylbar);
@#endfor
r_1 = 1/betabar;
ze_1 = log(betabar)+yk_1;
end;
resid(1);
steady;
model_diagnostics(M_,options_,oo_);
check;
stoch_simul(order=2,irf=0);
o1 = load('ds1_results','oo_');
oo1 = o1.oo_.dr;
oo2 = oo_.dr;
if any(abs(oo1.ghxx-oo2.ghxx) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end;
if any(abs(oo1.ghuu-oo2.ghuu) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end;
if any(abs(oo1.ghxu-oo2.ghxu) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end;
if any(abs(oo1.ghs2-oo2.ghs2) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment