Debian Codegraph @

tests/on-the-fly/ex1.mod

raw
1 // --+ options: nostrict +--
2 /*
3 ** In the following example, the types (exogenous variable, endogenous variable, parameter) of the objects appearing in the model are declared
4 ** on the fly in the equations. With the nostrict option, an object is by default an exogenous variable (if the type of an object is not declared
5 ** in one of the equations, it will be interpreted as an exogenous variable). Without the nostrict option, Dynare will raise an error if the model
6 ** contains untyped objects.
7 **
8 ** An object followed by |e is an endogenous variable,
9 ** |x is an exogenous variable,
10 ** |p is a parameter.
11 **
12 ** Example. If the first equation (consumption/leisure arbitrage) is removed from the following model block, then h (hours)
13 ** will be interpreted as an exogenous variable.
14 */
15
16 model;
17 c*theta|p*h|e^(1+psi|p)=(1-alpha)*y;
18 k|e = beta|p*(((exp(b)*c)/(exp(b(+1))*c(+1)))
19 *(exp(b(+1))*alpha|p*y(+1)+(1-delta)*k));
20 y|e = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
21 k = exp(b)*(y-c|e)+(1-delta|p)*k(-1);
22 a|e = rho|p*a(-1)+tau*b(-1) + e|x;
23 b|e = tau|p*a(-1)+rho*b(-1) + u|x;
24 end;
25
26 alpha = 0.36;
27 rho = 0.95;
28 tau = 0.025;
29 beta = 0.99;
30 delta = 0.025;
31 psi = 0;
32 theta = 2.95;
33 phi = 0.1;
34
35 if ~isequal(length(intersect(M_.endo_names, {'c'; 'h'; 'y'; 'k'; 'b'; 'a'})), 6)
36 error('Endogenous variables are wrong.')
37 end
38
39 if ~isequal(length(intersect(M_.param_names, {'theta'; 'psi'; 'alpha'; 'beta'; 'delta'; 'rho'; 'tau'})), 7)
40 error('Parameters are wrong.')
41 end
42
43 if ~isequal(length(intersect(M_.exo_names, {'e'; 'u'})), 2)
44 error('Exogenous variables are wrong.')
45 end