Skip to content
Snippets Groups Projects
Verified Commit 4f6344e6 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Allow model-local variables with leads or lags

Closes: #1929
parent ba2cc7ad
Branches
Tags
No related merge requests found
...@@ -962,7 +962,10 @@ The model is declared inside a ``model`` block: ...@@ -962,7 +962,10 @@ The model is declared inside a ``model`` block:
equal sign, and the expression for which this new variable will equal sign, and the expression for which this new variable will
stand. Later on, every time this variable appears in the model, stand. Later on, every time this variable appears in the model,
Dynare will substitute it by the expression assigned to the Dynare will substitute it by the expression assigned to the
variable. Note that the scope of this variable is restricted to variable (if the model-local variable appears with a lead or a lag
attached to it between parenthesis, the substitution will be done by
shifting the expression accordingly).
Note that the scope of this variable is restricted to
the model block; it cannot be used outside. To assign a LaTeX name the model block; it cannot be used outside. To assign a LaTeX name
to the model local variable, use the declaration syntax outlined to the model local variable, use the declaration syntax outlined
by :comm:`model_local_variable`. A model local variable declaration by :comm:`model_local_variable`. A model local variable declaration
......
Subproject commit 31080eed6ce6c623863850d4e2da5f8317f2b5d0 Subproject commit 84d792bced340c52d90cd962e51e22eec605cea0
// Tests for model local variables /* Tests for model-local variables
// (including in params derivs file, i.e. with identification, see Dynare/preprocessor#13) (including in params derivs file, i.e. with identification, see Dynare/preprocessor#13)
Also tests the possibility of having a lead/lag on a model-local variable
(recursively in the definition of another such variable) (see #1929)
*/
var c, y, k, a, h, b; var c, y, k, a, h, b;
varexo e, u; varexo e, u;
...@@ -22,8 +25,8 @@ phi = 0.1; ...@@ -22,8 +25,8 @@ phi = 0.1;
model_local_variable foo $\text{foo}$; model_local_variable foo $\text{foo}$;
model; model;
#bar = exp(b)*c; #bar = exp(b(+1))*c(+1);
#foo = bar/(exp(b(+1))*c(+1)); #foo = bar(-1)/(exp(b(+1))*c(+1));
c*theta*h^(1+psi)=(1-alpha)*y; c*theta*h^(1+psi)=(1-alpha)*y;
k = beta*(foo k = beta*(foo
*(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); *(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment