Debian Codegraph @

tests/histval_initval_file/ramst_initval_file.mod

raw
1 /* Test for the initval_file() command. This file needs ramst_initval_file_data.m. It should give results similar to those of ramst.mod */
2
3 var c k;
4 varexo x;
5
6 parameters alph gam delt bet aa;
7 alph=0.5;
8 gam=0.5;
9 delt=0.02;
10 bet=0.05;
11 aa=0.5;
12
13
14 model;
15 c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
16 c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
17 end;
18
19 initval;
20 x = 1;
21 k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
22 c = aa*k^alph-delt*k;
23 end;
24
25 steady;
26
27 initval_file(datafile = ramst_initval_file_data_row_vec_mat);
28 perfect_foresight_setup(periods=200);
29 if oo_.exo_simul(2) ~= 1.2
30 error('initval_file problem with exogenous variable');
31 end
32 if oo_.endo_simul(2, 2) ~= 13
33 error('initval_file option problem with endogenous variable');
34 end
35 perfect_foresight_solver;
36 if ~oo_.deterministic_simulation.status
37 error('Perfect foresight simulation failed')
38 end
39
40 oo_.exo_simul = [];
41 oo_.endo_simul = [];
42
43 initval_file(datafile = ramst_initval_file_data_col_vec_mat);
44
45 perfect_foresight_setup(periods=200);
46 if oo_.exo_simul(2) ~= 1.2
47 error('initval_file problem with exogenous variable');
48 end
49 if oo_.endo_simul(2, 2) ~= 13
50 error('initval_file problem with endogenous variable');
51 end
52 perfect_foresight_solver;
53 if ~oo_.deterministic_simulation.status
54 error('Perfect foresight simulation failed')
55 end
56
57 if ispc()
58 initval_file(datafile = ramst_initval_file_excel);
59 perfect_foresight_setup(periods=200);
60 perfect_foresight_solver;
61 if ~oo_.deterministic_simulation.status
62 error('Perfect foresight simulation failed');
63 end;
64 end
65
66 initval_file(datafile = 'ramst_data.m');
67 perfect_foresight_setup(periods = 200);
68 perfect_foresight_solver;
69 if ~oo_.deterministic_simulation.status
70 error('Perfect foresight simulation failed')
71 end
72 oo_.exo_simul = [];
73 oo_.endo_simul = [];
74
75 initval_file(datafile = 'ramst_data.mat');
76 perfect_foresight_setup(periods = 200);
77 perfect_foresight_solver;
78 if ~oo_.deterministic_simulation.status
79 error('Perfect foresight simulation failed')
80 end
81 oo_.exo_simul = [];
82 oo_.endo_simul = [];
83
84 initval_file(datafile = 'ramst_data.csv');
85 perfect_foresight_setup(periods = 200);
86 perfect_foresight_solver;
87 if ~oo_.deterministic_simulation.status
88 error('Perfect foresight simulation failed')
89 end
90 oo_.exo_simul = [];
91 oo_.endo_simul = [];
92
93 initval_file(datafile = 'ramst_data.xlsx');
94 perfect_foresight_setup(periods = 200);
95 perfect_foresight_solver;
96 if ~oo_.deterministic_simulation.status
97 error('Perfect foresight simulation failed')
98 end
99 oo_.exo_simul = [];
100 oo_.endo_simul = [];
101
102 if ispc;
103 initval_file(datafile = 'ramst_data.cls');
104 perfect_foresight_setup(periods = 200);
105 perfect_foresight_solver;
106 oo_.exo_simul = [];
107 oo_.endo_simul = [];
108
109 if ~oo_.deterministic_simulation.status
110 error('Perfect foresight simulation failed')
111 end;
112 end;
113