The “mshocks” block now accepts the “learnt_in” option

kalman-mex
Sébastien Villemot 2023-10-17 17:24:15 -04:00
parent 66ccb3b3d3
commit 39f9d4352a
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
4 changed files with 57 additions and 6 deletions

View File

@ -4050,7 +4050,7 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
can be replaced by the ``multiply`` keyword.
The ``overwrite`` option says that this block cancels and replaces previous
``shocks`` blocks that have the same ``learnt_in`` option.
``shocks`` and ``mshocks`` blocks that have the same ``learnt_in`` option.
Note that a ``shocks(learnt_in=1)`` block is equivalent to a regular
:bck:`shocks` block.
@ -4124,6 +4124,49 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
Those values will be the realized ones, unless there is another
``endval(learnt_in=p)`` block with ``p>3``.
.. block:: mshocks(learnt_in=INTEGER) ;
mshocks(learnt_in=INTEGER,overwrite) ;
|br| The ``mshocks(learnt_in=INTEGER)`` syntax can be used to specify temporary
shocks that are learnt in a specific period, specified in a multiplicative
way. It should contain one or more occurences of the following group of
three lines, with the same semantics as a regular :bck:`mshocks` block::
var VARIABLE_NAME;
periods INTEGER[:INTEGER] [[,] INTEGER[:INTEGER]]...;
values DOUBLE | (EXPRESSION) [[,] DOUBLE | (EXPRESSION) ]...;
As in the regular :bck:`mshocks` block (without the ``learnt_in`` option),
the values are interpreted as a multiplicative factor over the steady state
value of the exogenous variable, either the initial steady state as given
by ``initval`` if there is no ``endval`` block, or the terminal steady
state if there is an ``endval`` block. Note that in the latter case, it is
the terminal steady state as anticipated from the period given in the
``learnt_in`` option that is used for the computation.
The ``overwrite`` option says that this block cancels and replaces previous
``shocks`` and ``mshocks`` blocks that have the same ``learnt_in`` option.
Note that a ``mshocks(learnt_in=1)`` block is equivalent to a regular
:bck:`mshocks` block.
*Example*
::
mshocks(learnt_in=2);
var x;
periods 3:4;
values 1.1;
end;
This syntax means that from the perspective of period 2, ``x`` in periods 3
and 4 is expected to be equal to 1.1 times its steady state. If there is no
``endval`` block, the initial steady state as given by ``initval`` is used;
if there is an ``endval`` block, the terminal steady state as anticipated
from the perspective of period 2 is used (as specified in the relevant
``endval(learnt_in=…`` block)).
.. command:: perfect_foresight_with_expectation_errors_setup ;
perfect_foresight_with_expectation_errors_setup (OPTIONS...);

View File

@ -117,6 +117,8 @@ else
oo_.pfwee.shocks_info(exo_id, prds, p) = oo_.pfwee.shocks_info(exo_id, prds, p) + M_.learnt_shocks(j).value;
case 'multiply'
oo_.pfwee.shocks_info(exo_id, prds, p) = oo_.pfwee.shocks_info(exo_id, prds, p) .* M_.learnt_shocks(j).value;
case 'multiply_steady_state'
oo_.pfwee.shocks_info(exo_id, prds, p) = oo_.pfwee.terminal_info(exo_id, p) * M_.learnt_shocks(j).value;
otherwise
error('Unknown type in M_.learnt_shocks')
end

@ -1 +1 @@
Subproject commit 6ec7f580d577848509d07e05f2120d4bab8c32e6
Subproject commit 6af84b8cac54777bc97d4bc232452f8cf9b4498c

View File

@ -1,5 +1,5 @@
/* Tests perfect_foresight_with_expectation_errors_{setup,solver}
using the shocks(learnt_in=) and endval(learnt_in=) syntax */
using the shocks(learnt_in=), mshocks(learnt_in=) and endval(learnt_in=) syntax */
var c k;
varexo x;
@ -45,8 +45,14 @@ end;
shocks(learnt_in = 3);
var x;
periods 3 7;
values 1.4 1.5;
periods 3;
values 1.4;
end;
mshocks(learnt_in = 3);
var x;
periods 7;
values (1.5/1.2); // 1.2 is the terminal steady as anticipated in period 3
end;
endval(learnt_in = 3);
@ -106,7 +112,7 @@ oo_.exo_simul = [ saved_exo; oo_.exo_simul ];
// Information arriving in period 3 (temp shocks + permanent shock in future)
oo_.exo_simul(4,1) = 1.4;
oo_.exo_simul(8,1) = 1.5;
oo_.exo_simul(8,1) = (1.5/1.3)*1.3;
oo_.exo_steady_state = 1.1+0.1;
oo_.exo_simul(end, 1) = oo_.exo_steady_state;
oo_.steady_state = evaluate_steady_state(oo_.steady_state, oo_.exo_steady_state, M_, options_, true);