Commit 614b79cf authored by sebastien's avatar sebastien
Browse files

Updated and enhanced tests for block and bytecode options

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3245 ac1d8469-bf42-47a9-8791-bf33cf982152
parent aa23ed73
......@@ -11,6 +11,12 @@ OCTAVE_MODS = \
ramst_initval_file.mod \
example1_varexo_det.mod \
predetermined_variables.mod \
block_bytecode/fs2000_simk.mod \
block_bytecode/fs2000_lu.mod \
block_bytecode/fs2000_bytecode.mod \
block_bytecode/ramst.mod \
block_bytecode/ireland.mod \
block_bytecode/ls2003.mod \
k_order_perturbation/fs2000k2a.mod \
k_order_perturbation/fs2000k2.mod \
k_order_perturbation/fs2000k_1.mod \
......
// Tests option block + stack_solve_algo = 3 + solve_algo = 1
// Must be launched after fs2000_simk.mod
@#define block_bytecode = 1
@#define solve_algo = 1
@#define stack_solve_algo = 3
@#include "fs2000_common.mod"
// Tests option block+bytecode
// Must be launched after fs2000_simk.mod
@#define block_bytecode = 2
@#define solve_algo = 5
@#define stack_solve_algo = 5
@#include "fs2000_common.mod"
// 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
@#define bytecode = 1
@#define block = 1
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
......@@ -32,15 +11,16 @@ rho = 0.7;
psi = 0.787;
del = 0.02;
@#if block == 1
@#if bytecode == 1
model(block, bytecode);
@#else
model(block);
@#endif
@#if block_bytecode == 2
model(block, bytecode);
@#else
model;
@# 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;
......@@ -81,20 +61,11 @@ var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
options_.maxit_=10;
@#if bytecode == 1
steady(solve_algo = 5);
@#else
steady(solve_algo = 4);
@#endif
steady(solve_algo = @{solve_algo});
@#if block_bytecode > 0
model_info;
@#if block == 0
check;
@#endif
shocks;
......@@ -103,16 +74,18 @@ periods 1;
values 0.16;
end;
@#if block == 1
@#if bytecode == 1
simul(periods=200, stack_solve_algo = 5);
@#else
simul(periods=200, stack_solve_algo = 1);
@#endif
@#else
simul(periods=200, stack_solve_algo = 0);
@#endif
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;
rplot y;
rplot k;
rplot c;
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
// Tests option block + stack_solve_algo = 2 + solve_algo = 3
// Must be launched after fs2000_simk.mod
@#define block_bytecode = 1
@#define solve_algo = 3
@#define stack_solve_algo = 2
@#include "fs2000_common.mod"
// Tests option block + stack_solve_algo = 1 + solve_algo = 2
// Must be launched after fs2000_simk.mod
@#define block_bytecode = 1
@#define solve_algo = 2
@#define stack_solve_algo = 1
@#include "fs2000_common.mod"
// Tests option block + stack_solve_algo = 4 + solve_algo = 4
// Must be launched after fs2000_simk.mod
@#define block_bytecode = 1
@#define solve_algo = 4
@#define stack_solve_algo = 4
@#include "fs2000_common.mod"
@#define block_bytecode = 0
@#define solve_algo = 2
@#define stack_solve_algo = 0
@#include "fs2000_common.mod"
......@@ -23,10 +23,7 @@ scy = 0.0040;
shy = 0.0015;
shc = 0.0010;
//model(block, bytecode, cutoff=0);
model(block,cutoff=0);
//model(block);
//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);
......@@ -42,19 +39,6 @@ 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;
*/
e=0;
eeoy=0;
eeoc=0;
......@@ -79,55 +63,18 @@ options_.dynatol=1e-12;
options_.maxit_=5;
options_.slowc=1;
steady(solve_algo=2);
//steady;
options_.dynatol=4e-5;
//check;
options_.dynatol=4e-5;
shocks;
var e;
periods 1;
values 0.02;
end;
options_.maxit_=20;
model_info;
simul(periods=2000, method=LU/*GMRES*//*bicgstab*/);
simul(periods=2000, stack_solve_algo = 1);
rplot y;
rplot k;
/*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);
*/
......@@ -18,8 +18,6 @@ rho_pies = 0.7;
model(block, bytecode, cutoff=0);
//model(sparse);
//model;
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;
......@@ -54,34 +52,8 @@ 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,nograph);
*/
options_.maxit_=100;
steady;
steady(solve_algo = 5);
model_info;
//check;
......@@ -92,12 +64,10 @@ periods 1;
values 0.5;
end;
//simul(periods=200,method=bicgstab);
simul(periods=20, markowitz=0);
simul(periods=20, markowitz=0, stack_solve_algo = 5);
rplot vv;
rplot ww;
rplot A;
rplot pie;
//stoch_simul(periods=200,order=1);
......@@ -23,7 +23,7 @@ end;
steady;
check;
//check;
shocks;
var x;
......@@ -31,7 +31,7 @@ periods 1 2 3 4;
values 1.1 1.2 1.3 1.4;
end;
simul(periods=200);
simul(periods=200, stack_solve_algo = 2);
rplot c;
rplot k;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment