Converted MOD test files to Unix newline convention

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3253 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
sebastien 2009-12-16 17:25:06 +00:00
parent c3d6567d30
commit 6c185e2c6b
85 changed files with 7629 additions and 7629 deletions

View File

@ -1,82 +1,82 @@
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
options_.usePartInfo=0;
var m P c e W R k d n l gy_obs gp_obs Y_obs P_obs y dA P2 c2;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model ;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c2(+1)*P2(+1)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
Y_obs/Y_obs(-1) = gy_obs;
P_obs/P_obs(-1) = gp_obs;
P2 = P(+1);
c2 = c(+1);
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
unit_root_vars P_obs Y_obs;
steady;
stoch_simul(order=1,irf=0);
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
options_.usePartInfo=0;
var m P c e W R k d n l gy_obs gp_obs Y_obs P_obs y dA P2 c2;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model ;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c2(+1)*P2(+1)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
Y_obs/Y_obs(-1) = gy_obs;
P_obs/P_obs(-1) = gp_obs;
P2 = P(+1);
c2 = c(+1);
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
unit_root_vars P_obs Y_obs;
steady;
stoch_simul(order=1,irf=0);

View File

@ -1,90 +1,90 @@
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
options_.usePartInfo=0;
var m P c e W R k d n l gy_obs gp_obs Y_obs P_obs y dA P2 c2;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model ;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c2(+1)*P2(+1)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
Y_obs/Y_obs(-1) = gy_obs;
P_obs/P_obs(-1) = gp_obs;
P2 = P(+1);
c2 = c(+1);
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
unit_root_vars P_obs Y_obs;
steady;
stoch_simul(aim_solver, order=1, irf=0);
benchmark = load('fs2000_b1L1L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
options_.usePartInfo=0;
var m P c e W R k d n l gy_obs gp_obs Y_obs P_obs y dA P2 c2;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model ;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c2(+1)*P2(+1)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
Y_obs/Y_obs(-1) = gy_obs;
P_obs/P_obs(-1) = gp_obs;
P2 = P(+1);
c2 = c(+1);
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
unit_root_vars P_obs Y_obs;
steady;
stoch_simul(aim_solver, order=1, irf=0);
benchmark = load('fs2000_b1L1L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;

View File

@ -1,78 +1,78 @@
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(0.5*m(-1)+0.25*m(-2)+0.13*m(-3)+0.06*m(-4)+0.03*m(-5)+0.015*m(-6)+0.007*m(-7)+0.004*m(-8)+0.003*m(-9)+0.001*m(-10))+e_m;
-P/(((1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9)))*m/9)+bet*((1.3*P(+1)+P(+5)+0.7*P(+9))/3)*(alp*exp(-alp*(gam+log((1.3*e(+1)+e(+5)+0.7*e(+9))/3)))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l* (1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9))/9) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a)*4)*k(-4);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
check;
stoch_simul(order=1,irf=0);
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(0.5*m(-1)+0.25*m(-2)+0.13*m(-3)+0.06*m(-4)+0.03*m(-5)+0.015*m(-6)+0.007*m(-7)+0.004*m(-8)+0.003*m(-9)+0.001*m(-10))+e_m;
-P/(((1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9)))*m/9)+bet*((1.3*P(+1)+P(+5)+0.7*P(+9))/3)*(alp*exp(-alp*(gam+log((1.3*e(+1)+e(+5)+0.7*e(+9))/3)))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l* (1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9))/9) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a)*4)*k(-4);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
check;
stoch_simul(order=1,irf=0);

View File

@ -1,86 +1,86 @@
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(0.5*m(-1)+0.25*m(-2)+0.13*m(-3)+0.06*m(-4)+0.03*m(-5)+0.015*m(-6)+0.007*m(-7)+0.004*m(-8)+0.003*m(-9)+0.001*m(-10))+e_m;
-P/(((1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9)))*m/9)+bet*((1.3*P(+1)+P(+5)+0.7*P(+9))/3)*(alp*exp(-alp*(gam+log((1.3*e(+1)+e(+5)+0.7*e(+9))/3)))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l* (1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9))/9) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a)*4)*k(-4);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
check;
stoch_simul(aim_solver, order=1,irf=0);
benchmark = load('fs2000x10L9_L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(0.5*m(-1)+0.25*m(-2)+0.13*m(-3)+0.06*m(-4)+0.03*m(-5)+0.015*m(-6)+0.007*m(-7)+0.004*m(-8)+0.003*m(-9)+0.001*m(-10))+e_m;
-P/(((1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9)))*m/9)+bet*((1.3*P(+1)+P(+5)+0.7*P(+9))/3)*(alp*exp(-alp*(gam+log((1.3*e(+1)+e(+5)+0.7*e(+9))/3)))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l* (1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9))/9) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a)*4)*k(-4);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
check;
stoch_simul(aim_solver, order=1,irf=0);
benchmark = load('fs2000x10L9_L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;

View File

@ -1,59 +1,59 @@
//Model with up to 10 lags and leads up to 9 - but not all, with some missing
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a); % missing 0.06*m(-4) and +0.25*m(-2)
log(m) = (1-rho)*log(mst) + rho*log(0.75*m(-1)+0.13*m(-3)+0.09*m(-5)+0.015*m(-6)+0.007*m(-7)+0.004*m(-8)+0.003*m(-9)+0.001*m(-10))+e_m;
-P/(((1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9)))*m/9)+bet*((1.3*P(+1)+P(+5)+0.7*P(+9))/3)*(alp*exp(-alp*(gam+log((1.3*e(+1)+e(+5)+0.7*e(+9))/3)))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l* (1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9))/9) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a)*4)*k(-4);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=1,irf=0);
//Model with up to 10 lags and leads up to 9 - but not all, with some missing
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a); % missing 0.06*m(-4) and +0.25*m(-2)
log(m) = (1-rho)*log(mst) + rho*log(0.75*m(-1)+0.13*m(-3)+0.09*m(-5)+0.015*m(-6)+0.007*m(-7)+0.004*m(-8)+0.003*m(-9)+0.001*m(-10))+e_m;
-P/(((1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9)))*m/9)+bet*((1.3*P(+1)+P(+5)+0.7*P(+9))/3)*(alp*exp(-alp*(gam+log((1.3*e(+1)+e(+5)+0.7*e(+9))/3)))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l* (1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9))/9) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a)*4)*k(-4);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=1,irf=0);

View File

@ -1,67 +1,67 @@
//Model with up to 10 lags and leads up to 9 - but not all, with some missing
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a); % missing 0.06*m(-4) and +0.25*m(-2)
log(m) = (1-rho)*log(mst) + rho*log(0.75*m(-1)+0.13*m(-3)+0.09*m(-5)+0.015*m(-6)+0.007*m(-7)+0.004*m(-8)+0.003*m(-9)+0.001*m(-10))+e_m;
-P/(((1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9)))*m/9)+bet*((1.3*P(+1)+P(+5)+0.7*P(+9))/3)*(alp*exp(-alp*(gam+log((1.3*e(+1)+e(+5)+0.7*e(+9))/3)))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l* (1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9))/9) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a)*4)*k(-4);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(aim_solver, order=1,irf=0);
benchmark = load('fs2000x10_L9_L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;
//Model with up to 10 lags and leads up to 9 - but not all, with some missing
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a); % missing 0.06*m(-4) and +0.25*m(-2)
log(m) = (1-rho)*log(mst) + rho*log(0.75*m(-1)+0.13*m(-3)+0.09*m(-5)+0.015*m(-6)+0.007*m(-7)+0.004*m(-8)+0.003*m(-9)+0.001*m(-10))+e_m;
-P/(((1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9)))*m/9)+bet*((1.3*P(+1)+P(+5)+0.7*P(+9))/3)*(alp*exp(-alp*(gam+log((1.3*e(+1)+e(+5)+0.7*e(+9))/3)))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l* (1.3*c(+1)+c(+5)+0.7*c(+9))*(1.3*P(+1)+P(+5)+0.7*P(+9))/9) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a)*4)*k(-4);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(aim_solver, order=1,irf=0);
benchmark = load('fs2000x10_L9_L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;

View File

@ -1,47 +1,47 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
// GP extended to see effect of 2 lags and 2 leads
model(linear);
//y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
y = 0.3*y +0.3*y(-1) +0.3*y(-2)-(tau +alpha*(2-alpha)*(1-tau))*(R-pie)-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq + alpha*(2-alpha)*((1-tau)/tau)*(y_s(11)-y_s)-A;
//y = 0.3*y(+2)+0.3*y(+1)+0.3*y(-2) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
//pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = exp(-rr/400)*pie(-1)+alpha*exp(-rr/400)*dq-alpha*dq(-1)+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
//pie_s = rho_pies*pie_s(-1)+e_pies;
pie_s = rho_pies*pie_s(-1)+(1-rho_pies)*pie_s(-2)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
stoch_simul(order=1,irf=0);
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
// GP extended to see effect of 2 lags and 2 leads
model(linear);
//y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
y = 0.3*y +0.3*y(-1) +0.3*y(-2)-(tau +alpha*(2-alpha)*(1-tau))*(R-pie)-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq + alpha*(2-alpha)*((1-tau)/tau)*(y_s(11)-y_s)-A;
//y = 0.3*y(+2)+0.3*y(+1)+0.3*y(-2) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
//pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = exp(-rr/400)*pie(-1)+alpha*exp(-rr/400)*dq-alpha*dq(-1)+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
//pie_s = rho_pies*pie_s(-1)+e_pies;
pie_s = rho_pies*pie_s(-1)+(1-rho_pies)*pie_s(-2)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
stoch_simul(order=1,irf=0);

View File

@ -1,55 +1,55 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
// GP extended to see effect of 2 lags and 2 leads
model(linear);
//y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
y = 0.3*y +0.3*y(-1) +0.3*y(-2)-(tau +alpha*(2-alpha)*(1-tau))*(R-pie)-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq + alpha*(2-alpha)*((1-tau)/tau)*(y_s(11)-y_s)-A;
//y = 0.3*y(+2)+0.3*y(+1)+0.3*y(-2) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
//pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = exp(-rr/400)*pie(-1)+alpha*exp(-rr/400)*dq-alpha*dq(-1)+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
//pie_s = rho_pies*pie_s(-1)+e_pies;
pie_s = rho_pies*pie_s(-1)+(1-rho_pies)*pie_s(-2)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
stoch_simul(aim_solver, order=1,irf=0);
benchmark = load('ls2003_2L0L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
// GP extended to see effect of 2 lags and 2 leads
model(linear);
//y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
y = 0.3*y +0.3*y(-1) +0.3*y(-2)-(tau +alpha*(2-alpha)*(1-tau))*(R-pie)-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq + alpha*(2-alpha)*((1-tau)/tau)*(y_s(11)-y_s)-A;
//y = 0.3*y(+2)+0.3*y(+1)+0.3*y(-2) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
//pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = exp(-rr/400)*pie(-1)+alpha*exp(-rr/400)*dq-alpha*dq(-1)+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
//pie_s = rho_pies*pie_s(-1)+e_pies;
pie_s = rho_pies*pie_s(-1)+(1-rho_pies)*pie_s(-2)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
stoch_simul(aim_solver, order=1,irf=0);
benchmark = load('ls2003_2L0L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;

View File

@ -1,45 +1,45 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
// GP extended to see effect of 2 lags and 2 leads
model(linear);
//y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
y = 0.3*y(+2)+0.3*y(+1)+0.3*y(-2) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
//pie_s = rho_pies*pie_s(-1)+e_pies;
pie_s = rho_pies*pie_s(-1)+(1-rho_pies)*pie_s(-2)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
stoch_simul(order=1,irf=0);
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
// GP extended to see effect of 2 lags and 2 leads
model(linear);
//y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
y = 0.3*y(+2)+0.3*y(+1)+0.3*y(-2) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
//pie_s = rho_pies*pie_s(-1)+e_pies;
pie_s = rho_pies*pie_s(-1)+(1-rho_pies)*pie_s(-2)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
stoch_simul(order=1,irf=0);

View File

@ -1,54 +1,54 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
// GP extended to see effect of 2 lags and 2 leads
model(linear);
//y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
y = 0.3*y(+2)+0.3*y(+1)+0.3*y(-2) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
//pie_s = rho_pies*pie_s(-1)+e_pies;
pie_s = rho_pies*pie_s(-1)+(1-rho_pies)*pie_s(-2)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
stoch_simul(aim_solver, order=1,irf=0);
benchmark = load('ls2003_2L2L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
// GP extended to see effect of 2 lags and 2 leads
model(linear);
//y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
y = 0.3*y(+2)+0.3*y(+1)+0.3*y(-2) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
//pie_s = rho_pies*pie_s(-1)+e_pies;
pie_s = rho_pies*pie_s(-1)+(1-rho_pies)*pie_s(-2)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
stoch_simul(aim_solver, order=1,irf=0);
benchmark = load('ls2003_2L2L_results');
threshold = 1e-8;
if max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx) > threshold));
error('error in ghx');
elseif max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu) > threshold));
error('error in ghy');
end;

View File

@ -1,23 +1,23 @@
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
shocks;
var e_x; stderr 0.01;
var e_y; stderr 0.01;
end;
stoch_simul(order=1,periods=1000,irf=0,nomoments);
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
shocks;
var e_x; stderr 0.01;
var e_y; stderr 0.01;
end;
stoch_simul(order=1,periods=1000,irf=0,nomoments);
datatomfile('data1',[]);

View File

@ -1,23 +1,23 @@
var dx dy;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
check;
var dx dy;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
check;
estimation(datafile=data1,nobs=1000,mh_replic=2000);

View File

@ -1,25 +1,25 @@
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs x y;
unit_root_vars x y;
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs x y;
unit_root_vars x y;
estimation(datafile=data1,nobs=1000,mh_replic=0);

View File

@ -1,27 +1,27 @@
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
stderr x,INV_GAMMA_PDF,0.01,inf;
stderr y,INV_GAMMA_PDF,0.01,inf;
end;
varobs x y;
unit_root_vars x y;
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
stderr x,INV_GAMMA_PDF,0.01,inf;
stderr y,INV_GAMMA_PDF,0.01,inf;
end;
varobs x y;
unit_root_vars x y;
estimation(datafile=data1,nobs=1000,mh_replic=2000,lik_init=2);

View File

@ -1,26 +1,26 @@
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y b a1 a2;
rho_x = 0.5;
rho_y = -0.3;
b = 1;
a1 = -0.1;
a2 = 0.2;
model;
dx = rho_x*dx(-1)+a1*(x(-1)-b*y(-1))+e_x;
dy = rho_y*dy(-1)+a2*(x(-1)-b*y(-1))+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
shocks;
var e_x; stderr 0.01;
var e_y; stderr 0.01;
end;
stoch_simul(order=1,periods=1000,irf=0,nomoments);
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y b a1 a2;
rho_x = 0.5;
rho_y = -0.3;
b = 1;
a1 = -0.1;
a2 = 0.2;
model;
dx = rho_x*dx(-1)+a1*(x(-1)-b*y(-1))+e_x;
dy = rho_y*dy(-1)+a2*(x(-1)-b*y(-1))+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
shocks;
var e_x; stderr 0.01;
var e_y; stderr 0.01;
end;
stoch_simul(order=1,periods=1000,irf=0,nomoments);
datatomfile('data2',[]);

View File

@ -1,33 +1,33 @@
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y b a1 a2;
rho_x = 0.5;
rho_y = -0.3;
b = 1;
a1 = -0.1;
a2 = 0.2;
model;
dx = rho_x*dx(-1)+a1*(x(-1)-b*y(-1))+e_x;
dy = rho_y*dy(-1)+a2*(x(-1)-b*y(-1))+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
b,NORMAL_PDF,1,0.1;
a1,NORMAL_PDF,-0.1,0.1;
a2,NORMAL_PDF,0.2,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
unit_root_vars x y;
estimation(datafile=data2,nobs=100,mh_replic=0,lik_init=2);
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y b a1 a2;
rho_x = 0.5;
rho_y = -0.3;
b = 1;
a1 = -0.1;
a2 = 0.2;
model;
dx = rho_x*dx(-1)+a1*(x(-1)-b*y(-1))+e_x;
dy = rho_y*dy(-1)+a2*(x(-1)-b*y(-1))+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
b,NORMAL_PDF,1,0.1;
a1,NORMAL_PDF,-0.1,0.1;
a2,NORMAL_PDF,0.2,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
unit_root_vars x y;
estimation(datafile=data2,nobs=100,mh_replic=0,lik_init=2);

View File

@ -1,33 +1,33 @@
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y b a1 a2;
rho_x = 0.5;
rho_y = -0.3;
b = 1;
a1 = -0.1;
a2 = 0.2;
model;
dx = rho_x*dx(-1)+a1*(x(-1)-b*y(-1))+e_x;
dy = rho_y*dy(-1)+a2*(x(-1)-b*y(-1))+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
b,NORMAL_PDF,1,0.1;
a1,NORMAL_PDF,-0.1,0.1;
a2,NORMAL_PDF,0.2,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs x y;
unit_root_vars x y;
estimation(datafile=data2,nobs=100,mh_replic=0,lik_init=2);
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y b a1 a2;
rho_x = 0.5;
rho_y = -0.3;
b = 1;
a1 = -0.1;
a2 = 0.2;
model;
dx = rho_x*dx(-1)+a1*(x(-1)-b*y(-1))+e_x;
dy = rho_y*dy(-1)+a2*(x(-1)-b*y(-1))+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
b,NORMAL_PDF,1,0.1;
a1,NORMAL_PDF,-0.1,0.1;
a2,NORMAL_PDF,0.2,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs x y;
unit_root_vars x y;
estimation(datafile=data2,nobs=100,mh_replic=0,lik_init=2);

View File

@ -1,31 +1,31 @@
var dx dy coint_err;
varexo e_x e_y;
parameters rho_x rho_y b a1 a2;
rho_x = 0.5;
rho_y = -0.3;
b = 1;
a1 = -0.1;
a2 = 0.2;
model;
dx = rho_x*dx(-1)+a1*coint_err(-1)+e_x;
dy = rho_y*dy(-1)+a2*coint_err(-1)+e_y;
coint_err = dx-b*dy+coint_err(-1);
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
b,NORMAL_PDF,1,0.1;
a1,NORMAL_PDF,-0.1,0.1;
a2,NORMAL_PDF,0.2,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
estimation(datafile=data2,nobs=100,mh_replic=0);
var dx dy coint_err;
varexo e_x e_y;
parameters rho_x rho_y b a1 a2;
rho_x = 0.5;
rho_y = -0.3;
b = 1;
a1 = -0.1;
a2 = 0.2;
model;
dx = rho_x*dx(-1)+a1*coint_err(-1)+e_x;
dy = rho_y*dy(-1)+a2*coint_err(-1)+e_y;
coint_err = dx-b*dy+coint_err(-1);
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
b,NORMAL_PDF,1,0.1;
a1,NORMAL_PDF,-0.1,0.1;
a2,NORMAL_PDF,0.2,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
estimation(datafile=data2,nobs=100,mh_replic=0);

View File

@ -1,24 +1,24 @@
var dx dy;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
check;
estimation(datafile=data1,nobs=1000,mh_replic=0,load_mh_file);
var dx dy;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
check;
estimation(datafile=data1,nobs=1000,mh_replic=0,load_mh_file);
stab_map_;

View File

@ -1,91 +1,91 @@
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
@#if block_bytecode == 2
model(block, bytecode);
@#else
@# if block_bytecode == 1
model(block);
@# else
model;
@# endif
@#endif
/*0*/ exp(gam+e_a) = dA ;
/*1*/ log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
/*2*/ -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
/*3*/ l/n = W;
/*4*/ -(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
/*5*/ R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
/*6*/ 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
/*7*/ c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
/*8*/ P*c = m;
/*9*/ m-1+d = l;
/*10*/ e = exp(e_a);
/*11*/ k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)) = y ;
/*12*/ gy_obs = dA*y/y(-1);
/*13*/ gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
e_a=0;
e_m=0;
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
options_.maxit_=10;
steady(solve_algo = @{solve_algo});
@#if block_bytecode > 0
model_info;
@#endif
shocks;
var e_a;
periods 1;
values 0.16;
end;
simul(periods=200, stack_solve_algo = @{stack_solve_algo});
@#if block_bytecode > 0
if ~exist('fs2000_simk_results.mat','file');
error('fs2000_simk must be run first');
end;
oo1 = load('fs2000_simk_results','oo_');
err = max(max(abs(oo_.endo_simul - oo1.oo_.endo_simul)))
disp(['Max error in simulation: ' num2str(err)])
if err > 1e-4
error('Error above the threshold')
end;
@#endif
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
@#if block_bytecode == 2
model(block, bytecode);
@#else
@# if block_bytecode == 1
model(block);
@# else
model;
@# endif
@#endif
/*0*/ exp(gam+e_a) = dA ;
/*1*/ log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
/*2*/ -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
/*3*/ l/n = W;
/*4*/ -(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
/*5*/ R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
/*6*/ 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
/*7*/ c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
/*8*/ P*c = m;
/*9*/ m-1+d = l;
/*10*/ e = exp(e_a);
/*11*/ k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)) = y ;
/*12*/ gy_obs = dA*y/y(-1);
/*13*/ gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
e_a=0;
e_m=0;
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
options_.maxit_=10;
steady(solve_algo = @{solve_algo});
@#if block_bytecode > 0
model_info;
@#endif
shocks;
var e_a;
periods 1;
values 0.16;
end;
simul(periods=200, stack_solve_algo = @{stack_solve_algo});
@#if block_bytecode > 0
if ~exist('fs2000_simk_results.mat','file');
error('fs2000_simk must be run first');
end;
oo1 = load('fs2000_simk_results','oo_');
err = max(max(abs(oo_.endo_simul - oo1.oo_.endo_simul)))
disp(['Max error in simulation: ' num2str(err)])
if err > 1e-4
error('Error above the threshold')
end;
@#endif

View File

@ -1,80 +1,80 @@
var y a k c i h eoy eoc eoh oy oc oh;
varexo e eeoy eeoc eeoh;
parameters theta rho eta gam bet delta aa r11 r12 r13 r21 r22 r23 r31 r32 r33 scy shc shy;
bet = 0.99;
delta = 0.025;
theta = 0.2;
rho = 0.9959;
eta = 1.0051;
gam = 0.0045;
aa = 1.8;
r11 = 0.99;
r12 = 0;
r13 = 0;
r21 = 0;
r22 = 0.99;
r23 = 0;
r31 = 0;
r32 = 0;
r33 = 0.99;
scy = 0.0040;
shy = 0.0015;
shc = 0.0010;
model(block,cutoff=0);
exp(y) = exp(a)*exp(k(-1))^theta*exp(h)^(1-theta);
a = (1-rho)*aa+rho*a(-1)+e;
exp(y) = exp(c) + exp(i);
eta*exp(k) = (1-delta)*exp(k(-1))+exp(i);
gam*exp(c)*exp(h) = (1-theta)*exp(y);
eta/exp(c) = bet*(1/exp(c(+1)))*(theta*(exp(y(+1))/exp(k))+1-delta);
eoy = r11*eoy(-1) + r12*eoc(-1) + r13*eoh(-1) + eeoy;
eoc = r21*eoy(-1) + r22*eoc(-1) + r23*eoh(-1) + scy*eeoy+eeoc;
eoh = r31*eoy(-1) + r32*eoc(-1) + r33*eoh(-1) + shy*eeoy+shc*eeoc+eeoh;
oy = y + eoy;
oc = c + eoc;
oh = h + eoh;
end;
initval;
e=0;
eeoy=0;
eeoc=0;
eeoh=0;
y= 7.99331700544506;
a= 1.8;
k= 9.59646163090336;
c= 7.83132048725623;
i= 6.09323152367607;
h= 5.34253084908048;
eoy= 0.0000;
eoc= 0.0000;
eoh= 0;
oy= 7.99331700544506;
oc= 7.83132048725623;
oh= 5.34253084908048;
k=k+0.000001;
end;
options_.dynatol=1e-12;
options_.maxit_=5;
options_.slowc=1;
steady(solve_algo=2);
options_.dynatol=4e-5;
shocks;
var e;
periods 1;
values 0.02;
end;
options_.maxit_=20;
model_info;
simul(periods=2000, stack_solve_algo = 1);
rplot y;
rplot k;
var y a k c i h eoy eoc eoh oy oc oh;
varexo e eeoy eeoc eeoh;
parameters theta rho eta gam bet delta aa r11 r12 r13 r21 r22 r23 r31 r32 r33 scy shc shy;
bet = 0.99;
delta = 0.025;
theta = 0.2;
rho = 0.9959;
eta = 1.0051;
gam = 0.0045;
aa = 1.8;
r11 = 0.99;
r12 = 0;
r13 = 0;
r21 = 0;
r22 = 0.99;
r23 = 0;
r31 = 0;
r32 = 0;
r33 = 0.99;
scy = 0.0040;
shy = 0.0015;
shc = 0.0010;
model(block,cutoff=0);
exp(y) = exp(a)*exp(k(-1))^theta*exp(h)^(1-theta);
a = (1-rho)*aa+rho*a(-1)+e;
exp(y) = exp(c) + exp(i);
eta*exp(k) = (1-delta)*exp(k(-1))+exp(i);
gam*exp(c)*exp(h) = (1-theta)*exp(y);
eta/exp(c) = bet*(1/exp(c(+1)))*(theta*(exp(y(+1))/exp(k))+1-delta);
eoy = r11*eoy(-1) + r12*eoc(-1) + r13*eoh(-1) + eeoy;
eoc = r21*eoy(-1) + r22*eoc(-1) + r23*eoh(-1) + scy*eeoy+eeoc;
eoh = r31*eoy(-1) + r32*eoc(-1) + r33*eoh(-1) + shy*eeoy+shc*eeoc+eeoh;
oy = y + eoy;
oc = c + eoc;
oh = h + eoh;
end;
initval;
e=0;
eeoy=0;
eeoc=0;
eeoh=0;
y= 7.99331700544506;
a= 1.8;
k= 9.59646163090336;
c= 7.83132048725623;
i= 6.09323152367607;
h= 5.34253084908048;
eoy= 0.0000;
eoc= 0.0000;
eoh= 0;
oy= 7.99331700544506;
oc= 7.83132048725623;
oh= 5.34253084908048;
k=k+0.000001;
end;
options_.dynatol=1e-12;
options_.maxit_=5;
options_.slowc=1;
steady(solve_algo=2);
options_.dynatol=4e-5;
shocks;
var e;
periods 1;
values 0.02;
end;
options_.maxit_=20;
model_info;
simul(periods=2000, stack_solve_algo = 1);
rplot y;
rplot k;

View File

@ -1,73 +1,73 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs vv ww;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(block, bytecode, cutoff=0);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
vv = 0.2*ww+0.5*vv(-1)+1;
ww = 0.1*vv+0.5*ww(-1)+2;
/* A lt=
0.5*vv-0.2*ww = 1
-0.1*vv+0.5*ww = 2
[ 0.5 -0.2][vv] [1]
=
[-0.1 0.5][ww] [2]
det = 0.25-0.02 = 0.23
[vv] [0.5 0.2] [1] [0.9] [3.91304]
= 1/0.23* = 1/0.23* =
[ww] [0.1 0.5] [2] [1.1] [4.7826]
*/
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
options_.maxit_=100;
steady(solve_algo = 5);
model_info;
//check;
shocks;
var e_q;
periods 1;
values 0.5;
end;
simul(periods=20, markowitz=0, stack_solve_algo = 5);
rplot vv;
rplot ww;
rplot A;
rplot pie;
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs vv ww;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(block, bytecode, cutoff=0);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
vv = 0.2*ww+0.5*vv(-1)+1;
ww = 0.1*vv+0.5*ww(-1)+2;
/* A lt=
0.5*vv-0.2*ww = 1
-0.1*vv+0.5*ww = 2
[ 0.5 -0.2][vv] [1]
=
[-0.1 0.5][ww] [2]
det = 0.25-0.02 = 0.23
[vv] [0.5 0.2] [1] [0.9] [3.91304]
= 1/0.23* = 1/0.23* =
[ww] [0.1 0.5] [2] [1.1] [4.7826]
*/
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
options_.maxit_=100;
steady(solve_algo = 5);
model_info;
//check;
shocks;
var e_q;
periods 1;
values 0.5;
end;
simul(periods=20, markowitz=0, stack_solve_algo = 5);
rplot vv;
rplot ww;
rplot A;
rplot pie;

View File

@ -1,27 +1,27 @@
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model(block);
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
shocks;
var e_x; stderr 0.01;
var e_y; stderr 0.01;
end;
steady;
check;
model_info;
simul(periods=50);
/*stoch_simul(order=1,periods=1000,irf=0,nomoments);
datatomfile('data1',[]);
var dx dy x y;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model(block);
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
x = x(-1)+dx;
y = y(-1)+dy;
end;
shocks;
var e_x; stderr 0.01;
var e_y; stderr 0.01;
end;
steady;
check;
model_info;
simul(periods=50);
/*stoch_simul(order=1,periods=1000,irf=0,nomoments);
datatomfile('data1',[]);
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +1,37 @@
options_.maxit_ = 100;
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model(block, bytecode);
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
steady(solve_algo = 5);
//check;
model_info;
shocks;
var x;
periods 1;
values 1.02;
end;
simul(periods = 200, stack_solve_algo = 5, markowitz = 2);
rplot c;
rplot k;
options_.maxit_ = 100;
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model(block, bytecode);
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
steady(solve_algo = 5);
//check;
model_info;
shocks;
var x;
periods 1;
values 1.02;
end;
simul(periods = 200, stack_solve_algo = 5, markowitz = 2);
rplot c;
rplot k;

View File

@ -1,37 +1,37 @@
// check shocks on several periods
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model(block);
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k +1 ;
end;
steady;
//check;
shocks;
var x;
periods 1 2 3 4;
values 1.1 1.2 1.3 1.4;
end;
simul(periods=200, stack_solve_algo = 2);
rplot c;
rplot k;
// check shocks on several periods
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model(block);
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k +1 ;
end;
steady;
//check;
shocks;
var x;
periods 1 2 3 4;
values 1.1 1.2 1.3 1.4;
end;
simul(periods=200, stack_solve_algo = 2);
rplot c;
rplot k;

View File

@ -1,30 +1,30 @@
var dx dy;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
check;
estimation(datafile = bvar_sample, mh_replic = 1200, mh_jscale = 1.3,
first_obs = 9);
bvar_density 8;
bvar_forecast(forecast = 10, bvar_replic = 2000, nobs = 200) 8;
var dx dy;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
check;
estimation(datafile = bvar_sample, mh_replic = 1200, mh_jscale = 1.3,
first_obs = 9);
bvar_density 8;
bvar_forecast(forecast = 10, bvar_replic = 2000, nobs = 200) 8;

View File

@ -1,23 +1,23 @@
var dx dy;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
check;
var dx dy;
varexo e_x e_y;
parameters rho_x rho_y;
rho_x = 0.5;
rho_y = -0.3;
model;
dx = rho_x*dx(-1)+e_x;
dy = rho_y*dy(-1)+e_y;
end;
estimated_params;
rho_x,NORMAL_PDF,0.5,0.1;
rho_y,NORMAL_PDF,-0.3,0.1;
stderr e_x,INV_GAMMA_PDF,0.01,inf;
stderr e_y,INV_GAMMA_PDF,0.01,inf;
end;
varobs dx dy;
check;
estimation(datafile=test,nobs=1000,mh_replic=2000,mh_jscale=1.3);

View File

@ -1,44 +1,44 @@
// example 2 from Collard's guide to Dynare
var y, c, k, a, h, b;
varexo e,u;
parameters beta, rho, beta, alpha, delta, theta, psi, tau ;
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;
model;
exp(c)*theta*exp(h)^(1+psi)=(1-alpha)*exp(y);
exp(k) = beta*(((exp(b)*exp(c))/(exp(b(+1))*exp(c(+1))))
*(exp(b(+1))*alpha*exp(y(+1))+(1-delta)*exp(k)));
exp(y) = exp(a)*(exp(k(-1))^alpha)*(exp(h)^(1-alpha));
exp(k) = exp(b)*(exp(y)-exp(c))+(1-delta)*exp(k(-1));
a = rho*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rho*b(-1) + u;
end;
initval;
y = 0.1;
c = -0.2;
h = -1.2;
k = 2.4;
a = 0;
b = 0;
e = 0;
u = 0;
end;
steady;
shocks;
var e = 0.009^2;
var u = 0.009^2;
end;
stoch_simul(dr_algo=1,drop=200);
// example 2 from Collard's guide to Dynare
var y, c, k, a, h, b;
varexo e,u;
parameters beta, rho, beta, alpha, delta, theta, psi, tau ;
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;
model;
exp(c)*theta*exp(h)^(1+psi)=(1-alpha)*exp(y);
exp(k) = beta*(((exp(b)*exp(c))/(exp(b(+1))*exp(c(+1))))
*(exp(b(+1))*alpha*exp(y(+1))+(1-delta)*exp(k)));
exp(y) = exp(a)*(exp(k(-1))^alpha)*(exp(h)^(1-alpha));
exp(k) = exp(b)*(exp(y)-exp(c))+(1-delta)*exp(k(-1));
a = rho*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rho*b(-1) + u;
end;
initval;
y = 0.1;
c = -0.2;
h = -1.2;
k = 2.4;
a = 0;
b = 0;
e = 0;
u = 0;
end;
steady;
shocks;
var e = 0.009^2;
var u = 0.009^2;
end;
stoch_simul(dr_algo=1,drop=200);

View File

@ -1,89 +1,89 @@
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
estimated_params;
alp, beta_pdf, 0.356, 0.02;
bet, beta_pdf, 0.993, 0.002;
gam, normal_pdf, 0.0085, 0.003;
mst, normal_pdf, 1.0002, 0.007;
rho, beta_pdf, 0.129, 0.223;
psi, beta_pdf, 0.65, 0.05;
del, beta_pdf, 0.01, 0.005;
stderr e_a, inv_gamma_pdf, 0.035449, inf;
stderr e_m, inv_gamma_pdf, 0.008862, inf;
end;
varobs gp_obs gy_obs;
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
estimated_params;
alp, beta_pdf, 0.356, 0.02;
bet, beta_pdf, 0.993, 0.002;
gam, normal_pdf, 0.0085, 0.003;
mst, normal_pdf, 1.0002, 0.007;
rho, beta_pdf, 0.129, 0.223;
psi, beta_pdf, 0.65, 0.05;
del, beta_pdf, 0.01, 0.005;
stderr e_a, inv_gamma_pdf, 0.035449, inf;
stderr e_m, inv_gamma_pdf, 0.008862, inf;
end;
varobs gp_obs gy_obs;
estimation(datafile=fsdat,nobs=192,loglinear,mh_replic=2000,mh_nblocks=5,mh_jscale=0.8);

View File

@ -1,102 +1,102 @@
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
var m P c e W R k d n l gy_obs gp_obs Y_obs P_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
Y_obs/Y_obs(-1) = gy_obs;
P_obs/P_obs(-1) = gp_obs;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
check;
estimated_params;
alp, beta_pdf, 0.356, 0.02;
bet, beta_pdf, 0.993, 0.002;
gam, normal_pdf, 0.0085, 0.003;
mst, normal_pdf, 1.0002, 0.007;
rho, beta_pdf, 0.129, 0.223;
psi, beta_pdf, 0.65, 0.05;
del, beta_pdf, 0.01, 0.005;
stderr e_a, inv_gamma_pdf, 0.035449, inf;
stderr e_m, inv_gamma_pdf, 0.008862, inf;
end;
varobs P_obs Y_obs;
observation_trends;
P_obs (log(mst)-gam);
Y_obs (gam);
end;
unit_root_vars P_obs Y_obs;
//stoch_simul(order=1,nomoments,irf=0);
estimation(datafile=fsdat,nobs=192,loglinear,mh_replic=0,mh_nblocks=2,mh_drop=0.45,mode_compute=0,mode_file=fs2000b_mode,load_mh_file);
stab_map_;
// This file replicates the estimation of the CIA model from
// Frank Schorfheide (2000) "Loss function-based evaluation of DSGE models"
// Journal of Applied Econometrics, 15, 645-670.
// the data are the ones provided on Schorfheide's web site with the programs.
// http://www.econ.upenn.edu/~schorf/programs/dsgesel.ZIP
// You need to have fsdat.m in the same directory as this file.
// This file replicates:
// -the posterior mode as computed by Frank's Gauss programs
// -the parameter mean posterior estimates reported in the paper
// -the model probability (harmonic mean) reported in the paper
// This file was tested with dyn_mat_test_0218.zip
// the smooth shocks are probably stil buggy
//
// The equations are taken from J. Nason and T. Cogley (1994)
// "Testing the implications of long-run neutrality for monetary business
// cycle models" Journal of Applied Econometrics, 9, S37-S70.
// Note that there is an initial minus sign missing in equation (A1), p. S63.
//
// Michel Juillard, February 2004
var m P c e W R k d n l gy_obs gp_obs Y_obs P_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
Y_obs/Y_obs(-1) = gy_obs;
P_obs/P_obs(-1) = gp_obs;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
check;
estimated_params;
alp, beta_pdf, 0.356, 0.02;
bet, beta_pdf, 0.993, 0.002;
gam, normal_pdf, 0.0085, 0.003;
mst, normal_pdf, 1.0002, 0.007;
rho, beta_pdf, 0.129, 0.223;
psi, beta_pdf, 0.65, 0.05;
del, beta_pdf, 0.01, 0.005;
stderr e_a, inv_gamma_pdf, 0.035449, inf;
stderr e_m, inv_gamma_pdf, 0.008862, inf;
end;
varobs P_obs Y_obs;
observation_trends;
P_obs (log(mst)-gam);
Y_obs (gam);
end;
unit_root_vars P_obs Y_obs;
//stoch_simul(order=1,nomoments,irf=0);
estimation(datafile=fsdat,nobs=192,loglinear,mh_replic=0,mh_nblocks=2,mh_drop=0.45,mode_compute=0,mode_file=fs2000b_mode,load_mh_file);
stab_map_;

View File

@ -1,59 +1,59 @@
/* Used to check that Dynare++ and Dynare with k_order_solver=1 give the same result */
var m m_1 P P_1 c e W R k d n l gy_obs gp_obs y dA P2 c2;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m_1(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c2(+1)*P2(+1)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P_1(-1))*m_1(-1)/dA;
P2 = P(+1);
c2 = c(+1);
m_1 = m;
P_1 = P;
end;
initval;
m = mst;
m_1=mst;
P = 2.25;
P_1 = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
P2=P;
c2=c;
end;
vcov = [0.014, 0;0, 0.005];
/* Used to check that Dynare++ and Dynare with k_order_solver=1 give the same result */
var m m_1 P P_1 c e W R k d n l gy_obs gp_obs y dA P2 c2;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m_1(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c2(+1)*P2(+1)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P_1(-1))*m_1(-1)/dA;
P2 = P(+1);
c2 = c(+1);
m_1 = m;
P_1 = P;
end;
initval;
m = mst;
m_1=mst;
P = 2.25;
P_1 = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
P2=P;
c2=c;
end;
vcov = [0.014, 0;0, 0.005];

View File

@ -1,87 +1,87 @@
/* Checks that, for order = 2, k_order_solver = 0 (fs2000k2a)
and k_order_solver = 1 (this file) give the same results */
var m P c e W R k d n l gy_obs gp_obs y dA ;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model (use_dll);
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=2,k_order_solver,periods=1000);
if ~exist('fs2000k2a_results.mat','file');
error('fs2000k2a must be run first');
end;
oo1 = load('fs2000k2a_results','oo_');
dr0 = oo1.oo_.dr;
dr = oo_.dr;
if max(max(abs(dr0.ghx - dr.ghx))) > 1e-12;
error('error in ghx');
end;
if max(max(abs(dr0.ghu - dr.ghu))) > 1e-12;
error('error in ghu');
end;
if max(max(abs(dr0.ghxx - dr.ghxx))) > 1e-12;
error('error in ghxx');
end;
if max(max(abs(dr0.ghuu - dr.ghuu))) > 1e-12;
error('error in ghuu');
end;
if max(max(abs(dr0.ghxu - dr.ghxu))) > 1e-12;
error('error in ghxu');
end;
if max(max(abs(dr0.ghs2 - dr.ghs2))) > 1e-12;
error('error in ghs2');
end;
/* Checks that, for order = 2, k_order_solver = 0 (fs2000k2a)
and k_order_solver = 1 (this file) give the same results */
var m P c e W R k d n l gy_obs gp_obs y dA ;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model (use_dll);
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=2,k_order_solver,periods=1000);
if ~exist('fs2000k2a_results.mat','file');
error('fs2000k2a must be run first');
end;
oo1 = load('fs2000k2a_results','oo_');
dr0 = oo1.oo_.dr;
dr = oo_.dr;
if max(max(abs(dr0.ghx - dr.ghx))) > 1e-12;
error('error in ghx');
end;
if max(max(abs(dr0.ghu - dr.ghu))) > 1e-12;
error('error in ghu');
end;
if max(max(abs(dr0.ghxx - dr.ghxx))) > 1e-12;
error('error in ghxx');
end;
if max(max(abs(dr0.ghuu - dr.ghuu))) > 1e-12;
error('error in ghuu');
end;
if max(max(abs(dr0.ghxu - dr.ghxu))) > 1e-12;
error('error in ghxu');
end;
if max(max(abs(dr0.ghs2 - dr.ghs2))) > 1e-12;
error('error in ghs2');
end;

View File

@ -1,60 +1,60 @@
/* Checks that, for order = 2, k_order_solver = 0 (this file)
and k_order_solver = 1 (fs2000k2) give the same results */
var m P c e W R k d n l gy_obs gp_obs y dA ;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=2);
/* Checks that, for order = 2, k_order_solver = 0 (this file)
and k_order_solver = 1 (fs2000k2) give the same results */
var m P c e W R k d n l gy_obs gp_obs y dA ;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=2);

View File

@ -1,80 +1,80 @@
// checks whether second order coefficients are the same with order=2 and order=3 with k_order_solver=1
var m P c e W R k d n l gy_obs gp_obs y dA ;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model (use_dll);
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=3,periods=1000);
if ~exist('fs2000k2a_results.mat','file');
error('fs2000k2a must be run first');
end;
oo1 = load('fs2000k2a_results','oo_');
dr0 = oo1.oo_.dr;
dr = oo_.dr;
if max(max(abs(dr0.ghxx - dr.ghxx))) > 1e-12;
error('error in ghxx');
end;
if max(max(abs(dr0.ghuu - dr.ghuu))) > 1e-12;
error('error in ghuu');
end;
if max(max(abs(dr0.ghxu - dr.ghxu))) > 1e-12;
error('error in ghxu');
end;
if max(max(abs(dr0.ghs2 - dr.ghs2))) > 1e-12;
error('error in ghs2');
end;
// checks whether second order coefficients are the same with order=2 and order=3 with k_order_solver=1
var m P c e W R k d n l gy_obs gp_obs y dA ;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model (use_dll);
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=3,periods=1000);
if ~exist('fs2000k2a_results.mat','file');
error('fs2000k2a must be run first');
end;
oo1 = load('fs2000k2a_results','oo_');
dr0 = oo1.oo_.dr;
dr = oo_.dr;
if max(max(abs(dr0.ghxx - dr.ghxx))) > 1e-12;
error('error in ghxx');
end;
if max(max(abs(dr0.ghuu - dr.ghuu))) > 1e-12;
error('error in ghuu');
end;
if max(max(abs(dr0.ghxu - dr.ghxu))) > 1e-12;
error('error in ghxu');
end;
if max(max(abs(dr0.ghs2 - dr.ghs2))) > 1e-12;
error('error in ghs2');
end;

View File

@ -1,98 +1,98 @@
/* Checks that, for order = 2 and k_order_solver = 1, a model with 2 leads
and the same model with one lead (using auxiliary vars) give the same result */
var m m_1 P P_1 c e W R k d n l gy_obs gp_obs y dA AUXv;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model(use_dll);
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m_1(-1))+e_m;
-P/(c(+1)*P(+1)*m)+AUXv(+1)=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P_1(-1))*m_1(-1)/dA;
m_1 = m;
P_1 = P;
AUXv = bet*P*(alp*exp(-alp*(gam+log(e)))*k(-1)^(alp-1)*n^(1-alp)+(1-del)*exp(-(gam+log(e))))/(c(+1)*P(+1)*m);
end;
initval;
m = mst;
m_1=mst;
P = 2.25;
P_1 = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
AUXv = 1;
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=2,k_order_solver,irf=0);
if ~exist('fs2000k2_results.mat','file');
error('fs2000k2 must be run first');
end;
oo1 = load('fs2000k2_results','oo_');
dr0 = oo1.oo_.dr;
dr = oo_.dr;
ikr = [2:10 1 13:17];
ikc = [1 3 4 2];
ikc2 = [1 3 4 2 9 11 12 10 13 15 16 14 5 7 8 6];
ikc2u = [1 2 5 6 7 8 3 4];
if max(max(abs(dr0.ghx - dr.ghx(ikr,ikc)))) > 1e-12;
error('error in ghx');
end;
if max(max(abs(dr0.ghu - dr.ghu(ikr,:)))) > 1e-12;
error('error in ghu');
end;
if max(max(abs(dr0.ghxx - dr.ghxx(ikr,ikc2)))) > 1e-12;
error('error in ghxx');
end;
if max(max(abs(dr0.ghuu - dr.ghuu(ikr,:)))) > 1e-12;
error('error in ghuu');
end;
if max(max(abs(dr0.ghxu - dr.ghxu(ikr,ikc2u)))) > 1e-12;
error('error in ghxu');
end;
if max(max(abs(dr0.ghs2 - dr.ghs2(ikr,:)))) > 1e-12;
error('error in ghs2');
end;
/* Checks that, for order = 2 and k_order_solver = 1, a model with 2 leads
and the same model with one lead (using auxiliary vars) give the same result */
var m m_1 P P_1 c e W R k d n l gy_obs gp_obs y dA AUXv;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model(use_dll);
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m_1(-1))+e_m;
-P/(c(+1)*P(+1)*m)+AUXv(+1)=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P_1(-1))*m_1(-1)/dA;
m_1 = m;
P_1 = P;
AUXv = bet*P*(alp*exp(-alp*(gam+log(e)))*k(-1)^(alp-1)*n^(1-alp)+(1-del)*exp(-(gam+log(e))))/(c(+1)*P(+1)*m);
end;
initval;
m = mst;
m_1=mst;
P = 2.25;
P_1 = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
k = 6;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
AUXv = 1;
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady;
stoch_simul(order=2,k_order_solver,irf=0);
if ~exist('fs2000k2_results.mat','file');
error('fs2000k2 must be run first');
end;
oo1 = load('fs2000k2_results','oo_');
dr0 = oo1.oo_.dr;
dr = oo_.dr;
ikr = [2:10 1 13:17];
ikc = [1 3 4 2];
ikc2 = [1 3 4 2 9 11 12 10 13 15 16 14 5 7 8 6];
ikc2u = [1 2 5 6 7 8 3 4];
if max(max(abs(dr0.ghx - dr.ghx(ikr,ikc)))) > 1e-12;
error('error in ghx');
end;
if max(max(abs(dr0.ghu - dr.ghu(ikr,:)))) > 1e-12;
error('error in ghu');
end;
if max(max(abs(dr0.ghxx - dr.ghxx(ikr,ikc2)))) > 1e-12;
error('error in ghxx');
end;
if max(max(abs(dr0.ghuu - dr.ghuu(ikr,:)))) > 1e-12;
error('error in ghuu');
end;
if max(max(abs(dr0.ghxu - dr.ghxu(ikr,ikc2u)))) > 1e-12;
error('error in ghxu');
end;
if max(max(abs(dr0.ghs2 - dr.ghs2(ikr,:)))) > 1e-12;
error('error in ghs2');
end;

View File

@ -1,53 +1,53 @@
var z dw dx dy dc1 dc2;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
end;
varobs dw dx dy z;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo1_mode);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(6,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.dy d.z];
var z dw dx dy dc1 dc2;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
end;
varobs dw dx dy z;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo1_mode);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(6,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.dy d.z];
disp(max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])))));

View File

@ -1,81 +1,81 @@
var z dw dx dy dc1 dc2;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
end;
varobs dw dx dy z;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,kalman_algo=2);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo1_mode,kalman_algo=2);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(6,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.dy d.z];
disp(max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])))));
o1 = load('algo1_results');
obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'};
obj_exo = {'SmoothedShocks';};
nobj_endo = size(obj_endo,1);
nobj_exo = size(obj_exo,1);
for i=1:nobj_endo;
err_endo = zeros(eval(['size(oo_.' obj_endo{i} '.' M_.endo_names(1,:) ',1);']),M_.endo_nbr);
for j=1:M_.endo_nbr;
var1 = eval(['o1.oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
err_endo(:,j) = var1-var2;
end;
disp(max(max(abs(err_endo))));
end;
err_exo = zeros(200,M_.exo_nbr,nobj_exo);
for i=1:nobj_exo;
err_exo = zeros(size(eval(['oo_.' obj_exo{i} '.' M_.exo_names(1,:)]),1),M_.exo_nbr);
for j=1:M_.exo_nbr;
var1 = eval(['o1.oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
err_exo(:,j,i) = var1 - var2;
end;
disp(max(max(abs(err_exo))));
end;
disp(max(max(max(abs(err_exo)))));
var z dw dx dy dc1 dc2;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
end;
varobs dw dx dy z;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,kalman_algo=2);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo1_mode,kalman_algo=2);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(6,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.dy d.z];
disp(max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])))));
o1 = load('algo1_results');
obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'};
obj_exo = {'SmoothedShocks';};
nobj_endo = size(obj_endo,1);
nobj_exo = size(obj_exo,1);
for i=1:nobj_endo;
err_endo = zeros(eval(['size(oo_.' obj_endo{i} '.' M_.endo_names(1,:) ',1);']),M_.endo_nbr);
for j=1:M_.endo_nbr;
var1 = eval(['o1.oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
err_endo(:,j) = var1-var2;
end;
disp(max(max(abs(err_endo))));
end;
err_exo = zeros(200,M_.exo_nbr,nobj_exo);
for i=1:nobj_exo;
err_exo = zeros(size(eval(['oo_.' obj_exo{i} '.' M_.exo_names(1,:)]),1),M_.exo_nbr);
for j=1:M_.exo_nbr;
var1 = eval(['o1.oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
err_exo(:,j,i) = var1 - var2;
end;
disp(max(max(abs(err_exo))));
end;
disp(max(max(max(abs(err_exo)))));

View File

@ -1,56 +1,56 @@
var z dw dx dy dc1 dc2 w x y;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
w = w(-1) + dw;
x = x(-1) + dx;
y = y(-1) + dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, inv_gamma_pdf,0.01, inf;
end;
varobs w x y;
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter);
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(M_.endo_nbr,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.w d.x d.y];
var z dw dx dy dc1 dc2 w x y;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
w = w(-1) + dw;
x = x(-1) + dx;
y = y(-1) + dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, inv_gamma_pdf,0.01, inf;
end;
varobs w x y;
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter);
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(M_.endo_nbr,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.w d.x d.y];
disp(max(max(abs(dat(1000:1199,:)-S(:,[7:9])))));

View File

@ -1,84 +1,84 @@
var z dw dx dy dc1 dc2 w x y;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
w = w(-1) + dw;
x = x(-1) + dx;
y = y(-1) + dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, inv_gamma_pdf,0.01, inf;
end;
varobs w x y;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter,kalman_algo=4);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(M_.endo_nbr,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.w d.x d.y];
disp(max(max(abs(dat(1000:1199,:)-S(:,[7:9])))));
o1 = load('algo3_results');
obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'};
obj_exo = {'SmoothedShocks';};
nobj_endo = size(obj_endo,1);
nobj_exo = size(obj_exo,1);
for i=1:nobj_endo;
err_endo = zeros(eval(['size(oo_.' obj_endo{i} '.' M_.endo_names(1,:) ',1);']),M_.endo_nbr);
for j=1:M_.endo_nbr;
var1 = eval(['o1.oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
err_endo(:,j) = var1-var2;
end;
disp(max(max(abs(err_endo))));
end;
err_exo = zeros(200,M_.exo_nbr,nobj_exo);
for i=1:nobj_exo;
err_exo = zeros(size(eval(['oo_.' obj_exo{i} '.' M_.exo_names(1,:)]),1),M_.exo_nbr);
for j=1:M_.exo_nbr;
var1 = eval(['o1.oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
err_exo(:,j,i) = var1 - var2;
end;
disp(max(max(abs(err_exo))));
end;
disp(max(max(max(abs(err_exo)))));
var z dw dx dy dc1 dc2 w x y;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
w = w(-1) + dw;
x = x(-1) + dx;
y = y(-1) + dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, inv_gamma_pdf,0.01, inf;
end;
varobs w x y;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter,kalman_algo=4);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(M_.endo_nbr,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.w d.x d.y];
disp(max(max(abs(dat(1000:1199,:)-S(:,[7:9])))));
o1 = load('algo3_results');
obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'};
obj_exo = {'SmoothedShocks';};
nobj_endo = size(obj_endo,1);
nobj_exo = size(obj_exo,1);
for i=1:nobj_endo;
err_endo = zeros(eval(['size(oo_.' obj_endo{i} '.' M_.endo_names(1,:) ',1);']),M_.endo_nbr);
for j=1:M_.endo_nbr;
var1 = eval(['o1.oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
err_endo(:,j) = var1-var2;
end;
disp(max(max(abs(err_endo))));
end;
err_exo = zeros(200,M_.exo_nbr,nobj_exo);
for i=1:nobj_exo;
err_exo = zeros(size(eval(['oo_.' obj_exo{i} '.' M_.exo_names(1,:)]),1),M_.exo_nbr);
for j=1:M_.exo_nbr;
var1 = eval(['o1.oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
err_exo(:,j,i) = var1 - var2;
end;
disp(max(max(abs(err_exo))));
end;
disp(max(max(max(abs(err_exo)))));

View File

@ -1,54 +1,54 @@
var z dw dx dy dc1 dc2 y;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
y = y(-1) + dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
end;
varobs dw dx y z;
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter);
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.y];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(M_.endo_nbr,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.y d.z];
var z dw dx dy dc1 dc2 y;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
y = y(-1) + dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
end;
varobs dw dx y z;
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter);
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.y];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(M_.endo_nbr,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.y d.z];
disp(max(max(abs(dat(1000:1199,:)-S(:,[2 3 7 1])))));

View File

@ -1,57 +1,57 @@
var z dw dx dy dc1 dc2;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
stderr z, normal_pdf, 0, 0.1;
end;
varobs dw dx dy z;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algoH1_mode);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(6,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.dy d.z];
X = oo_.SmoothedMeasurementErrors;
ME = [X.dw X.dx X.dy X.z];
var z dw dx dy dc1 dc2;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
stderr z, normal_pdf, 0, 0.1;
end;
varobs dw dx dy z;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algoH1_mode);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(6,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.dy d.z];
X = oo_.SmoothedMeasurementErrors;
ME = [X.dw X.dx X.dy X.z];
disp(max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])-ME))));

View File

@ -1,87 +1,87 @@
var z dw dx dy dc1 dc2;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
stderr z, normal_pdf, 0, 0.1;
end;
varobs dw dx dy z;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,kalman_algo=2);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algoH1_mode,kalman_algo=2);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(6,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.dy d.z];
X = oo_.SmoothedMeasurementErrors;
ME = [X.dw X.dx X.dy X.z];
disp(max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])-ME))));
o1 = load('algoH1_results');
obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'};
obj_exo = {'SmoothedShocks';};
nobj_endo = size(obj_endo,1);
nobj_exo = size(obj_exo,1);
for i=1:nobj_endo;
err_endo = zeros(eval(['size(oo_.' obj_endo{i} '.' M_.endo_names(1,:) ',1);']),M_.endo_nbr);
for j=1:M_.endo_nbr;
var1 = eval(['o1.oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
err_endo(:,j) = var1-var2;
end;
disp(max(max(abs(err_endo))));
end;
err_exo = zeros(200,M_.exo_nbr,nobj_exo);
for i=1:nobj_exo;
err_exo = zeros(size(eval(['oo_.' obj_exo{i} '.' M_.exo_names(1,:)]),1),M_.exo_nbr);
for j=1:M_.exo_nbr;
var1 = eval(['o1.oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
err_exo(:,j,i) = var1 - var2;
end;
disp(max(max(abs(err_exo))));
end;
disp(max(max(max(abs(err_exo)))));
var z dw dx dy dc1 dc2;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, uniform_pdf,,, 0.01, 0.1;
stderr z, normal_pdf, 0, 0.1;
end;
varobs dw dx dy z;
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,kalman_algo=2);
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algoH1_mode,kalman_algo=2);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(6,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.dw d.dx d.dy d.z];
X = oo_.SmoothedMeasurementErrors;
ME = [X.dw X.dx X.dy X.z];
disp(max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])-ME))));
o1 = load('algoH1_results');
obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'};
obj_exo = {'SmoothedShocks';};
nobj_endo = size(obj_endo,1);
nobj_exo = size(obj_exo,1);
for i=1:nobj_endo;
err_endo = zeros(eval(['size(oo_.' obj_endo{i} '.' M_.endo_names(1,:) ',1);']),M_.endo_nbr);
for j=1:M_.endo_nbr;
var1 = eval(['o1.oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]);
err_endo(:,j) = var1-var2;
end;
disp(max(max(abs(err_endo))));
end;
err_exo = zeros(200,M_.exo_nbr,nobj_exo);
for i=1:nobj_exo;
err_exo = zeros(size(eval(['oo_.' obj_exo{i} '.' M_.exo_names(1,:)]),1),M_.exo_nbr);
for j=1:M_.exo_nbr;
var1 = eval(['o1.oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]);
err_exo(:,j,i) = var1 - var2;
end;
disp(max(max(abs(err_exo))));
end;
disp(max(max(max(abs(err_exo)))));
disp(max(max(abs(o1.oo_.SmoothedMeasurementErrors.z - oo_.SmoothedMeasurementErrors.z))));

View File

@ -1,62 +1,62 @@
var z dw dx dy dc1 dc2 w x y;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
w = w(-1) + dw;
x = x(-1) + dx;
y = y(-1) + dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, inv_gamma_pdf,0.01, inf;
stderr w, inv_gamma_pdf, 0.01,inf;
end;
varobs w x y;
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter);
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter);
stoch_simul(irf=0);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(M_.endo_nbr,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.w d.x d.y];
X = oo_.SmoothedMeasurementErrors;
ME = [X.w X.x X.y];
var z dw dx dy dc1 dc2 w x y;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
model(linear);
dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w;
dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x;
dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
dc1 = dc1(-1)+dx-b*dy-c*dw;
dc2 = dc2(-1)+dx-b*dy;
w = w(-1) + dw;
x = x(-1) + dx;
y = y(-1) + dy;
end;
estimated_params;
rho_w, normal_pdf, 0.5,0.2;
rho_x, normal_pdf, 0.5,0.2;
rho_y, normal_pdf, 0.5,0.2;
rho_z, normal_pdf, 0.8,0.2;
a1, normal_pdf, 0.1,0.2;
a2, normal_pdf, -0.1,0.2;
a3, normal_pdf, 0.1,0.2;
b , normal_pdf, 1,0.2;
c , normal_pdf, 1,0.2;
stderr e_w, uniform_pdf,,, 0.01, 0.1;
stderr e_x, uniform_pdf,,, 0.01, 0.1;
stderr e_y, uniform_pdf,,, 0.01, 0.1;
stderr e_z, inv_gamma_pdf,0.01, inf;
stderr w, inv_gamma_pdf, 0.01,inf;
end;
varobs w x y;
estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter);
//estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter);
stoch_simul(irf=0);
//checking smoother consistency
X = oo_.SmoothedVariables;
S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y];
X = oo_.SmoothedShocks;
E = [X.e_w X.e_x X.e_y X.e_z];
A = oo_.dr.ghx;
B = oo_.dr.ghu;
err = zeros(M_.endo_nbr,200);
for t=2:200;
err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)';
end;
disp(max(max(abs(err))));
d=load('data');
dat = [d.w d.x d.y];
X = oo_.SmoothedMeasurementErrors;
ME = [X.w X.x X.y];
disp(max(max(abs(dat(1000:1199,:)-S(:,[7:9])-ME))));

View File

@ -1,38 +1,38 @@
var w x y z dw dx dy;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
rho_w = 0.5;
rho_x = 0.5;
rho_y = 0.5;
rho_z = 0.8;
a1 = 0.1;
a2 = -0.1;
a3 = 0.1;
b = 1;
c = 1;
model(linear);
dw = rho_w*dw(-1)+a1*(x(-1)-b*y(-1)-c*w(-1))+e_w;
dx = rho_x*dx(-1)+a2*(x(-1)-b*y(-1)-c*w(-1))+e_x;
dy = rho_y*dy(-1)+a3*(x(-1)-b*y(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
w = w(-1)+dw;
x = x(-1)+dx;
y = y(-1)+dy;
end;
shocks;
var e_w; stderr 0.05;
var e_x; stderr 0.05;
var e_y; stderr 0.05;
var e_z; stderr 0.05;
end;
stoch_simul(periods=2000,irf=0,simul_seed=7);
plot([w x y z]);
var w x y z dw dx dy;
varexo e_w e_x e_y e_z;
parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
rho_w = 0.5;
rho_x = 0.5;
rho_y = 0.5;
rho_z = 0.8;
a1 = 0.1;
a2 = -0.1;
a3 = 0.1;
b = 1;
c = 1;
model(linear);
dw = rho_w*dw(-1)+a1*(x(-1)-b*y(-1)-c*w(-1))+e_w;
dx = rho_x*dx(-1)+a2*(x(-1)-b*y(-1)-c*w(-1))+e_x;
dy = rho_y*dy(-1)+a3*(x(-1)-b*y(-1))+e_y;
z = rho_z*z(-1)+dw-dx+e_z;
w = w(-1)+dw;
x = x(-1)+dx;
y = y(-1)+dy;
end;
shocks;
var e_w; stderr 0.05;
var e_x; stderr 0.05;
var e_y; stderr 0.05;
var e_z; stderr 0.05;
end;
stoch_simul(periods=2000,irf=0,simul_seed=7);
plot([w x y z]);
save data w x y z dw dx dy;

View File

@ -1,65 +1,65 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
estimation(datafile=data_ca1,first_obs=8,nobs=79,mh_nblocks=10,prefilter=1,mh_jscale=0.5,mh_replic=0);
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
estimation(datafile=data_ca1,first_obs=8,nobs=79,mh_nblocks=10,prefilter=1,mh_jscale=0.5,mh_replic=0);

View File

@ -1,65 +1,65 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
estimation(datafile=data_ca1,first_obs=8,nobs=79,mh_nblocks=10,prefilter=1,mh_jscale=0.5,mh_replic=0);
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
estimation(datafile=data_ca1,first_obs=8,nobs=79,mh_nblocks=10,prefilter=1,mh_jscale=0.5,mh_replic=0);

View File

@ -1,33 +1,33 @@
periods 20000;
var c k a;
varexo e;
parameters alpha beta delta gamma rho;
beta = 0.95;
delta = 1;
alpha = 0.3;
rho = 0;
gamma = 2;
model;
exp(c) + exp(k) = (1-delta) * exp(k(-1)) + exp(a) * exp(k(-1))^alpha;
exp(c)^(-gamma) = beta * exp(c(+1))^(-gamma) * (exp(a(+1)) * alpha * exp(k)^(alpha-1) + 1 - delta);
a = rho * a(-1) + e;
end;
initval;
k=0;
c=0;
a=0;
e=0;
end;
Sigma_e_ = 1;
stoch_simul(nomoments,irf=0,nocorr,ar=0);
global dr_
dr_obj_ = dr_;
save sgu_ex1 dr_obj_;
periods 20000;
var c k a;
varexo e;
parameters alpha beta delta gamma rho;
beta = 0.95;
delta = 1;
alpha = 0.3;
rho = 0;
gamma = 2;
model;
exp(c) + exp(k) = (1-delta) * exp(k(-1)) + exp(a) * exp(k(-1))^alpha;
exp(c)^(-gamma) = beta * exp(c(+1))^(-gamma) * (exp(a(+1)) * alpha * exp(k)^(alpha-1) + 1 - delta);
a = rho * a(-1) + e;
end;
initval;
k=0;
c=0;
a=0;
e=0;
end;
Sigma_e_ = 1;
stoch_simul(nomoments,irf=0,nocorr,ar=0);
global dr_
dr_obj_ = dr_;
save sgu_ex1 dr_obj_;

View File

@ -1,97 +1,97 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
// common syntax for win and unix, for local parallel runs (assuming quad-core):
// all empty fields, except Local and NumCPU
options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','');
// windows syntax for remote runs (Local=0):
// win passwd has to be typed explicitly!
// RemoteDrive has to be yped explicitly!
// for user, ALSO the group has to be specified, like ISIS\rattoma, i.e. user rattoma in group ISIS
// PcName is the name of the computed in the windows network, i.e. the output of hostname, or the full IP adress
//options_.parallel=struct('Local', 0, 'PcName','iazz9000','NumCPU', [4:6], 'user','ISIS\rattoma','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
// example to use several remote PC's to build a grid on windows:
//options_.parallel=struct('Local', 0, 'PcName','iazz9000','NumCPU', [0:3], 'user','ISIS\azziniv','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
//options_.parallel(2)=struct('Local', 0, 'PcName','paperino','NumCPU', [0:3], 'user','ISIS\azziniv','passwd','****', 'RemoteDrive', 'D', 'RemoteFolder','dynare_calcs\Remote');
//options_.parallel(3)=struct('Local', 0, 'PcName','didietro','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', ppp(1), 'RemoteFolder',ppp(4:end));
//options_.parallel(4)=struct('Local', 0, 'PcName','uasalap29','NumCPU', [0:1], 'user','ISIS\rattoma','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
//options_.parallel(5)=struct('Local', 0, 'PcName','brigitta','NumCPU', [0:3], 'user','ISIS\azziniv','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
// unix syntax for remote runs (Local=0):
// no passwd and RemoteDrive needed!
// PcName: full IP address or address
//options_.parallel=struct('Local', 0, 'PcName','paperino.jrc.it','NumCPU', [0:3], 'user','rattoma','passwd','', 'RemoteDrive', '', 'RemoteFolder','/home/rattoma/Remote');
// example to combine local and remote runs (on unix):
//options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','');
//options_.parallel(2)=struct('Local', 0, 'PcName','paperino.jrc.it','NumCPU', [0:3], 'user','rattoma','passwd','', 'RemoteDrive', '', 'RemoteFolder','/home/rattoma/Remote');
// example to combine local and remote runs (on win):
//options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','');
//options_.parallel(2)=struct('Local', 0, 'PcName','uasalap29','NumCPU', [0:1], 'user','ISIS\rattoma','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
estimation(datafile=data_ca1,first_obs=8,nobs=79,mode_compute=0, mode_file=ls2003_mode, mh_nblocks=4,prefilter=1,mh_jscale=0.5,mh_replic=2000);//, load_mh_file);
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
// common syntax for win and unix, for local parallel runs (assuming quad-core):
// all empty fields, except Local and NumCPU
options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','');
// windows syntax for remote runs (Local=0):
// win passwd has to be typed explicitly!
// RemoteDrive has to be yped explicitly!
// for user, ALSO the group has to be specified, like ISIS\rattoma, i.e. user rattoma in group ISIS
// PcName is the name of the computed in the windows network, i.e. the output of hostname, or the full IP adress
//options_.parallel=struct('Local', 0, 'PcName','iazz9000','NumCPU', [4:6], 'user','ISIS\rattoma','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
// example to use several remote PC's to build a grid on windows:
//options_.parallel=struct('Local', 0, 'PcName','iazz9000','NumCPU', [0:3], 'user','ISIS\azziniv','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
//options_.parallel(2)=struct('Local', 0, 'PcName','paperino','NumCPU', [0:3], 'user','ISIS\azziniv','passwd','****', 'RemoteDrive', 'D', 'RemoteFolder','dynare_calcs\Remote');
//options_.parallel(3)=struct('Local', 0, 'PcName','didietro','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', ppp(1), 'RemoteFolder',ppp(4:end));
//options_.parallel(4)=struct('Local', 0, 'PcName','uasalap29','NumCPU', [0:1], 'user','ISIS\rattoma','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
//options_.parallel(5)=struct('Local', 0, 'PcName','brigitta','NumCPU', [0:3], 'user','ISIS\azziniv','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
// unix syntax for remote runs (Local=0):
// no passwd and RemoteDrive needed!
// PcName: full IP address or address
//options_.parallel=struct('Local', 0, 'PcName','paperino.jrc.it','NumCPU', [0:3], 'user','rattoma','passwd','', 'RemoteDrive', '', 'RemoteFolder','/home/rattoma/Remote');
// example to combine local and remote runs (on unix):
//options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','');
//options_.parallel(2)=struct('Local', 0, 'PcName','paperino.jrc.it','NumCPU', [0:3], 'user','rattoma','passwd','', 'RemoteDrive', '', 'RemoteFolder','/home/rattoma/Remote');
// example to combine local and remote runs (on win):
//options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','');
//options_.parallel(2)=struct('Local', 0, 'PcName','uasalap29','NumCPU', [0:1], 'user','ISIS\rattoma','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
estimation(datafile=data_ca1,first_obs=8,nobs=79,mode_compute=0, mode_file=ls2003_mode, mh_nblocks=4,prefilter=1,mh_jscale=0.5,mh_replic=2000);//, load_mh_file);

View File

@ -1,51 +1,51 @@
var y1, y2, y3, x1, x2, x3;
model;
x1 = 1.96;
x2 = 1;
x3 = 0.5;
y1 = normcdf(x1(-1),0,1);
y2 = normcdf(-x1,-x2,1);
y3 = normcdf(x1/2,0,x3(+1));
end;
initval;
y1 = 0;
y2 = 0;
y3 = 0;
x1 = 0;
x2 = 0;
x3 = 1;
end;
steady;
if abs(oo_.steady_state(1) - pnorm(1.96,0,1)) > 1e-12;
error('Error 1 in t_normcdf')
end;
if abs(oo_.steady_state(2) - pnorm(-1.96,-1,1)) > 1e-12;
error('Error 2 in t_normcdf')
end;
if abs(oo_.steady_state(3) - pnorm(1.96/2,0,1/2)) > 1e-12;
error('Error 3 in t_normcdf')
end;
z = [oo_.steady_state(4); oo_.steady_state; oo_.steady_state(6)];
[junk,JJ] = t_normcdf_dynamic(z,[]);
if abs(JJ(4,1) + dnorm(1.96,0,1)) > 1e-12;
error('Error 4 in t_normcdf')
end;
if abs(JJ(5,5) - dnorm(-1.96,-1,1)) > 1e-12;
error('Error 5 in t_normcdf')
end;
if abs(JJ(5,6) + dnorm(-1.96,-1,1)) > 1e-12;
error('Error 6 in t_normcdf')
end;
if abs(JJ(6,5) + dnorm(1.96/2,0,1/2)/2) > 1e-12;
error('Error 7 in t_normcdf')
end;
if abs(JJ(6,8) - (1/2)*((1.96/2)/(1/2)^2)*dnorm(1.96/2,0,1/2)) > 1e-12;
error('Error 8 in t_normcdf')
end;
var y1, y2, y3, x1, x2, x3;
model;
x1 = 1.96;
x2 = 1;
x3 = 0.5;
y1 = normcdf(x1(-1),0,1);
y2 = normcdf(-x1,-x2,1);
y3 = normcdf(x1/2,0,x3(+1));
end;
initval;
y1 = 0;
y2 = 0;
y3 = 0;
x1 = 0;
x2 = 0;
x3 = 1;
end;
steady;
if abs(oo_.steady_state(1) - pnorm(1.96,0,1)) > 1e-12;
error('Error 1 in t_normcdf')
end;
if abs(oo_.steady_state(2) - pnorm(-1.96,-1,1)) > 1e-12;
error('Error 2 in t_normcdf')
end;
if abs(oo_.steady_state(3) - pnorm(1.96/2,0,1/2)) > 1e-12;
error('Error 3 in t_normcdf')
end;
z = [oo_.steady_state(4); oo_.steady_state; oo_.steady_state(6)];
[junk,JJ] = t_normcdf_dynamic(z,[]);
if abs(JJ(4,1) + dnorm(1.96,0,1)) > 1e-12;
error('Error 4 in t_normcdf')
end;
if abs(JJ(5,5) - dnorm(-1.96,-1,1)) > 1e-12;
error('Error 5 in t_normcdf')
end;
if abs(JJ(5,6) + dnorm(-1.96,-1,1)) > 1e-12;
error('Error 6 in t_normcdf')
end;
if abs(JJ(6,5) + dnorm(1.96/2,0,1/2)/2) > 1e-12;
error('Error 7 in t_normcdf')
end;
if abs(JJ(6,8) - (1/2)*((1.96/2)/(1/2)^2)*dnorm(1.96/2,0,1/2)) > 1e-12;
error('Error 8 in t_normcdf')
end;

View File

@ -1,90 +1,90 @@
var y a k c i h eoy eoc eoh oy oc oh;
varexo e eeoy eeoc eeoh;
parameters theta rho eta gam bet delta aa r11 r12 r13 r21 r22 r23 r31 r32 r33 scy shc shy;
bet = 0.99;
delta = 0.025;
theta = 0.2;
rho = 0.9959;
eta = 1.0051;
gam = 0.0045;
aa = 1.8;
r11 = 0.99;
r12 = 0;
r13 = 0;
r21 = 0;
r22 = 0.99;
r23 = 0;
r31 = 0;
r32 = 0;
r33 = 0.99;
scy = 0.0040;
shy = 0.0015;
shc = 0.0010;
model;
exp(y) = exp(a)*exp(k(-1))^theta*exp(h)^(1-theta);
a = (1-rho)*aa+rho*a(-1)+e;
exp(y) = exp(c) + exp(i);
eta*exp(k) = (1-delta)*exp(k(-1))+exp(i);
gam*exp(c)*exp(h) = (1-theta)*exp(y);
eta/exp(c) = bet*(1/exp(c(+1)))*(theta*(exp(y(+1))/exp(k))+1-delta);
eoy = r11*eoy(-1) + r12*eoc(-1) + r13*eoh(-1) + eeoy;
eoc = r21*eoy(-1) + r22*eoc(-1) + r23*eoh(-1) + scy*eeoy+eeoc;
eoh = r31*eoy(-1) + r32*eoc(-1) + r33*eoh(-1) + shy*eeoy+shc*eeoc+eeoh;
oy = y + eoy;
oc = c + eoc;
oh = h + eoh;
end;
initval;
a = 1.7;
y = 8;
c = 8;
k = 10;
i = 5;
h = 4;
eoy = 0;
eoc = 0;
eoh = 0;
oy = y;
oc = c;
oh = h;
end;
steady;
check;
estimated_params;
theta , 0.22, 0.1, 0.5;
rho , 0.99, 0.7, 0.9999;
eta , 1.0051, 1, 1.03;
gam , 0.0045, 0.001, 0.01;
aa , 1.8, 0.1, 4;
r11 , 1.4187, -2, 2;
r12 , 0.2251, -2, 2;
r13 , -0.4441, -2, 2;
r21 , 0.0935, -2, 2;
r22 , 1.0236, -2, 2;
r23 , -0.0908, -2, 2;
r31 , 0.7775, -2, 2;
r32 , 0.3706, -2, 2;
r33 , 0.2398, -2, 2;
scy , 0.0040, -2, 2;
shy , 0.0015, -2, 2;
shc , 0.0010, -2, 2;
stderr e , 0.0056, 0, 0.2;
stderr eeoy , 0.0070, 0, 0.1;
stderr eeoc , 0.0069, 0, 0.1;
stderr eeoh , 0.0018, 0, 0.1;
end;
varobs oy oc oh;
observation_trends;
oy (log(eta));
oc (log(eta));
end;
var y a k c i h eoy eoc eoh oy oc oh;
varexo e eeoy eeoc eeoh;
parameters theta rho eta gam bet delta aa r11 r12 r13 r21 r22 r23 r31 r32 r33 scy shc shy;
bet = 0.99;
delta = 0.025;
theta = 0.2;
rho = 0.9959;
eta = 1.0051;
gam = 0.0045;
aa = 1.8;
r11 = 0.99;
r12 = 0;
r13 = 0;
r21 = 0;
r22 = 0.99;
r23 = 0;
r31 = 0;
r32 = 0;
r33 = 0.99;
scy = 0.0040;
shy = 0.0015;
shc = 0.0010;
model;
exp(y) = exp(a)*exp(k(-1))^theta*exp(h)^(1-theta);
a = (1-rho)*aa+rho*a(-1)+e;
exp(y) = exp(c) + exp(i);
eta*exp(k) = (1-delta)*exp(k(-1))+exp(i);
gam*exp(c)*exp(h) = (1-theta)*exp(y);
eta/exp(c) = bet*(1/exp(c(+1)))*(theta*(exp(y(+1))/exp(k))+1-delta);
eoy = r11*eoy(-1) + r12*eoc(-1) + r13*eoh(-1) + eeoy;
eoc = r21*eoy(-1) + r22*eoc(-1) + r23*eoh(-1) + scy*eeoy+eeoc;
eoh = r31*eoy(-1) + r32*eoc(-1) + r33*eoh(-1) + shy*eeoy+shc*eeoc+eeoh;
oy = y + eoy;
oc = c + eoc;
oh = h + eoh;
end;
initval;
a = 1.7;
y = 8;
c = 8;
k = 10;
i = 5;
h = 4;
eoy = 0;
eoc = 0;
eoh = 0;
oy = y;
oc = c;
oh = h;
end;
steady;
check;
estimated_params;
theta , 0.22, 0.1, 0.5;
rho , 0.99, 0.7, 0.9999;
eta , 1.0051, 1, 1.03;
gam , 0.0045, 0.001, 0.01;
aa , 1.8, 0.1, 4;
r11 , 1.4187, -2, 2;
r12 , 0.2251, -2, 2;
r13 , -0.4441, -2, 2;
r21 , 0.0935, -2, 2;
r22 , 1.0236, -2, 2;
r23 , -0.0908, -2, 2;
r31 , 0.7775, -2, 2;
r32 , 0.3706, -2, 2;
r33 , 0.2398, -2, 2;
scy , 0.0040, -2, 2;
shy , 0.0015, -2, 2;
shc , 0.0010, -2, 2;
stderr e , 0.0056, 0, 0.2;
stderr eeoy , 0.0070, 0, 0.1;
stderr eeoc , 0.0069, 0, 0.1;
stderr eeoh , 0.0018, 0, 0.1;
end;
varobs oy oc oh;
observation_trends;
oy (log(eta));
oc (log(eta));
end;
estimation(datafile=idata,mode_compute=1,nograph);

View File

@ -1,90 +1,90 @@
var y a k c i h eoy eoc eoh oy oc oh;
varexo e eeoy eeoc eeoh;
parameters theta rho eta gam bet delta aa r11 r12 r13 r21 r22 r23 r31 r32 r33 scy shc shy;
bet = 0.99;
delta = 0.025;
theta = 0.2;
rho = 0.9959;
eta = 1.0051;
gam = 0.0045;
aa = 1.8;
r11 = 0.99;
r12 = 0;
r13 = 0;
r21 = 0;
r22 = 0.99;
r23 = 0;
r31 = 0;
r32 = 0;
r33 = 0.99;
scy = 0.0040;
shy = 0.0015;
shc = 0.0010;
model;
exp(y) = exp(a)*exp(k(-1))^theta*exp(h)^(1-theta);
a = (1-rho)*aa+rho*a(-1)+e;
exp(y) = exp(c) + exp(i);
eta*exp(k) = (1-delta)*exp(k(-1))+exp(i);
gam*exp(c)*exp(h) = (1-theta)*exp(y);
eta/exp(c) = bet*(1/exp(c(+1)))*(theta*(exp(y(+1))/exp(k))+1-delta);
eoy = r11*eoy(-1) + r12*eoc(-1) + r13*eoh(-1) + eeoy;
eoc = r21*eoy(-1) + r22*eoc(-1) + r23*eoh(-1) + scy*eeoy+eeoc;
eoh = r31*eoy(-1) + r32*eoc(-1) + r33*eoh(-1) + shy*eeoy+shc*eeoc+eeoh;
oy = y + eoy;
oc = c + eoc;
oh = h + eoh;
end;
initval;
a = 6;
y = 8;
c = 7;
k = 10;
i = 5;
h = 4;
eoy = 0;
eoc = 0;
eoh = 0;
oy = y;
oc = c;
oh = h;
end;
steady;
check;
estimated_params;
theta , 0.22;
rho , 0.99;
eta , 1.0051;
gam , 0.0045;
aa , 1.8;
r11 , 1.4187;
r12 , 0.2251;
r13 , -0.4441;
r21 , 0.0935;
r22 , 1.0236;
r23 , -0.0908;
r31 , 0.7775;
r32 , 0.3706;
r33 , 0.2398;
scy , 0.0040;
shy , 0.0015;
shc , 0.0010;
stderr e , 0.0055;
stderr eeoy , 0.0072;
stderr eeoc , 0.0057;
stderr eeoh , 0;
end;
varobs oy oc oh;
observation_trends;
oy (log(eta));
oc (log(eta));
end;
var y a k c i h eoy eoc eoh oy oc oh;
varexo e eeoy eeoc eeoh;
parameters theta rho eta gam bet delta aa r11 r12 r13 r21 r22 r23 r31 r32 r33 scy shc shy;
bet = 0.99;
delta = 0.025;
theta = 0.2;
rho = 0.9959;
eta = 1.0051;
gam = 0.0045;
aa = 1.8;
r11 = 0.99;
r12 = 0;
r13 = 0;
r21 = 0;
r22 = 0.99;
r23 = 0;
r31 = 0;
r32 = 0;
r33 = 0.99;
scy = 0.0040;
shy = 0.0015;
shc = 0.0010;
model;
exp(y) = exp(a)*exp(k(-1))^theta*exp(h)^(1-theta);
a = (1-rho)*aa+rho*a(-1)+e;
exp(y) = exp(c) + exp(i);
eta*exp(k) = (1-delta)*exp(k(-1))+exp(i);
gam*exp(c)*exp(h) = (1-theta)*exp(y);
eta/exp(c) = bet*(1/exp(c(+1)))*(theta*(exp(y(+1))/exp(k))+1-delta);
eoy = r11*eoy(-1) + r12*eoc(-1) + r13*eoh(-1) + eeoy;
eoc = r21*eoy(-1) + r22*eoc(-1) + r23*eoh(-1) + scy*eeoy+eeoc;
eoh = r31*eoy(-1) + r32*eoc(-1) + r33*eoh(-1) + shy*eeoy+shc*eeoc+eeoh;
oy = y + eoy;
oc = c + eoc;
oh = h + eoh;
end;
initval;
a = 6;
y = 8;
c = 7;
k = 10;
i = 5;
h = 4;
eoy = 0;
eoc = 0;
eoh = 0;
oy = y;
oc = c;
oh = h;
end;
steady;
check;
estimated_params;
theta , 0.22;
rho , 0.99;
eta , 1.0051;
gam , 0.0045;
aa , 1.8;
r11 , 1.4187;
r12 , 0.2251;
r13 , -0.4441;
r21 , 0.0935;
r22 , 1.0236;
r23 , -0.0908;
r31 , 0.7775;
r32 , 0.3706;
r33 , 0.2398;
scy , 0.0040;
shy , 0.0015;
shc , 0.0010;
stderr e , 0.0055;
stderr eeoy , 0.0072;
stderr eeoc , 0.0057;
stderr eeoh , 0;
end;
varobs oy oc oh;
observation_trends;
oy (log(eta));
oc (log(eta));
end;
estimation(datafile=idata,nograph);

View File

@ -1,47 +1,47 @@
periods 500;
var dc, dd, v_c, v_d, x;
varexo e_c, e_x, e_d;
parameters DELTA THETA PSI MU_C MU_D RHO_X LAMBDA_DX;
DELTA=.99;
PSI=1.5;
THETA=(1-7.5)/(1-1/PSI);
MU_C=0.0015;
MU_D=0.0015;
RHO_X=.979;
LAMBDA_DX=3;
model;
v_c = DELTA^THETA * exp((-THETA/PSI)*dc(+1) + (THETA-1)*log((1+v_c(+1))*exp(dc(+1))/v_c) ) * (1+v_c(+1))*exp(dc(+1));
v_d = DELTA^THETA * exp((-THETA/PSI)*dc(+1) + (THETA-1)*log((1+v_c(+1))*exp(dc(+1))/v_c) ) * (1+v_d(+1))*exp(dd(+1));
dc = MU_C + x(-1) + e_c;
dd = MU_D + LAMBDA_DX*x(-1) + e_d;
x = RHO_X * x(-1) + e_x;
end;
initval;
v_c=15;
v_d=15;
dc=MU_C;
dd=MU_D;
x=0;
e_c=0;
e_x=0;
e_d=0;
end;
shocks;
var e_c;
stderr .0078;
var e_x;
stderr .0078*.044;
var e_d;
stderr .0078*4.5;
end;
steady(solve_algo=0);
check;
stoch_simul(dr_algo=1, order=1, periods=1000, irf=30);
periods 500;
var dc, dd, v_c, v_d, x;
varexo e_c, e_x, e_d;
parameters DELTA THETA PSI MU_C MU_D RHO_X LAMBDA_DX;
DELTA=.99;
PSI=1.5;
THETA=(1-7.5)/(1-1/PSI);
MU_C=0.0015;
MU_D=0.0015;
RHO_X=.979;
LAMBDA_DX=3;
model;
v_c = DELTA^THETA * exp((-THETA/PSI)*dc(+1) + (THETA-1)*log((1+v_c(+1))*exp(dc(+1))/v_c) ) * (1+v_c(+1))*exp(dc(+1));
v_d = DELTA^THETA * exp((-THETA/PSI)*dc(+1) + (THETA-1)*log((1+v_c(+1))*exp(dc(+1))/v_c) ) * (1+v_d(+1))*exp(dd(+1));
dc = MU_C + x(-1) + e_c;
dd = MU_D + LAMBDA_DX*x(-1) + e_d;
x = RHO_X * x(-1) + e_x;
end;
initval;
v_c=15;
v_d=15;
dc=MU_C;
dd=MU_D;
x=0;
e_c=0;
e_x=0;
e_d=0;
end;
shocks;
var e_c;
stderr .0078;
var e_x;
stderr .0078*.044;
var e_d;
stderr .0078*4.5;
end;
steady(solve_algo=0);
check;
stoch_simul(dr_algo=1, order=1, periods=1000, irf=30);
datasaver('simudata',[]);

View File

@ -1,58 +1,58 @@
var dc, dd, v_c, v_d, x;
varexo e_c, e_x, e_d;
parameters DELTA THETA PSI MU_C MU_D RHO_X LAMBDA_DX;
DELTA=.99;
PSI=1.5;
THETA=(1-7.5)/(1-1/PSI);
MU_C=0.0015;
MU_D=0.0015;
RHO_X=.979;
LAMBDA_DX=3;
model;
v_c = DELTA^THETA * exp((-THETA/PSI)*dc(+1) + (THETA-1)*log((1+v_c(+1))*exp(dc(+1))/v_c) ) * (1+v_c(+1))*exp(dc(+1));
v_d = DELTA^THETA * exp((-THETA/PSI)*dc(+1) + (THETA-1)*log((1+v_c(+1))*exp(dc(+1))/v_c) ) * (1+v_d(+1))*exp(dd(+1));
dc = MU_C + x(-1) + e_c;
dd = MU_D + LAMBDA_DX*x(-1) + e_d;
x = RHO_X * x(-1) + e_x;
end;
initval;
v_c=15;
v_d=15;
dc=MU_C;
dd=MU_D;
x=0;
e_c=0;
e_x=0;
e_d=0;
end;
shocks;
var e_d; stderr .001;
var e_c; stderr .001;
var e_x; stderr .001;
end;
steady;
estimated_params;
DELTA, beta_pdf, 0.98,.005;
THETA,normal_pdf,-19.5, 0.0025;
PSI,normal_pdf,1.6, 0.1;
MU_C,normal_pdf,0.001, 0.001;
MU_D,normal_pdf,0.001, 0.001;
RHO_X,normal_pdf,.98, 0.005;
LAMBDA_DX,normal_pdf,3, 0.05;
stderr e_d,inv_gamma_pdf,.0025, 30;
stderr e_x,inv_gamma_pdf,.0003, 30;
stderr e_c,inv_gamma_pdf,.01, 30;
end;
varobs v_d dd dc;
var dc, dd, v_c, v_d, x;
varexo e_c, e_x, e_d;
parameters DELTA THETA PSI MU_C MU_D RHO_X LAMBDA_DX;
DELTA=.99;
PSI=1.5;
THETA=(1-7.5)/(1-1/PSI);
MU_C=0.0015;
MU_D=0.0015;
RHO_X=.979;
LAMBDA_DX=3;
model;
v_c = DELTA^THETA * exp((-THETA/PSI)*dc(+1) + (THETA-1)*log((1+v_c(+1))*exp(dc(+1))/v_c) ) * (1+v_c(+1))*exp(dc(+1));
v_d = DELTA^THETA * exp((-THETA/PSI)*dc(+1) + (THETA-1)*log((1+v_c(+1))*exp(dc(+1))/v_c) ) * (1+v_d(+1))*exp(dd(+1));
dc = MU_C + x(-1) + e_c;
dd = MU_D + LAMBDA_DX*x(-1) + e_d;
x = RHO_X * x(-1) + e_x;
end;
initval;
v_c=15;
v_d=15;
dc=MU_C;
dd=MU_D;
x=0;
e_c=0;
e_x=0;
e_d=0;
end;
shocks;
var e_d; stderr .001;
var e_c; stderr .001;
var e_x; stderr .001;
end;
steady;
estimated_params;
DELTA, beta_pdf, 0.98,.005;
THETA,normal_pdf,-19.5, 0.0025;
PSI,normal_pdf,1.6, 0.1;
MU_C,normal_pdf,0.001, 0.001;
MU_D,normal_pdf,0.001, 0.001;
RHO_X,normal_pdf,.98, 0.005;
LAMBDA_DX,normal_pdf,3, 0.05;
stderr e_d,inv_gamma_pdf,.0025, 30;
stderr e_x,inv_gamma_pdf,.0003, 30;
stderr e_c,inv_gamma_pdf,.01, 30;
end;
varobs v_d dd dc;
estimation(datafile=simudata,mh_replic=1000,mh_jscale=.4,nodiagnostic);

View File

@ -1,42 +1,42 @@
var x y;
varexo e_x e_u;
parameters rho sig_x sig_u mu_y;
rho = .98;
mu_y=.015;
sig_x=0.00025;
sig_u=.0078;
model(linear);
x=rho*x(-1) + sig_x*e_x;
y=mu_y + x(-1) + sig_u*e_u;
end;
initval;
x=0;
y=mu_y;
end;
steady;
shocks;
var e_x;
stderr 1;
var e_u;
stderr 1;
end;
estimated_params;
rho, beta_pdf, .98, .01;
mu_y, uniform_pdf, .005, .0025;
sig_u, inv_gamma_pdf, .003, inf;
sig_x, inv_gamma_pdf, .003, inf;
// The syntax for to input the priors is the following:
// variable name, prior distribution, parameters of distribution.
end;
varobs y;
var x y;
varexo e_x e_u;
parameters rho sig_x sig_u mu_y;
rho = .98;
mu_y=.015;
sig_x=0.00025;
sig_u=.0078;
model(linear);
x=rho*x(-1) + sig_x*e_x;
y=mu_y + x(-1) + sig_u*e_u;
end;
initval;
x=0;
y=mu_y;
end;
steady;
shocks;
var e_x;
stderr 1;
var e_u;
stderr 1;
end;
estimated_params;
rho, beta_pdf, .98, .01;
mu_y, uniform_pdf, .005, .0025;
sig_u, inv_gamma_pdf, .003, inf;
sig_x, inv_gamma_pdf, .003, inf;
// The syntax for to input the priors is the following:
// variable name, prior distribution, parameters of distribution.
end;
varobs y;
estimation(datafile=data_consRicardoypg,first_obs=1,nobs=227,mh_replic=5000,mh_nblocks=1,mh_jscale=1);

View File

@ -1,44 +1,44 @@
var x y;
varexo e_x e_u;
parameters rho sig_x sig_u mu_y;
rho = .98;
mu_y=.015;
sig_x=0.00025;
sig_u=.0078;
model(linear);
x=rho*x(-1) + sig_x*e_x;
y=mu_y + x(-1) + sig_u*e_u;
end;
initval;
x=0;
y=mu_y;
end;
steady;
shocks;
var e_x;
stderr 1;
var e_u;
stderr 1;
end;
estimated_params;
// ML estimation setup
// parameter name, initial value, boundaries_low, ..._up;
rho, 0, -0.99, 0.999; // use this for unconstrained max likelihood
// rho, .98, .975, .999 ; // use this for long run risk model
// sig_x, .0004,.0001,.05 ; // use this for the long run risk model
sig_x, .0005, .00000000001, .01; // use this for unconstrained max likelihood
sig_u, .007,.001, .1;
mu_y, .014, .0001, .04;
end;
varobs y;
var x y;
varexo e_x e_u;
parameters rho sig_x sig_u mu_y;
rho = .98;
mu_y=.015;
sig_x=0.00025;
sig_u=.0078;
model(linear);
x=rho*x(-1) + sig_x*e_x;
y=mu_y + x(-1) + sig_u*e_u;
end;
initval;
x=0;
y=mu_y;
end;
steady;
shocks;
var e_x;
stderr 1;
var e_u;
stderr 1;
end;
estimated_params;
// ML estimation setup
// parameter name, initial value, boundaries_low, ..._up;
rho, 0, -0.99, 0.999; // use this for unconstrained max likelihood
// rho, .98, .975, .999 ; // use this for long run risk model
// sig_x, .0004,.0001,.05 ; // use this for the long run risk model
sig_x, .0005, .00000000001, .01; // use this for unconstrained max likelihood
sig_u, .007,.001, .1;
mu_y, .014, .0001, .04;
end;
varobs y;
estimation(datafile=data_consRicardoypg,first_obs=1,nobs=227,mh_replic=0,mode_compute=4,mode_check);

View File

@ -1,79 +1,79 @@
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.4;
g =.4;
tauc =0;
taui =0;
tauk =0;
end;
steady;
shocks;
var g;
periods 1:9;
values 0.2;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1131.ps
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.4;
g =.4;
tauc =0;
taui =0;
tauk =0;
end;
steady;
shocks;
var g;
periods 1:9;
values 0.2;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1131.ps

View File

@ -1,130 +1,130 @@
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
// This is a commented version of the program given in the handout.
// Note: y_ records the simulated endogenous variables in alphabetical order
// ys0_ records the initial steady state
// ys_ records the terminal steady state
// We check that these line up at the end points
// Note: y_ has ys0_ in first column, ys_ in last column, explaining why it is 102 long;
// The sample of size 100 is in between.
// Warning: we align c, k, and the taxes to exploit the dynare syntax. See comments below.
// So k in the program corresponds to k_{t+1} and the same timing holds for the taxes.
//Declares the endogenous variables;
var c k;
//declares the exogenous variables // investment tax credit, consumption tax, capital tax, government spending
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95; // discount factor
gam=2; // CRRA parameter
del=.2; // depreciation rate
alpha=.33; // capital's share
A=1; // productivity
// Alignment convention:
// g tauc taui tauk are now columns of ex_. Because of a bad design decision
// the date of ex_(1,:) doesn't necessarily match the date in y_. Whether they match depends
// on the number of lag periods in endogenous versus exogenous variables.
// In this example they match because tauc(-1) and taui(-1) enter the model.
// These decisions and the timing conventions mean that
// y_(:,1) records the initial steady state, while y_(:,102) records the terminal steady state values.
// For j > 2, y_(:,j) records [c(j-1) .. k(j-1) .. G(j-1)] where k(j-1) means
// end of period capital in period j-1, which equals k(j) in chapter 11 notation.
// Note that the jump in G occurs in y_(;,11), which confirms this timing.
// the jump occurs now in ex_(11,1)
model;
// equation 11.3.8.a
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
// equation 11.3.8e + 11.3.8.g
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady; // put this in if you want to start from the initial steady state, comment it out to start from the indicated values
endval; // The following values determine the new steady state after the shocks.
k=1.5;
c=0.4;
g =.4;
tauc =0;
taui =0;
tauk =0;
end;
steady; // We use steady again and the enval provided are initial guesses for dynare to compute the ss.
// The following lines produce a g sequence with a once and for all jump in g
shocks;
// we use shocks to undo that for the first 9 periods and leave g at
// it's initial value of 0
var g;
periods 1:9;
values 0.2;
end;
// now solve the model
simul(periods=100);
// Note: y_ records the simulated endogenous variables in alphabetical order
// ys0_ records the initial steady state
// ys_ records the terminal steady state
// check that these line up at the end points
y_(:,1) -ys0_(:)
y_(:,102) - ys_(:)
// Compute the initial steady state for consumption to later do the plots.
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
// g is in ex_(:,1) since it is stored in alphabetical order
go = ex_(1,1)
// The following equation compute the other endogenous variables use in the plots below
// Since they are function of capital and consumption, so we can compute them from the solved
// model above.
// These equations were taken from page 333 of RMT2
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
//Now we plot the responses of the endogenous variables to the shock.
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ]) // note the timing: we lag capital to correct for syntax
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
// This is a commented version of the program given in the handout.
// Note: y_ records the simulated endogenous variables in alphabetical order
// ys0_ records the initial steady state
// ys_ records the terminal steady state
// We check that these line up at the end points
// Note: y_ has ys0_ in first column, ys_ in last column, explaining why it is 102 long;
// The sample of size 100 is in between.
// Warning: we align c, k, and the taxes to exploit the dynare syntax. See comments below.
// So k in the program corresponds to k_{t+1} and the same timing holds for the taxes.
//Declares the endogenous variables;
var c k;
//declares the exogenous variables // investment tax credit, consumption tax, capital tax, government spending
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95; // discount factor
gam=2; // CRRA parameter
del=.2; // depreciation rate
alpha=.33; // capital's share
A=1; // productivity
// Alignment convention:
// g tauc taui tauk are now columns of ex_. Because of a bad design decision
// the date of ex_(1,:) doesn't necessarily match the date in y_. Whether they match depends
// on the number of lag periods in endogenous versus exogenous variables.
// In this example they match because tauc(-1) and taui(-1) enter the model.
// These decisions and the timing conventions mean that
// y_(:,1) records the initial steady state, while y_(:,102) records the terminal steady state values.
// For j > 2, y_(:,j) records [c(j-1) .. k(j-1) .. G(j-1)] where k(j-1) means
// end of period capital in period j-1, which equals k(j) in chapter 11 notation.
// Note that the jump in G occurs in y_(;,11), which confirms this timing.
// the jump occurs now in ex_(11,1)
model;
// equation 11.3.8.a
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
// equation 11.3.8e + 11.3.8.g
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady; // put this in if you want to start from the initial steady state, comment it out to start from the indicated values
endval; // The following values determine the new steady state after the shocks.
k=1.5;
c=0.4;
g =.4;
tauc =0;
taui =0;
tauk =0;
end;
steady; // We use steady again and the enval provided are initial guesses for dynare to compute the ss.
// The following lines produce a g sequence with a once and for all jump in g
shocks;
// we use shocks to undo that for the first 9 periods and leave g at
// it's initial value of 0
var g;
periods 1:9;
values 0.2;
end;
// now solve the model
simul(periods=100);
// Note: y_ records the simulated endogenous variables in alphabetical order
// ys0_ records the initial steady state
// ys_ records the terminal steady state
// check that these line up at the end points
y_(:,1) -ys0_(:)
y_(:,102) - ys_(:)
// Compute the initial steady state for consumption to later do the plots.
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
// g is in ex_(:,1) since it is stored in alphabetical order
go = ex_(1,1)
// The following equation compute the other endogenous variables use in the plots below
// Since they are function of capital and consumption, so we can compute them from the solved
// model above.
// These equations were taken from page 333 of RMT2
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
//Now we plot the responses of the endogenous variables to the shock.
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ]) // note the timing: we lag capital to correct for syntax
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')

View File

@ -1,79 +1,79 @@
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g = 0.2;
tauc =0.2;
taui =0;
tauk =0;
end;
steady;
shocks;
var tauc;
periods 1:9;
values 0;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1132.ps
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g = 0.2;
tauc =0.2;
taui =0;
tauk =0;
end;
steady;
shocks;
var tauc;
periods 1:9;
values 0;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1132.ps

View File

@ -1,80 +1,80 @@
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g =0.2;
tauc =0;
taui =0.20;
tauk =0;
end;
steady;
shocks;
var taui;
periods 1:9;
values 0;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1151.ps
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g =0.2;
tauc =0;
taui =0.20;
tauk =0;
end;
steady;
shocks;
var taui;
periods 1:9;
values 0;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1151.ps

View File

@ -1,80 +1,80 @@
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g =0.2;
tauc =0;
taui =0;
tauk = 0.2;
end;
steady;
shocks;
var tauk;
periods 1:9;
values 0;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1152.ps
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g =0.2;
tauc =0;
taui =0;
tauk = 0.2;
end;
steady;
shocks;
var tauk;
periods 1:9;
values 0;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1152.ps

View File

@ -1,80 +1,80 @@
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g = 0.2;
tauc =0;
taui =0;
tauk =0;
end;
steady;
shocks;
var g;
periods 10;
values 0.4;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1171.ps
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g = 0.2;
tauc =0;
taui =0;
tauk =0;
end;
steady;
shocks;
var g;
periods 10;
values 0.4;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1171.ps

View File

@ -1,80 +1,80 @@
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g =0.2;
tauc =0;
taui =0;
tauk =0;
end;
steady;
shocks;
var taui;
periods 10;
values 0.2;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1172.ps
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.6;
g =0.2;
tauc =0;
taui =0;
tauk =0;
end;
steady;
shocks;
var taui;
periods 10;
values 0.2;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
figure
subplot(2,3,1)
plot([ko*ones(100,1) y_(var_index('k'),1:100)' ])
title('k')
subplot(2,3,2)
plot([co*ones(100,1) y_(var_index('c'),2:101)' ])
title('c')
subplot(2,3,3)
plot([rbig0*ones(100,1) rbig' ])
title('R')
subplot(2,3,4)
plot([wq0*ones(100,1) wq' ])
title('w/q')
subplot(2,3,5)
plot([sq0*ones(100,1) sq' ])
title('s/q')
subplot(2,3,6)
plot([rq0*ones(100,1) rq' ])
title('r/q')
print -depsc fig1172.ps

View File

@ -1,41 +1,41 @@
periods 1000;
var c k lab z;
varexo e;
parameters bet the del alp tau rho s;
bet = 0.987;
the = 0.357;
del = 0.012;
alp = 0.4;
tau = 2;
rho = 0.95;
s = 0.007;
model;
(c^the*(1-lab)^(1-the))^(1-tau)/c=bet*((c(+1)^the*(1-lab(+1))^(1-the))^(1-tau)/c(+1))*(1+alp*exp(z(+1))*k^(alp-1)*lab(+1)^(1-alp)-del);
c=the/(1-the)*(1-alp)*exp(z)*k(-1)^alp*lab^(-alp)*(1-lab);
k=exp(z)*k(-1)^alp*lab^(1-alp)-c+(1-del)*k(-1);
z=rho*z(-1)+s*e;
end;
initval;
k = 1;
c = 1;
lab = 0.3;
z = 0;
e = 0;
end;
shocks;
var e;
stderr 1;
end;
steady;
stoch_simul(dr_algo=0,periods=1000,irf=40);
datasaver('simudata',[]);
periods 1000;
var c k lab z;
varexo e;
parameters bet the del alp tau rho s;
bet = 0.987;
the = 0.357;
del = 0.012;
alp = 0.4;
tau = 2;
rho = 0.95;
s = 0.007;
model;
(c^the*(1-lab)^(1-the))^(1-tau)/c=bet*((c(+1)^the*(1-lab(+1))^(1-the))^(1-tau)/c(+1))*(1+alp*exp(z(+1))*k^(alp-1)*lab(+1)^(1-alp)-del);
c=the/(1-the)*(1-alp)*exp(z)*k(-1)^alp*lab^(-alp)*(1-lab);
k=exp(z)*k(-1)^alp*lab^(1-alp)-c+(1-del)*k(-1);
z=rho*z(-1)+s*e;
end;
initval;
k = 1;
c = 1;
lab = 0.3;
z = 0;
e = 0;
end;
shocks;
var e;
stderr 1;
end;
steady;
stoch_simul(dr_algo=0,periods=1000,irf=40);
datasaver('simudata',[]);

View File

@ -1,44 +1,44 @@
var c k lab z;
varexo e;
parameters bet del alp rho the tau s;
bet = 0.987;
the = 0.357;
del = 0.012;
alp = 0.4;
tau = 2;
rho = 0.95;
s = 0.007;
model;
(c^the*(1-lab)^(1-the))^(1-tau)/c=bet*((c(+1)^the*(1-lab(+1))^(1-the))^(1-tau)/c(+1))*(1+alp*exp(z(+1))*k^(alp-1)*lab(+1)^(1-alp)-del);
c=the/(1-the)*(1-alp)*exp(z)*k(-1)^alp*lab^(-alp)*(1-lab);
k=exp(z)*k(-1)^alp*lab^(1-alp)-c+(1-del)*k(-1);
z=rho*z(-1)+s*e;
end;
initval;
k = 1;
c = 1;
lab = 0.3;
z = 0;
e = 0;
end;
shocks;
var e;
stderr 1;
end;
estimated_params;
stderr e, inv_gamma_pdf, 0.95,30;
rho, beta_pdf,0.93,0.02;
the, normal_pdf,0.3,0.05;
tau, normal_pdf,2.1,0.3;
end;
varobs c;
estimation(datafile=simudata,mh_replic=1000,mh_jscale=0.9,nodiagnostic);
var c k lab z;
varexo e;
parameters bet del alp rho the tau s;
bet = 0.987;
the = 0.357;
del = 0.012;
alp = 0.4;
tau = 2;
rho = 0.95;
s = 0.007;
model;
(c^the*(1-lab)^(1-the))^(1-tau)/c=bet*((c(+1)^the*(1-lab(+1))^(1-the))^(1-tau)/c(+1))*(1+alp*exp(z(+1))*k^(alp-1)*lab(+1)^(1-alp)-del);
c=the/(1-the)*(1-alp)*exp(z)*k(-1)^alp*lab^(-alp)*(1-lab);
k=exp(z)*k(-1)^alp*lab^(1-alp)-c+(1-del)*k(-1);
z=rho*z(-1)+s*e;
end;
initval;
k = 1;
c = 1;
lab = 0.3;
z = 0;
e = 0;
end;
shocks;
var e;
stderr 1;
end;
estimated_params;
stderr e, inv_gamma_pdf, 0.95,30;
rho, beta_pdf,0.93,0.02;
the, normal_pdf,0.3,0.05;
tau, normal_pdf,2.1,0.3;
end;
varobs c;
estimation(datafile=simudata,mh_replic=1000,mh_jscale=0.9,nodiagnostic);

View File

@ -1,62 +1,62 @@
// Estimates the Hansen Sargent and Tallarini model by maximum likelihood.
var s c h k i d dhat dbar mus muc muh gamma R;
varexo e_dhat e_dbar;
parameters lambda deltah deltak mud b bet phi1 phi2 cdbar alpha1 alpha2 cdhat;
bet=0.9971;
deltah=0.682;
lambda=2.443;
alpha1=0.813;
alpha2=0.189;
phi1=0.998;
phi2=0.704;
mud=13.710;
cdhat=0.155;
cdbar=0.108;
b=32;
deltak=0.975;
model(linear);
R=deltak+gamma;
R*bet=1;
s=(1+lambda)*c-lambda*h(-1);
h=deltah*h(-1)+(1-deltah)*c;
k=deltak*k(-1)+i;
c+i=gamma*k(-1)+d;
mus=b-s;
muc=(1+lambda)*mus+(1-deltah)*muh;
muh=bet*(deltah*muh(+1)-lambda*mus(+1));
muc=bet*R*muc(+1);
d=mud+dbar+dhat;
dbar=(phi1+phi2)*dbar(-1) - phi1*phi2*dbar(-2) + cdbar*e_dbar;
dhat=(alpha1+alpha2)*dhat(-1) - alpha1*alpha2*dhat(-2) + cdhat*e_dhat;
end;
shocks;
var e_dhat;
stderr 1;
var e_dbar;
stderr 1;
end;
stoch_simul(irf=0, periods=500);
// save dataHST c i;
estimated_params;
bet,uniform_pdf, .9499999999, 0.0288675134306;
deltah,uniform_pdf, 0.45, 0.202072594216;
lambda,uniform_pdf, 25.05, 14.4048892163;
alpha1,uniform_pdf, 0.8, 0.115470053809;
alpha2,uniform_pdf, 0.25, 0.144337567297;
phi1,uniform_pdf, 0.8, 0.115470053809;
phi2,uniform_pdf, 0.5, 0.288675134595;
mud,uniform_pdf, 24.5, 14.1450815951;
cdhat,uniform_pdf, 0.175, 0.0721687836487;
cdbar,uniform_pdf, 0.175, 0.0721687836487;
end;
varobs c i;
// estimation(datafile=dataHST,first_obs=1,nobs=500,mode_compute=4,MH_jscale=2);
estimation(datafile=dataHST,first_obs=1,nobs=500,mode_compute=4,mode_check,mh_replic=5000,mh_nblocks=1,mh_jscale=0.3);
// Estimates the Hansen Sargent and Tallarini model by maximum likelihood.
var s c h k i d dhat dbar mus muc muh gamma R;
varexo e_dhat e_dbar;
parameters lambda deltah deltak mud b bet phi1 phi2 cdbar alpha1 alpha2 cdhat;
bet=0.9971;
deltah=0.682;
lambda=2.443;
alpha1=0.813;
alpha2=0.189;
phi1=0.998;
phi2=0.704;
mud=13.710;
cdhat=0.155;
cdbar=0.108;
b=32;
deltak=0.975;
model(linear);
R=deltak+gamma;
R*bet=1;
s=(1+lambda)*c-lambda*h(-1);
h=deltah*h(-1)+(1-deltah)*c;
k=deltak*k(-1)+i;
c+i=gamma*k(-1)+d;
mus=b-s;
muc=(1+lambda)*mus+(1-deltah)*muh;
muh=bet*(deltah*muh(+1)-lambda*mus(+1));
muc=bet*R*muc(+1);
d=mud+dbar+dhat;
dbar=(phi1+phi2)*dbar(-1) - phi1*phi2*dbar(-2) + cdbar*e_dbar;
dhat=(alpha1+alpha2)*dhat(-1) - alpha1*alpha2*dhat(-2) + cdhat*e_dhat;
end;
shocks;
var e_dhat;
stderr 1;
var e_dbar;
stderr 1;
end;
stoch_simul(irf=0, periods=500);
// save dataHST c i;
estimated_params;
bet,uniform_pdf, .9499999999, 0.0288675134306;
deltah,uniform_pdf, 0.45, 0.202072594216;
lambda,uniform_pdf, 25.05, 14.4048892163;
alpha1,uniform_pdf, 0.8, 0.115470053809;
alpha2,uniform_pdf, 0.25, 0.144337567297;
phi1,uniform_pdf, 0.8, 0.115470053809;
phi2,uniform_pdf, 0.5, 0.288675134595;
mud,uniform_pdf, 24.5, 14.1450815951;
cdhat,uniform_pdf, 0.175, 0.0721687836487;
cdbar,uniform_pdf, 0.175, 0.0721687836487;
end;
varobs c i;
// estimation(datafile=dataHST,first_obs=1,nobs=500,mode_compute=4,MH_jscale=2);
estimation(datafile=dataHST,first_obs=1,nobs=500,mode_compute=4,mode_check,mh_replic=5000,mh_nblocks=1,mh_jscale=0.3);

View File

@ -1,62 +1,62 @@
// Estimates the Hansen Sargent and Tallarini model by maximum likelihood.
var s c h k i d dhat dbar mus muc muh gamma R;
varexo e_dhat e_dbar;
parameters lambda deltah deltak mud b bet phi1 phi2 cdbar alpha1 alpha2 cdhat;
bet=0.9971;
deltah=0.682;
lambda=2.443;
alpha1=0.813;
alpha2=0.189;
phi1=0.998;
phi2=0.704;
mud=13.710;
cdhat=0.155;
cdbar=0.108;
b=32;
deltak=0.975;
model(linear);
R=deltak+gamma;
R*bet=1;
s=(1+lambda)*c-lambda*h(-1);
h=deltah*h(-1)+(1-deltah)*c;
k=deltak*k(-1)+i;
c+i=gamma*k(-1)+d;
mus=b-s;
muc=(1+lambda)*mus+(1-deltah)*muh;
muh=bet*(deltah*muh(+1)-lambda*mus(+1));
muc=bet*R*muc(+1);
d=mud+dbar+dhat;
dbar=(phi1+phi2)*dbar(-1) - phi1*phi2*dbar(-2) + cdbar*e_dbar;
dhat=(alpha1+alpha2)*dhat(-1) - alpha1*alpha2*dhat(-2) + cdhat*e_dhat;
end;
shocks;
var e_dhat;
stderr 1;
var e_dbar;
stderr 1;
end;
// stoch_simul(irf=0, periods=500);
// save dataHST c i;
estimated_params;
bet, .91, .9, .99999;
deltah, 0.4, 0.1, 0.8;
lambda, 2, 0.1, 50;
alpha1, 0.8, 0.6, 0.99999;
alpha2, 0.2, 0.01, 0.5;
phi1, 0.8, 0.6, 0.99999;
phi2, 0.5, 0.3, 0.9;
mud, 10, 1, 50;
cdhat, 0.1, 0.05, 0.2;
cdbar, 0.1, 0.05, 0.2;
end;
varobs c i;
estimation(datafile=dataHST,first_obs=1,nobs=500,mode_compute=4,mode_check);
// Estimates the Hansen Sargent and Tallarini model by maximum likelihood.
var s c h k i d dhat dbar mus muc muh gamma R;
varexo e_dhat e_dbar;
parameters lambda deltah deltak mud b bet phi1 phi2 cdbar alpha1 alpha2 cdhat;
bet=0.9971;
deltah=0.682;
lambda=2.443;
alpha1=0.813;
alpha2=0.189;
phi1=0.998;
phi2=0.704;
mud=13.710;
cdhat=0.155;
cdbar=0.108;
b=32;
deltak=0.975;
model(linear);
R=deltak+gamma;
R*bet=1;
s=(1+lambda)*c-lambda*h(-1);
h=deltah*h(-1)+(1-deltah)*c;
k=deltak*k(-1)+i;
c+i=gamma*k(-1)+d;
mus=b-s;
muc=(1+lambda)*mus+(1-deltah)*muh;
muh=bet*(deltah*muh(+1)-lambda*mus(+1));
muc=bet*R*muc(+1);
d=mud+dbar+dhat;
dbar=(phi1+phi2)*dbar(-1) - phi1*phi2*dbar(-2) + cdbar*e_dbar;
dhat=(alpha1+alpha2)*dhat(-1) - alpha1*alpha2*dhat(-2) + cdhat*e_dhat;
end;
shocks;
var e_dhat;
stderr 1;
var e_dbar;
stderr 1;
end;
// stoch_simul(irf=0, periods=500);
// save dataHST c i;
estimated_params;
bet, .91, .9, .99999;
deltah, 0.4, 0.1, 0.8;
lambda, 2, 0.1, 50;
alpha1, 0.8, 0.6, 0.99999;
alpha2, 0.2, 0.01, 0.5;
phi1, 0.8, 0.6, 0.99999;
phi2, 0.5, 0.3, 0.9;
mud, 10, 1, 50;
cdhat, 0.1, 0.05, 0.2;
cdbar, 0.1, 0.05, 0.2;
end;
varobs c i;
estimation(datafile=dataHST,first_obs=1,nobs=500,mode_compute=4,mode_check);

View File

@ -1,45 +1,45 @@
periods 200;
var c1 c2 k1 k2 a1 a2 y1 y2;
varexo e1 e2;
parameters gamma delta alpha beta rho;
gamma=2;
delta=.05;
alpha=.4;
beta=.98;
rho=.85;
model;
c1=c2;
exp(c1)^(-gamma) = beta*exp(c1(+1))^(-gamma)*(alpha*exp(a1(+1))*exp(k1)^(alpha-1)+1-delta);
exp(c2)^(-gamma) = beta*exp(c2(+1))^(-gamma)*(alpha*exp(a2(+1))*exp(k2)^(alpha-1)+1-delta);
exp(c1)+exp(c2)+exp(k1)-exp(k1(-1))*(1-delta)+exp(k2)-exp(k2(-1))*(1-delta) = exp(a1)*exp(k1(-1))^alpha+exp(a2)*exp(k2(-1))^alpha;
a1=rho*a1(-1)+e1;
a2=rho*a2(-1)+e2;
exp(y1)=exp(a1)*exp(k1(-1))^alpha;
exp(y2)=exp(a2)*exp(k2(-1))^alpha;
end;
initval;
y1=1.1;
y2=1.1;
k1=2.8;
k2=2.8;
c1=.8;
c2=.8;
a1=0;
a2=0;
e1=0;
e2=0;
end;
shocks;
var e1; stderr .08;
var e2; stderr .08;
end;
steady;
stoch_simul(dr_algo=0,periods=200);
periods 200;
var c1 c2 k1 k2 a1 a2 y1 y2;
varexo e1 e2;
parameters gamma delta alpha beta rho;
gamma=2;
delta=.05;
alpha=.4;
beta=.98;
rho=.85;
model;
c1=c2;
exp(c1)^(-gamma) = beta*exp(c1(+1))^(-gamma)*(alpha*exp(a1(+1))*exp(k1)^(alpha-1)+1-delta);
exp(c2)^(-gamma) = beta*exp(c2(+1))^(-gamma)*(alpha*exp(a2(+1))*exp(k2)^(alpha-1)+1-delta);
exp(c1)+exp(c2)+exp(k1)-exp(k1(-1))*(1-delta)+exp(k2)-exp(k2(-1))*(1-delta) = exp(a1)*exp(k1(-1))^alpha+exp(a2)*exp(k2(-1))^alpha;
a1=rho*a1(-1)+e1;
a2=rho*a2(-1)+e2;
exp(y1)=exp(a1)*exp(k1(-1))^alpha;
exp(y2)=exp(a2)*exp(k2(-1))^alpha;
end;
initval;
y1=1.1;
y2=1.1;
k1=2.8;
k2=2.8;
c1=.8;
c2=.8;
a1=0;
a2=0;
e1=0;
e2=0;
end;
shocks;
var e1; stderr .08;
var e2; stderr .08;
end;
steady;
stoch_simul(dr_algo=0,periods=200);
datatomfile('simu2',[]);

View File

@ -1,51 +1,51 @@
periods 200;
var c1 c2 k1 k2 a1 a2 y1 y2;
varexo e1 e2;
parameters gamma delta alpha beta rho;
gamma=2;
delta=.05;
alpha=.4;
beta=.98;
rho=.85;
model;
c1=c2;
exp(c1)^(-gamma) = beta*exp(c1(+1))^(-gamma)*(alpha*exp(a1(+1))*exp(k1)^(alpha-1)+1-delta);
exp(c2)^(-gamma) = beta*exp(c2(+1))^(-gamma)*(alpha*exp(a2(+1))*exp(k2)^(alpha-1)+1-delta);
exp(c1)+exp(c2)+exp(k1)-exp(k1(-1))*(1-delta)+exp(k2)-exp(k2(-1))*(1-delta) = exp(a1)*exp(k1(-1))^alpha+exp(a2)*exp(k2(-1))^alpha;
a1=rho*a1(-1)+e1;
a2=rho*a2(-1)+e2;
exp(y1)=exp(a1)*exp(k1(-1))^alpha;
exp(y2)=exp(a2)*exp(k2(-1))^alpha;
end;
initval;
y1=1.1;
y2=1.1;
k1=2.8;
k2=2.8;
c1=.8;
c2=.8;
a1=0;
a2=0;
e1=0;
e2=0;
end;
shocks;
var e1; stderr .08;
var e2; stderr .08;
end;
steady;
estimated_params;
alpha, normal_pdf, .35, .05;
rho, normal_pdf, .8, .05;
stderr e1, inv_gamma_pdf, .09, 10;
stderr e2, inv_gamma_pdf, .09, 10;
end;
varobs y1 y2;
periods 200;
var c1 c2 k1 k2 a1 a2 y1 y2;
varexo e1 e2;
parameters gamma delta alpha beta rho;
gamma=2;
delta=.05;
alpha=.4;
beta=.98;
rho=.85;
model;
c1=c2;
exp(c1)^(-gamma) = beta*exp(c1(+1))^(-gamma)*(alpha*exp(a1(+1))*exp(k1)^(alpha-1)+1-delta);
exp(c2)^(-gamma) = beta*exp(c2(+1))^(-gamma)*(alpha*exp(a2(+1))*exp(k2)^(alpha-1)+1-delta);
exp(c1)+exp(c2)+exp(k1)-exp(k1(-1))*(1-delta)+exp(k2)-exp(k2(-1))*(1-delta) = exp(a1)*exp(k1(-1))^alpha+exp(a2)*exp(k2(-1))^alpha;
a1=rho*a1(-1)+e1;
a2=rho*a2(-1)+e2;
exp(y1)=exp(a1)*exp(k1(-1))^alpha;
exp(y2)=exp(a2)*exp(k2(-1))^alpha;
end;
initval;
y1=1.1;
y2=1.1;
k1=2.8;
k2=2.8;
c1=.8;
c2=.8;
a1=0;
a2=0;
e1=0;
e2=0;
end;
shocks;
var e1; stderr .08;
var e2; stderr .08;
end;
steady;
estimated_params;
alpha, normal_pdf, .35, .05;
rho, normal_pdf, .8, .05;
stderr e1, inv_gamma_pdf, .09, 10;
stderr e2, inv_gamma_pdf, .09, 10;
end;
varobs y1 y2;
estimation(datafile=simu2,mh_replic=1200,mh_jscale=.7,nodiagnostic);

View File

@ -1,46 +1,46 @@
periods 5000;
var c k mu_c b d in;
varexo e_d e_b;
parameters R rho rho_b mu_b mu_d;
R=1.05;
//rho=0.9;
rho = 0;
mu_b=30;
mu_d=5;
rho_b = 0;
model(linear);
c+k = R*k(-1) + d;
mu_c = b - c;
mu_c=mu_c(+1);
d= rho*d(-1)+ mu_d*(1-rho) + e_d;
b=(1-rho_b)*mu_b+rho_b*b(-1)+e_b;
in = k - k(-1);
end;
//With a unit root, there exists no steady state. Use the following trick.
//Supply ONE solution corresponding to the initial k that you named.
initval;
d=mu_d;
k=100;
c = (R-1)*k +d;
mu_c=mu_b-c;
b=mu_b;
end;
shocks;
var e_d;
stderr 1;
var e_b;
stderr 1;
end;
steady;
check;
stoch_simul(dr_algo=1, order=1, periods=500, irf=10);
periods 5000;
var c k mu_c b d in;
varexo e_d e_b;
parameters R rho rho_b mu_b mu_d;
R=1.05;
//rho=0.9;
rho = 0;
mu_b=30;
mu_d=5;
rho_b = 0;
model(linear);
c+k = R*k(-1) + d;
mu_c = b - c;
mu_c=mu_c(+1);
d= rho*d(-1)+ mu_d*(1-rho) + e_d;
b=(1-rho_b)*mu_b+rho_b*b(-1)+e_b;
in = k - k(-1);
end;
//With a unit root, there exists no steady state. Use the following trick.
//Supply ONE solution corresponding to the initial k that you named.
initval;
d=mu_d;
k=100;
c = (R-1)*k +d;
mu_c=mu_b-c;
b=mu_b;
end;
shocks;
var e_d;
stderr 1;
var e_b;
stderr 1;
end;
steady;
check;
stoch_simul(dr_algo=1, order=1, periods=500, irf=10);
save data_hall c in;

View File

@ -1,54 +1,54 @@
// Estimates the hall model using Bayesian method.
// hall1_estimate.mod estimates by maximum likelihood
periods 5000;
var c k mu_c b d in;
varexo e_d e_b;
parameters R rho rho_b mu_b mu_d;
R=1.05;
rho=0.9;
mu_b=30;
mu_d=5;
rho_b = 0.5;
model(linear);
c+k = R*k(-1) + d;
mu_c = b - c;
mu_c=mu_c(+1);
d= rho*d(-1)+ mu_d*(1-rho) + e_d;
b=(1-rho_b)*mu_b+rho_b*b(-1)+e_b;
in = k - k(-1);
end;
// Michel says that in a stationary linear model, this junk is irrelevant.
// But with a unit root, there exists no steady state. Use the following trick.
// Supply ONE solution corresponding to the initial k that you named. (Michel is a gneius!! Or so he thinks -- let's see
// if this works.)
initval;
d=mu_d;
k=100;
c = (R-1)*k +d;
mu_c=mu_b-c;
b=mu_b;
end;
shocks;
var e_d;
stderr 0.05;
var e_b;
stderr 0.05;
end;
estimated_params;
rho, beta_pdf, .1, 0.2;
R, normal_pdf, 1.02, 0.05;
end;
varobs c in;
// declare the unit root variables for diffuse filter
unit_root_vars k;
//estimation(datafile=data_hall,first_obs=101,nobs=200,mh_replic=1000,mh_nblocks=2,mh_jscale=2,mode_compute=0,mode_file=hall1_estimate2_mode);
estimation(datafile=data_hall,first_obs=101,nobs=200,mh_replic=1000,mh_nblocks=2,mh_jscale=2);
// Estimates the hall model using Bayesian method.
// hall1_estimate.mod estimates by maximum likelihood
periods 5000;
var c k mu_c b d in;
varexo e_d e_b;
parameters R rho rho_b mu_b mu_d;
R=1.05;
rho=0.9;
mu_b=30;
mu_d=5;
rho_b = 0.5;
model(linear);
c+k = R*k(-1) + d;
mu_c = b - c;
mu_c=mu_c(+1);
d= rho*d(-1)+ mu_d*(1-rho) + e_d;
b=(1-rho_b)*mu_b+rho_b*b(-1)+e_b;
in = k - k(-1);
end;
// Michel says that in a stationary linear model, this junk is irrelevant.
// But with a unit root, there exists no steady state. Use the following trick.
// Supply ONE solution corresponding to the initial k that you named. (Michel is a gneius!! Or so he thinks -- let's see
// if this works.)
initval;
d=mu_d;
k=100;
c = (R-1)*k +d;
mu_c=mu_b-c;
b=mu_b;
end;
shocks;
var e_d;
stderr 0.05;
var e_b;
stderr 0.05;
end;
estimated_params;
rho, beta_pdf, .1, 0.2;
R, normal_pdf, 1.02, 0.05;
end;
varobs c in;
// declare the unit root variables for diffuse filter
unit_root_vars k;
//estimation(datafile=data_hall,first_obs=101,nobs=200,mh_replic=1000,mh_nblocks=2,mh_jscale=2,mode_compute=0,mode_file=hall1_estimate2_mode);
estimation(datafile=data_hall,first_obs=101,nobs=200,mh_replic=1000,mh_nblocks=2,mh_jscale=2);

View File

@ -1,56 +1,56 @@
// Estimates the hall model using maximum likelihood. See hall1_estimateBayes.mod for Bayesian method
periods 5000;
var c k mu_c b d in;
varexo e_d e_b;
parameters R rho rho_b mu_b mu_d;
R=1.05;
rho=0.9;
mu_b=30;
mu_d=5;
rho_b = 0.5;
model(linear);
c+k = R*k(-1) + d;
mu_c = b - c;
mu_c=mu_c(+1);
d= rho*d(-1)+ mu_d*(1-rho) + e_d;
b=(1-rho_b)*mu_b+rho_b*b(-1)+e_b;
in = k - k(-1);
end;
// Michel says that in a stationary linear model, this junk is irrelevant.
// But with a unit root, there exists no steady state. Use the following trick.
// Supply ONE solution corresponding to the initial k that you named. (Michel is a gneius!! Or so he thinks -- let's see
// if this works.)
initval;
d=mu_d;
k=100;
c = (R-1)*k +d;
mu_c=mu_b-c;
b=mu_b;
end;
shocks;
var e_d;
stderr 0.05;
var e_b;
stderr 0.05;
end;
estimated_params;
// ML estimation setup
// parameter name, initial value, boundaries_low, ..._up;
// now we use the optimum results from csminwel for starting up Marco's
rho, -0.0159, -0.9, 0.9;
R, 1.0074, 0, 1.5;
end;
varobs c in;
// declare the unit root variables for diffuse filter
unit_root_vars k;
estimation(datafile=data_hall,first_obs=101,nobs=200,mh_replic=0,mode_compute=4,mode_check);
// Estimates the hall model using maximum likelihood. See hall1_estimateBayes.mod for Bayesian method
periods 5000;
var c k mu_c b d in;
varexo e_d e_b;
parameters R rho rho_b mu_b mu_d;
R=1.05;
rho=0.9;
mu_b=30;
mu_d=5;
rho_b = 0.5;
model(linear);
c+k = R*k(-1) + d;
mu_c = b - c;
mu_c=mu_c(+1);
d= rho*d(-1)+ mu_d*(1-rho) + e_d;
b=(1-rho_b)*mu_b+rho_b*b(-1)+e_b;
in = k - k(-1);
end;
// Michel says that in a stationary linear model, this junk is irrelevant.
// But with a unit root, there exists no steady state. Use the following trick.
// Supply ONE solution corresponding to the initial k that you named. (Michel is a gneius!! Or so he thinks -- let's see
// if this works.)
initval;
d=mu_d;
k=100;
c = (R-1)*k +d;
mu_c=mu_b-c;
b=mu_b;
end;
shocks;
var e_d;
stderr 0.05;
var e_b;
stderr 0.05;
end;
estimated_params;
// ML estimation setup
// parameter name, initial value, boundaries_low, ..._up;
// now we use the optimum results from csminwel for starting up Marco's
rho, -0.0159, -0.9, 0.9;
R, 1.0074, 0, 1.5;
end;
varobs c in;
// declare the unit root variables for diffuse filter
unit_root_vars k;
estimation(datafile=data_hall,first_obs=101,nobs=200,mh_replic=0,mode_compute=4,mode_check);
// Note: there is a problem when you try to use method 5. Tom, Jan 13, 2006

View File

@ -1,55 +1,55 @@
// Rosen schooling model
//
// The model is the one Sherwin Rosen showed Sargent in Sargent's Chicago office.
// The equations are
//
// s_t = a0 + a1*P_t + e_st ; flow supply of new engineers
//
// N_t = (1-delta)*N_{t-1} + s_{t-k} ; time to school engineers
//
// N_t = d0 - d1*W_t +e_dt ; demand for engineers
//
// P_t = (1-delta)*bet P_(t+1) + beta^k*W_(t+k); present value of wages of an engineer
periods 500;
var s N P W;
varexo e_s e_d;
parameters a0 a1 delta d0 d1 bet k;
a0=10;
a1=1;
d0=1000;
d1=1;
bet=.99;
delta=.02;
model(linear);
s=a0+a1*P+e_s; // flow supply of new entrants
N=(1-delta)*N(-1) + s(-4); // evolution of the stock
N=d0-d1*W+e_d; // stock demand equation
P=bet*(1-delta)*P(+1) + bet^4*(1-delta)^4*W(+4); // present value of wages
end;
initval;
s=0;
N=0;
P=0;
W=0;
end;
shocks;
var e_d;
stderr 1;
var e_s;
stderr 1;
end;
steady;
check;
stoch_simul(dr_algo=1, order=1, periods=500, irf=10);
//datasaver('simudata',[]);
save data_rosen s N P W;
// Rosen schooling model
//
// The model is the one Sherwin Rosen showed Sargent in Sargent's Chicago office.
// The equations are
//
// s_t = a0 + a1*P_t + e_st ; flow supply of new engineers
//
// N_t = (1-delta)*N_{t-1} + s_{t-k} ; time to school engineers
//
// N_t = d0 - d1*W_t +e_dt ; demand for engineers
//
// P_t = (1-delta)*bet P_(t+1) + beta^k*W_(t+k); present value of wages of an engineer
periods 500;
var s N P W;
varexo e_s e_d;
parameters a0 a1 delta d0 d1 bet k;
a0=10;
a1=1;
d0=1000;
d1=1;
bet=.99;
delta=.02;
model(linear);
s=a0+a1*P+e_s; // flow supply of new entrants
N=(1-delta)*N(-1) + s(-4); // evolution of the stock
N=d0-d1*W+e_d; // stock demand equation
P=bet*(1-delta)*P(+1) + bet^4*(1-delta)^4*W(+4); // present value of wages
end;
initval;
s=0;
N=0;
P=0;
W=0;
end;
shocks;
var e_d;
stderr 1;
var e_s;
stderr 1;
end;
steady;
check;
stoch_simul(dr_algo=1, order=1, periods=500, irf=10);
//datasaver('simudata',[]);
save data_rosen s N P W;

View File

@ -1,63 +1,63 @@
// Estimates the Rosen schooling model by maximum likelihood
// Rosen schooling model
//
// The model is the one Sherwin Rosen showed Sargent in Sargent's Chicago office.
// The equations are
//
// s_t = a0 + a1*P_t + e_st ; flow supply of new engineers
//
// N_t = (1-delta)*N_{t-1} + s_{t-k} ; time to school engineers
//
// N_t = d0 - d1*W_t +e_dt ; demand for engineers
//
// P_t = (1-delta)*bet P_(t+1) + W_(t+k); present value of wages of an engineer
periods 500;
var s N P W;
varexo e_s e_d;
parameters a0 a1 delta d0 d1 bet ;
a0=10;
a1=1;
d0=1000;
d1=1;
bet=.99;
delta=.02;
model(linear);
s=a0+a1*P+e_s; // flow supply of new entrants
N=(1-delta)*N(-1) + s(-4); // evolution of the stock
N=d0-d1*W+e_d; // stock demand equation
P=bet*(1-delta)*P(+1) + bet^4*(1-delta)^4*W(+4); // present value of wages
end;
initval;
s=0;
N=0;
P=0;
W=0;
end;
shocks;
var e_d;
stderr 1;
var e_s;
stderr 1;
end;
steady;
estimated_params;
a1, gamma_pdf, .5, .5;
d1, gamma_pdf, 2, .5;
end;
varobs W N;
estimation(datafile=data_rosen,first_obs=101,nobs=200,mh_replic=5000,mh_nblocks=2,mh_jscale=2,mode_compute=0,mode_file=rosen_estimateML_mode);
// Estimates the Rosen schooling model by maximum likelihood
// Rosen schooling model
//
// The model is the one Sherwin Rosen showed Sargent in Sargent's Chicago office.
// The equations are
//
// s_t = a0 + a1*P_t + e_st ; flow supply of new engineers
//
// N_t = (1-delta)*N_{t-1} + s_{t-k} ; time to school engineers
//
// N_t = d0 - d1*W_t +e_dt ; demand for engineers
//
// P_t = (1-delta)*bet P_(t+1) + W_(t+k); present value of wages of an engineer
periods 500;
var s N P W;
varexo e_s e_d;
parameters a0 a1 delta d0 d1 bet ;
a0=10;
a1=1;
d0=1000;
d1=1;
bet=.99;
delta=.02;
model(linear);
s=a0+a1*P+e_s; // flow supply of new entrants
N=(1-delta)*N(-1) + s(-4); // evolution of the stock
N=d0-d1*W+e_d; // stock demand equation
P=bet*(1-delta)*P(+1) + bet^4*(1-delta)^4*W(+4); // present value of wages
end;
initval;
s=0;
N=0;
P=0;
W=0;
end;
shocks;
var e_d;
stderr 1;
var e_s;
stderr 1;
end;
steady;
estimated_params;
a1, gamma_pdf, .5, .5;
d1, gamma_pdf, 2, .5;
end;
varobs W N;
estimation(datafile=data_rosen,first_obs=101,nobs=200,mh_replic=5000,mh_nblocks=2,mh_jscale=2,mode_compute=0,mode_file=rosen_estimateML_mode);

View File

@ -1,65 +1,65 @@
// Estimates the Rosen schooling model by maximum likelihood
// Rosen schooling model
//
// The model is the one Sherwin Rosen showed Sargent in Sargent's Chicago office.
// The equations are
//
// s_t = a0 + a1*P_t + e_st ; flow supply of new engineers
//
// N_t = (1-delta)*N_{t-1} + s_{t-k} ; time to school engineers
//
// N_t = d0 - d1*W_t +e_dt ; demand for engineers
//
// P_t = (1-delta)*bet P_(t+1) + W_(t+k); present value of wages of an engineer
periods 500;
var s N P W;
varexo e_s e_d;
parameters a0 a1 delta d0 d1 bet ;
a0=10;
a1=1;
d0=1000;
d1=1;
bet=.99;
delta=.02;
model(linear);
s=a0+a1*P+e_s; // flow supply of new entrants
N=(1-delta)*N(-1) + s(-4); // evolution of the stock
N=d0-d1*W+e_d; // stock demand equation
P=bet*(1-delta)*P(+1) + bet^4*(1-delta)^4*W(+4); // present value of wages
end;
initval;
s=0;
N=0;
P=0;
W=0;
end;
shocks;
var e_d;
stderr 1;
var e_s;
stderr 1;
end;
steady;
estimated_params;
a1, .5, -10, 10;
d1, .5, -20, 40; // these are the ranges for the parameters
end;
varobs W N;
estimation(datafile=data_rosen,first_obs=101,nobs=200,mh_replic=0,mode_compute=4,mode_check);
// Estimates the Rosen schooling model by maximum likelihood
// Rosen schooling model
//
// The model is the one Sherwin Rosen showed Sargent in Sargent's Chicago office.
// The equations are
//
// s_t = a0 + a1*P_t + e_st ; flow supply of new engineers
//
// N_t = (1-delta)*N_{t-1} + s_{t-k} ; time to school engineers
//
// N_t = d0 - d1*W_t +e_dt ; demand for engineers
//
// P_t = (1-delta)*bet P_(t+1) + W_(t+k); present value of wages of an engineer
periods 500;
var s N P W;
varexo e_s e_d;
parameters a0 a1 delta d0 d1 bet ;
a0=10;
a1=1;
d0=1000;
d1=1;
bet=.99;
delta=.02;
model(linear);
s=a0+a1*P+e_s; // flow supply of new entrants
N=(1-delta)*N(-1) + s(-4); // evolution of the stock
N=d0-d1*W+e_d; // stock demand equation
P=bet*(1-delta)*P(+1) + bet^4*(1-delta)^4*W(+4); // present value of wages
end;
initval;
s=0;
N=0;
P=0;
W=0;
end;
shocks;
var e_d;
stderr 1;
var e_s;
stderr 1;
end;
steady;
estimated_params;
a1, .5, -10, 10;
d1, .5, -20, 40; // these are the ranges for the parameters
end;
varobs W N;
estimation(datafile=data_rosen,first_obs=101,nobs=200,mh_replic=0,mode_compute=4,mode_check);

View File

@ -1,41 +1,41 @@
// this program solves and simulates the model in
// "The Demand for Money during Hyperinflations under Rational Expectations: I" by T. Sargent, IER 1977
// this program mainly serves as the data generating process for the estimation of the model in sargent77ML.mod and sargent77Bayes.mod
// variables are defined as follows:
// x=p_t-p_{t-1}, p being the log of the price level
// mu=m_t-m_{t-1}, m being the log of money supply
// note that in contrast to the paper eta and epsilon have variance 1 (they are multiplied by the standard deviations)
var x mu a1 a2;
varexo epsilon eta;
parameters alpha lambda sig_eta sig_epsilon;
lambda=.5921;
alpha=-2.344;
sig_eta= .001;
sig_epsilon= .001;
// the model equations are taken from equation (27) on page 69 of the paper
model;
x=x(-1)-lambda*a1(-1)+(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
mu=(1-lambda)*x(-1)+lambda*mu(-1)-lambda*a2(-1)+(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
a1=(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
a2=(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
end;
steady;
shocks;
var eta;
stderr 1;
var epsilon;
stderr 1;
end;
stoch_simul(dr_algo=1,drop=0, order=1, periods=33, irf=0);
// this program solves and simulates the model in
// "The Demand for Money during Hyperinflations under Rational Expectations: I" by T. Sargent, IER 1977
// this program mainly serves as the data generating process for the estimation of the model in sargent77ML.mod and sargent77Bayes.mod
// variables are defined as follows:
// x=p_t-p_{t-1}, p being the log of the price level
// mu=m_t-m_{t-1}, m being the log of money supply
// note that in contrast to the paper eta and epsilon have variance 1 (they are multiplied by the standard deviations)
var x mu a1 a2;
varexo epsilon eta;
parameters alpha lambda sig_eta sig_epsilon;
lambda=.5921;
alpha=-2.344;
sig_eta= .001;
sig_epsilon= .001;
// the model equations are taken from equation (27) on page 69 of the paper
model;
x=x(-1)-lambda*a1(-1)+(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
mu=(1-lambda)*x(-1)+lambda*mu(-1)-lambda*a2(-1)+(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
a1=(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
a2=(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
end;
steady;
shocks;
var eta;
stderr 1;
var epsilon;
stderr 1;
end;
stoch_simul(dr_algo=1,drop=0, order=1, periods=33, irf=0);
save data_hyperinfl x mu;

View File

@ -1,48 +1,48 @@
// this program estimates the model in
// "The Demand for Money during Hyperinflations under Rational Expectations: I" by T. Sargent, IER 1977 using Bayesian techniques
// variables are defined as follows:
// x=p_t-p_{t-1}, p being the log of the price level
// mu=m_t-m_{t-1}, m being the log of money supply
// note that in contrast to the paper eta and epsilon have variance 1 (they are multiplied by the standard deviations)
var x mu a1 a2;
varexo epsilon eta;
parameters alpha lambda sig_eta sig_epsilon;
lambda=.5921;
alpha=-2.344;
sig_eta=.001;
sig_epsilon=.001;
model;
x=x(-1)-lambda*a1(-1)+(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
mu=(1-lambda)*x(-1)+lambda*mu(-1)-lambda*a2(-1)+(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
a1=(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
a2=(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
end;
steady;
shocks;
var eta;
stderr 1;
var epsilon;
stderr 1;
end;
estimated_params;
// Bayesian setup
lambda, uniform_pdf, 0.68, .5;
alpha, uniform_pdf, -5, 2;
sig_eta, uniform_pdf, .5, 0.25;
sig_epsilon, uniform_pdf, .5, 0.25;
end;
varobs mu x;
unit_root_vars x;
estimation(datafile=cagan_data,first_obs=1,nobs=34,mh_replic=25000,mh_nblocks=1,mh_jscale=1,mode_compute=4);
// this program estimates the model in
// "The Demand for Money during Hyperinflations under Rational Expectations: I" by T. Sargent, IER 1977 using Bayesian techniques
// variables are defined as follows:
// x=p_t-p_{t-1}, p being the log of the price level
// mu=m_t-m_{t-1}, m being the log of money supply
// note that in contrast to the paper eta and epsilon have variance 1 (they are multiplied by the standard deviations)
var x mu a1 a2;
varexo epsilon eta;
parameters alpha lambda sig_eta sig_epsilon;
lambda=.5921;
alpha=-2.344;
sig_eta=.001;
sig_epsilon=.001;
model;
x=x(-1)-lambda*a1(-1)+(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
mu=(1-lambda)*x(-1)+lambda*mu(-1)-lambda*a2(-1)+(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
a1=(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
a2=(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
end;
steady;
shocks;
var eta;
stderr 1;
var epsilon;
stderr 1;
end;
estimated_params;
// Bayesian setup
lambda, uniform_pdf, 0.68, .5;
alpha, uniform_pdf, -5, 2;
sig_eta, uniform_pdf, .5, 0.25;
sig_epsilon, uniform_pdf, .5, 0.25;
end;
varobs mu x;
unit_root_vars x;
estimation(datafile=cagan_data,first_obs=1,nobs=34,mh_replic=25000,mh_nblocks=1,mh_jscale=1,mode_compute=4);

View File

@ -1,52 +1,52 @@
// this program estimates the model in
// "The Demand for Money during Hyperinflations under Rational Expectations: I" by T. Sargent, IER 1977 using maximum likelihood
// variables are defined as follows:
// x=p_t-p_{t-1}, p being the log of the price level
// mu=m_t-m_{t-1}, m being the log of money supply
// note that in contrast to the paper eta and epsilon have variance 1 (they are multiplied by the standard deviations)
var x mu a1 a2;
varexo epsilon eta;
parameters alpha lambda sig_eta sig_epsilon;
lambda=.5921;
alpha=-2.344;
sig_eta=.001;
sig_epsilon=.001;
model;
x=x(-1)-lambda*a1(-1)+(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
mu=(1-lambda)*x(-1)+lambda*mu(-1)-lambda*a2(-1)+(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
a1=(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
a2=(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
end;
steady;
shocks;
var eta;
stderr 1;
var epsilon;
stderr 1;
end;
estimated_params;
// ML estimation setup
// parameter name, initial value, boundaries_low, ..._up;
lambda, .5, 0.25, 0.75;
alpha, -2, -8, -0.1;
sig_eta, .0001, 0.0001, 0.3;
sig_epsilon, .0001, 0.0001, 0.3;
end;
varobs mu x;
unit_root_vars x;
// this program estimates the model in
// "The Demand for Money during Hyperinflations under Rational Expectations: I" by T. Sargent, IER 1977 using maximum likelihood
// variables are defined as follows:
// x=p_t-p_{t-1}, p being the log of the price level
// mu=m_t-m_{t-1}, m being the log of money supply
// note that in contrast to the paper eta and epsilon have variance 1 (they are multiplied by the standard deviations)
var x mu a1 a2;
varexo epsilon eta;
parameters alpha lambda sig_eta sig_epsilon;
lambda=.5921;
alpha=-2.344;
sig_eta=.001;
sig_epsilon=.001;
model;
x=x(-1)-lambda*a1(-1)+(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
mu=(1-lambda)*x(-1)+lambda*mu(-1)-lambda*a2(-1)+(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
a1=(1/(lambda+alpha*(1-lambda)))*sig_epsilon*epsilon-(1/(lambda+alpha*(1-lambda)))*sig_eta*eta;
a2=(1+alpha*(1-lambda))/(lambda+alpha*(1-lambda))*sig_epsilon*epsilon-(1-lambda)/(lambda+alpha*(1-lambda))*sig_eta*eta;
end;
steady;
shocks;
var eta;
stderr 1;
var epsilon;
stderr 1;
end;
estimated_params;
// ML estimation setup
// parameter name, initial value, boundaries_low, ..._up;
lambda, .5, 0.25, 0.75;
alpha, -2, -8, -0.1;
sig_eta, .0001, 0.0001, 0.3;
sig_epsilon, .0001, 0.0001, 0.3;
end;
varobs mu x;
unit_root_vars x;
estimation(datafile=cagan_data,first_obs=1,nobs=34,mh_replic=0,mode_compute=4,mode_check);

View File

@ -1,36 +1,36 @@
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
steady;
check;
shocks;
var x;
periods 1;
values 1.2;
end;
simul(periods=200);
rplot c;
rplot k;
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
steady;
check;
shocks;
var x;
periods 1;
values 1.2;
end;
simul(periods=200);
rplot c;
rplot k;

View File

@ -1,37 +1,37 @@
// check shocks on several periods
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k +1 ;
end;
steady;
check;
shocks;
var x;
periods 1 2 3 4;
values 1.1 1.2 1.3 1.4;
end;
simul(periods=200);
rplot c;
rplot k;
// check shocks on several periods
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k +1 ;
end;
steady;
check;
shocks;
var x;
periods 1 2 3 4;
values 1.1 1.2 1.3 1.4;
end;
simul(periods=200);
rplot c;
rplot k;

View File

@ -1,34 +1,34 @@
/* Test for the initval_file() command. This file needs ramst_initval_file_data.m. It should give results similar to those of ramst.mod */
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
initval_file(filename = ramst_initval_file_data);
steady;
check;
simul(periods=200);
rplot c;
rplot k;
/* Test for the initval_file() command. This file needs ramst_initval_file_data.m. It should give results similar to those of ramst.mod */
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
initval_file(filename = ramst_initval_file_data);
steady;
check;
simul(periods=200);
rplot c;
rplot k;

View File

@ -1,65 +1,65 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
estimation(datafile=data_ca1,first_obs=8,nobs=[76 79],mh_nblocks=10,prefilter=1,mh_jscale=0.5,mh_replic=0,forecast=8);
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
estimation(datafile=data_ca1,first_obs=8,nobs=[76 79],mh_nblocks=10,prefilter=1,mh_jscale=0.5,mh_replic=0,forecast=8);

View File

@ -1,65 +1,65 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
estimation(datafile=data_ca1,first_obs=8,nobs=[76 79],mh_nblocks=1,prefilter=1,mh_jscale=0.5,mh_replic=2000,forecast=8) y_obs R_obs pie_obs dq de;;
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
estimation(datafile=data_ca1,first_obs=8,nobs=[76 79],mh_nblocks=1,prefilter=1,mh_jscale=0.5,mh_replic=2000,forecast=8) y_obs R_obs pie_obs dq de;;

View File

@ -1,36 +1,36 @@
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k +1 ;
end;
steady;
check;
shocks;
var x;
periods 1;
values 1.2;
end;
simul(periods=200);
rplot c;
rplot k;
var c k;
varexo x;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k +1 ;
end;
steady;
check;
shocks;
var x;
periods 1;
values 1.2;
end;
simul(periods=200);
rplot c;
rplot k;

View File

@ -1,37 +1,37 @@
var c k a;
varexo e;
parameters alpha beta delta gamma rho;
beta = 0.95;
delta = 1;
alpha = 0.3;
rho = 0;
gamma = 2;
model;
exp(c) + exp(k) = (1-delta) * exp(k(-1)) + exp(a) * exp(k(-1))^alpha;
exp(c)^(-gamma) = beta * exp(c(+1))^(-gamma) * (exp(a(+1)) * alpha * exp(k)^(alpha-1) + 1 - delta);
a = rho * a(-1) + e;
end;
initval;
k=0;
c=0;
a=0;
e=0;
end;
Sigma_e_ = 1;
stoch_simul(nomoments,nocorr,ar=0,irf=0);
global dr_
load objectives/sgu_ex1;
test(oo_.dr.ghx,dr_obj_.ghx,1);
test(oo_.dr.ghu,dr_obj_.ghu,2);
test(oo_.dr.ghxx,dr_obj_.ghxx,3);
test(oo_.dr.ghxu,dr_obj_.ghxu,4);
test(oo_.dr.ghuu,dr_obj_.ghuu,5);
var c k a;
varexo e;
parameters alpha beta delta gamma rho;
beta = 0.95;
delta = 1;
alpha = 0.3;
rho = 0;
gamma = 2;
model;
exp(c) + exp(k) = (1-delta) * exp(k(-1)) + exp(a) * exp(k(-1))^alpha;
exp(c)^(-gamma) = beta * exp(c(+1))^(-gamma) * (exp(a(+1)) * alpha * exp(k)^(alpha-1) + 1 - delta);
a = rho * a(-1) + e;
end;
initval;
k=0;
c=0;
a=0;
e=0;
end;
Sigma_e_ = 1;
stoch_simul(nomoments,nocorr,ar=0,irf=0);
global dr_
load objectives/sgu_ex1;
test(oo_.dr.ghx,dr_obj_.ghx,1);
test(oo_.dr.ghu,dr_obj_.ghu,2);
test(oo_.dr.ghxx,dr_obj_.ghxx,3);
test(oo_.dr.ghxu,dr_obj_.ghxu,4);
test(oo_.dr.ghuu,dr_obj_.ghuu,5);
disp('TESTS OK');