Debian Codegraph @

tests/occbin/model_borrcon/borrcon_0_std_shocks.mod

raw
1 //Test Occbin with 1 constraint and redundant shocks; also checks whether defaults for error_* are correct
2
3 var b ${b}$ (long_name='borrowing')
4 c ${c}$ (long_name='vonsumption')
5 ec ${E(c_t)}$ (long_name='expected consumption')
6 lb ${\lambda}$ (long_name='Lagrange multiplier')
7 y ${y}$ (long_name='Output')
8 c_hat ${\hat c}$
9 b_hat ${\hat b}$
10 y_hat ${\hat y}$
11 ;
12
13 varexo junk1 u junk2 ;
14
15 parameters RHO ${\rho}$, BETA ${\beta}$, M $M$, R $R$, SIGMA ${\sigma}$, GAMMAC $\gamma_c$;
16
17 model;
18 ec = c(1);
19 c = y + b - R*b(-1) ;
20 [name = 'borrowing', bind='borrcon']
21 lb = 0;
22 [name = 'borrowing', relax='borrcon']
23 b = M*y;
24 lb = 1/c^GAMMAC - BETA*R/c(+1)^GAMMAC +junk1 + junk2;
25 log(y) = RHO*log(y(-1)) + u ;
26 c_hat = log(c) - log(steady_state(c));
27 b_hat = log(b) - log(steady_state(b));
28 y_hat = log(y) - log(steady_state(y));
29 end;
30
31 occbin_constraints;
32 name 'borrcon'; bind lb<0; relax b>M*y; error_bind abs(lb); error_relax abs(b-M*y);
33 end;
34
35 steady_state_model;
36 b=M;
37 c=1+M-R*M;
38 ec=c;
39 lb=(1-BETA*R)/c^GAMMAC;
40 y=1;
41 end;
42
43 R = 1.05;
44 BETA = 0.945;
45 RHO = 0.9;
46 SIGMA = 0.05;
47 M = 1;
48 GAMMAC = 1;
49
50 shocks;
51 var u; stderr SIGMA;
52 end;
53
54 @#include "borrcon_common.inc"
55
56 orig_results=load(['borrcon' filesep 'Output' filesep 'borrcon_results.mat']);
57 if max(max(abs(oo_.occbin.simul.piecewise-orig_results.oo_.occbin.simul.piecewise)))>1e-10
58 error('Results do not match')
59 end