Perfect foresight with expectation errors: change the semantics of endval(learnt_in=…)

Similarly to the regular “endval” block, any variable mentioned in this
block will jump to its new value in the period where the information is learnt.
In particular, this means that any temporary shock that may have been
anticipated on that variable (as specified through a “shocks(learnt_in=...)”
block for a previous informational period) will be overwritten.
kalman-mex
Sébastien Villemot 2023-10-20 15:54:48 -04:00
parent df9c7d85b8
commit 8c3429bb0f
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
3 changed files with 30 additions and 9 deletions

View File

@ -4110,6 +4110,17 @@ and ``endval`` blocks which are given a special ``learnt_in`` option.
Note that an ``endval(learnt_in=1)`` block is equivalent to a regular
:bck:`endval` block.
Also note that, similarly to the regular :bck:`endval` block, any variable
specified in this block will jump to its new value in the same period as
the one in which the information is learnt; and, from the perspective of
that period, the variable is expected by agents to remain to that value
until the end of the simulation. In particular, this means that any
temporary shock that may have been anticipated on that variable (as
specified through a ``shocks(learnt_in=...)`` block for a previous
informational period) will be overridden; if this is not the desired
behaviour, then the temporary shock will have to be reinstated through
another ``shocks(learnt_in=...)`` block.
It is possible to express the terminal condition by specifying the level of
the exogenous variable (using an equal symbol, as in a regular
:bck:`endval` blocks without the ``learnt_in`` option). But it is also
@ -4139,6 +4150,14 @@ 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``.
The three variables will jump to their new value in period 3 and, from the
perspective of period 3, they are expected by agents to remain there until
the end of the simulation. In particular, any temporary shock on either
``x``, ``y`` or ``z`` specified through a regular ``shocks`` block or
through a ``shocks(learnt_in=2)`` block will be overridden. If this is not
the desired behaviour, a ``shocks(learnt_in=3)`` block will have to be
added to reinstate the temporary shock.
.. block:: mshocks(learnt_in=INTEGER) ;
mshocks(learnt_in=INTEGER,OPTIONS...) ;

View File

@ -92,6 +92,7 @@ else
%% Construct information sets for subsequent informational periods
for p = 2:periods
oo_.pfwee.terminal_info(:, p) = oo_.pfwee.terminal_info(:, p-1);
oo_.pfwee.shocks_info(:, :, p) = oo_.pfwee.shocks_info(:, :, p-1);
if ~isempty(M_.learnt_endval)
idx = find([M_.learnt_endval.learnt_in] == p);
for i = 1:length(idx)
@ -101,15 +102,15 @@ else
case 'level'
oo_.pfwee.terminal_info(exo_id, p) = M_.learnt_endval(j).value;
case 'add'
oo_.pfwee.terminal_info(exo_id, p) = oo_.pfwee.terminal_info(exo_id, p) + M_.learnt_endval(j).value;
oo_.pfwee.terminal_info(exo_id, p) = oo_.pfwee.terminal_info(exo_id, p-1) + M_.learnt_endval(j).value;
case 'multiply'
oo_.pfwee.terminal_info(exo_id, p) = oo_.pfwee.terminal_info(exo_id, p) * M_.learnt_endval(j).value;
oo_.pfwee.terminal_info(exo_id, p) = oo_.pfwee.terminal_info(exo_id, p-1) * M_.learnt_endval(j).value;
otherwise
error('Unknown type in M_.learnt_endval')
end
oo_.pfwee.shocks_info(exo_id, p:end, p) = oo_.pfwee.terminal_info(exo_id, p);
end
end
oo_.pfwee.shocks_info(:, :, p) = oo_.pfwee.shocks_info(:, :, p-1);
if ~isempty(M_.learnt_shocks)
idx = find([M_.learnt_shocks.learnt_in] == p);
for i = 1:length(idx)
@ -120,9 +121,9 @@ else
case 'level'
oo_.pfwee.shocks_info(exo_id, prds, p) = M_.learnt_shocks(j).value;
case 'add'
oo_.pfwee.shocks_info(exo_id, prds, p) = oo_.pfwee.shocks_info(exo_id, prds, p) + M_.learnt_shocks(j).value;
oo_.pfwee.shocks_info(exo_id, prds, p) = oo_.pfwee.shocks_info(exo_id, prds, p-1) + 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;
oo_.pfwee.shocks_info(exo_id, prds, p) = oo_.pfwee.shocks_info(exo_id, prds, p-1) .* 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

View File

@ -100,7 +100,7 @@ perfect_foresight_solver(true);
% Information arriving in period 2 (temp shock now + permanent shock in future)
oo_.exo_simul(3,1) = 1.3;
oo_.exo_steady_state = 1.1;
oo_.exo_simul(end, 1) = oo_.exo_steady_state;
oo_.exo_simul(4:end, 1) = oo_.exo_steady_state;
oo_.steady_state = evaluate_steady_state(oo_.steady_state, oo_.exo_steady_state, M_, options_, true);
oo_.endo_simul(:, end) = oo_.steady_state;
options_.periods = 6;
@ -116,7 +116,8 @@ oo_.exo_simul = [ saved_exo; oo_.exo_simul ];
oo_.exo_simul(4,1) = 1.4;
oo_.exo_steady_state = 1.1+0.1;
oo_.exo_simul(8,1) = (1.5/1.2)*oo_.exo_steady_state;
oo_.exo_simul(end, 1) = oo_.exo_steady_state;
oo_.exo_simul(5:7, 1) = oo_.exo_steady_state;
oo_.exo_simul(9:end, 1) = oo_.exo_steady_state;
oo_.steady_state = evaluate_steady_state(oo_.steady_state, oo_.exo_steady_state, M_, options_, true);
oo_.endo_simul(:, end) = oo_.steady_state;
options_.periods = 5;
@ -129,10 +130,10 @@ oo_.endo_simul = [ saved_endo oo_.endo_simul ];
oo_.exo_simul = [ saved_exo; oo_.exo_simul ];
% Information arriving in period 6 (temp shocks + permanent shock)
oo_.exo_simul(7,1) = 1*0.8;
oo_.exo_simul(7,1) = (1.1+0.1)*0.8;
oo_.exo_simul(8,1) = 1.5*0.8;
oo_.exo_steady_state = (1.1+0.1)*0.75;
oo_.exo_simul(end, 1) = oo_.exo_steady_state;
oo_.exo_simul(9:end, 1) = oo_.exo_steady_state;
oo_.steady_state = evaluate_steady_state(oo_.steady_state, oo_.exo_steady_state, M_, options_, true);
oo_.endo_simul(:, end) = oo_.steady_state;
options_.periods = 2;