Debian Codegraph @

tests/preprocessor_checks/ramst_model_edit.mod

raw
1 /* Test for multiple model blocks, model_remove, model_options and var_remove commands,
2 and model_replace block.
3 It should give the same results as ramst.mod. */
4
5 var c k;
6 varexo x;
7
8 var dummy1 dummy2 dummy3;
9
10 parameters alph gam delt bet aa;
11 alph=0.5;
12 gam=0.5;
13 delt=0.02;
14 bet=0.05;
15 aa=0.5;
16
17 model;
18 [ name = 'ressource constraint' ]
19 c + k = aa*x*k(-1)^alph;
20 end;
21
22 model;
23 [ name = 'eq:dummy1', endogenous = 'dummy1' ]
24 dummy1 = c + 1;
25 [ foo = 'eq:dummy2' ] // Since dummy2 is alone on the LHS, it is considered as the variable set by this equation
26 log(dummy2) = k + 2;
27 [ name = 'eq:dummy3', bar = 'baz' ]
28 c(+1) = c;
29 end;
30
31 model_options(block);
32
33 model_remove('eq:dummy1', foo = 'eq:dummy2');
34
35 model_replace('ressource constraint', [ name = 'eq:dummy3', bar = 'baz' ]);
36 c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
37 c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
38 end;
39
40 var_remove dummy3;
41
42 initval;
43 x = 1;
44 k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
45 c = aa*k^alph-delt*k;
46 end;
47
48 steady;
49
50 check;
51
52 shocks;
53 var x;
54 periods 1;
55 values 1.2;
56 end;
57
58 perfect_foresight_setup(periods=200);
59 perfect_foresight_solver;
60
61 S = load('../deterministic_simulations/ramst/Output/ramst_results.mat');
62 if any(size(oo_.endo_simul) ~= size(S.oo_.endo_simul)) || any(any(abs(oo_.endo_simul - S.oo_.endo_simul) > 1e-10))
63 error('Model editing failure')
64 end