diff --git a/tests/example1_model_block_declared_vars.mod b/tests/example1_model_block_declared_vars.mod index 50f937126b07179d31004c448597d47bf9c921c5..d9b64f27d3ec43546a4ecbd1019e2f16b3d0ca1f 100644 --- a/tests/example1_model_block_declared_vars.mod +++ b/tests/example1_model_block_declared_vars.mod @@ -1,13 +1,15 @@ -// Example 1 from Collard's guide to Dynare -var c, a, h, b; - -verbatim; -% I want these comments included in -% example1.m 1999q1 1999y -% -var = 1; -end; +// Declaration of some endogenous variables. +var c; + +/* +** REMARKS +** +** Some declarations for the endogenous variables are missing. They are declared below in +** the model block. +** +*/ +// Declaration of some of the parameters. parameters beta, rho, theta, psi, tau; rho = 0.95; @@ -15,19 +17,51 @@ tau = 0.025; beta = 0.99; psi = 0; theta = 2.95; - phi = 0.1; +/* +** REMARKS +** +** Same remark, some parameters are defined in the below in the model block (alpha and delta). These +** variables must be calibrated after the model block (ie after the calibration). +** +** We do not declare the exogenous variables in the preamble. The innovations are decalred in the model +** block below. +** +*/ + model; -c*theta*h^(1+psi)=(1-alpha)*y; -k|e = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) +c*theta*h|e^(1+psi)=(1-alpha)*y; +k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) *(exp(b(+1))*alpha|p*y(+1)+(1-delta)*k)); y|e = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); -k = exp(b)*(y-c)+(1-delta|p)*k(-1); -a = rho*a(-1)+tau*b(-1) + e|x; -b = tau*a(-1)+rho*b(-1) + u|x; +k|e = exp(b)*(y-c)+(1-delta|p)*k(-1); +a|e = rho*a(-1) + e|x; +b|e = rho*b(-1) + u|x; end; +/* +** REMARKS +** +** On the fly declaration works as follows: +** +** - A symbol followed by |e implicitely declares an endogenous variable. +** - A symbol followed by |x implicitely declares an exogenous variable. +** - A symbol followed by |p implicitely declares a parameter. +** +** A parameter declared on the fly has to be calibrated after its declaration, ie after the model +** block. If the user tries to give a value to a parameter before its declaration, then Dynare +** interpret the calibration as a matlab statement, because Dynare doesn't know that the symbol is +** a parameter. +** +** By default an undeclared symbol is interpreted as an exogenous variable. Consequently, if the user +** removes an equation where an endogenous variable is declared, the status of the variable changes. +** For instance, if one comments the last equation, the law of motion of b, symbol b becomes an +** exogenous variable (whose value is zero by default). A more interesting use case, is to remove +** the first equation, the arbitrage condition between leisure and consumption. Labour supply is +** then supposed to be exogenous. +*/ + alpha = 0.36; delta = 0.025; @@ -43,9 +77,9 @@ u = 0; end; shocks; -var e; stderr 0.009; -var u; stderr 0.009; -var e, u = phi*0.009*0.009; + var e; stderr 0.009; + var u; stderr 0.009; + var e, u = phi*0.009*0.009; end; -stoch_simul; +stoch_simul(order=1);