Debian Codegraph @

tests/histval_initval_file/ramst_histval_file.mod

raw
1 /* Test for the histval_file() command. This file needs ramst_histval_data.m. */
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 histval_file(datafile = 'ramst_histval_data.m');
28 perfect_foresight_setup(periods = 200);
29 perfect_foresight_solver;
30 if ~oo_.deterministic_simulation.status
31 error('Perfect foresight simulation failed')
32 end
33 oo_.exo_simul = [];
34 oo_.endo_simul = [];
35
36 initval_file(filename = ramst_initval_file_data_row_vec_mat);
37 perfect_foresight_setup(periods=200);
38 if oo_.exo_simul(2) ~= 1.2
39 error('initval_file problem with exogenous variable');
40 end
41 if oo_.endo_simul(2, 2) ~= 13
42 error('initval_file option problem with endogenous variable');
43 end
44 perfect_foresight_solver;
45 if ~oo_.deterministic_simulation.status
46 error('Perfect foresight simulation failed')
47 end
48
49 initval_file(datafile = 'ramst_data.m');
50 perfect_foresight_setup(periods = 200);
51 perfect_foresight_solver;
52 if ~oo_.deterministic_simulation.status
53 error('Perfect foresight simulation failed')
54 end
55 oo_.exo_simul = [];
56 oo_.endo_simul = [];
57
58 initval_file(datafile = 'ramst_data.mat');
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 oo_.exo_simul = [];
65 oo_.endo_simul = [];
66
67 initval_file(datafile = 'ramst_data.csv');
68 perfect_foresight_setup(periods = 200);
69 perfect_foresight_solver;
70 if ~oo_.deterministic_simulation.status
71 error('Perfect foresight simulation failed')
72 end
73 oo_.exo_simul = [];
74 oo_.endo_simul = [];
75
76 initval_file(datafile = 'ramst_data.xlsx');
77 perfect_foresight_setup(periods = 200);
78 perfect_foresight_solver;
79 if ~oo_.deterministic_simulation.status
80 error('Perfect foresight simulation failed')
81 end
82 oo_.exo_simul = [];
83 oo_.endo_simul = [];
84
85 if ispc;
86 initval_file(datafile = 'ramst_data.cls');
87 perfect_foresight_setup(periods = 200);
88 perfect_foresight_solver;
89 oo_.exo_simul = [];
90 oo_.endo_simul = [];
91
92 if ~oo_.deterministic_simulation.status
93 error('Perfect foresight simulation failed')
94 end;
95 end;
96