Differences between revisions 1 and 2
Revision 1 as of 2014-02-16 11:12:30
Size: 79
Comment: Created Page
Revision 2 as of 2014-03-03 13:30:01
Size: 6748
Comment: Elaborate on Problem
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

The generic setup to to think about this issue is one of finding the optimal path for the endogenous variables, denoted here with y, given the path for exogenous variables, denoted with x.
In addition, the endogenous variables are separated into backward- and forward-looking ones, y_forward and y_backward. Due to the presence of those variables, initial and terminal conditions are required.

For the sake of concreteness, assume the horizon is {{{periods=100}}} and {{{max_endo_lead=3}}} and {{{max_endo_lag=3}}}.

Dynare transforms this problem into one with 1 lead and lag by using auxiliary variables.

= Functionality of Different Blocks =

Here is what the respective Dynare blocks do:

 1. General Initialization:
  * periods -2 to 103 are set to +0
 1. {{{initval}}}-block
  * Main Purpose: set initial conditions at t=-2 to t=0 for respective specified values. All unspecified values are kept at zero.
  * Interaction with {{{steady}}}: use specified exogenous values to compute conditional steady state for endogenous variables and set t=-2 to t=0 to these values
  * Auxiliary Purposes:
   i. set terminal values for the endogenous variables (t=101 to 103) and the starting values for the optimizer from t=1 to t=100 to the specified values.
   i. set exogenous variables variables for simulation period from t=1 to t=103 to specified values.
 1. {{{endval}}}-block
  * Main Purpose: set terminal conditions at t=101 to t=103 for respective specified values. All unspecified values are kept at zero.
  * Interaction with {{{steady}}}: use specified exogenous values to compute conditional steady state for endogenous variables and set t=101 to t=103 to these values
  * Auxiliary Purposes:
   i. set the starting values for the optimizer from t=1 to t=100 to the specified values; without {{{initval}}}, t=-2 to t=0 initial conditions stay at 0
   i. Set exogenous variables variables for simulation period from t=1 to t=100 to specified values, thereby overriding {{{initval}}}'s values
 1. {{{histval}}}-block
  * Main Purpose: sets initial conditions at t=-2 to t=0 for respective specified values. All unspecified values are kept at zero, even if {{{initval}}} is present
  * Interaction with {{{steady}}}: none. In contrast to other blocks, providing only exogenous variables and then computing a conditional steady state is not possible
  * currently excludes use of {{{endval}}}: after the last period specified in {{{histval}}}, the values from {{{initval}}} are used
 1. {{{shocks}}}-block
  * Main Purpose: sets values for exogenous variables for t=1 to t=100 for respective specified values. All unspecified values are kept at the values they inherit from either {{{initval}}} or {{{endval}}}.

= The Problem =

The auxiliary functionality of setting exogenous variables to the specified values even outside of the time periods for which the respective block is specified makes it confusing for users and is restrictive. In particular, depending on the presence of {{{histval}}}, {{{initval}}} changes its meaning, because:
 a. initial steady state + terminal steady state : {{{initval}}} + {{{endval}}}
 a. arbitrary initial condition + terminal steady state: {{{histval}}} + {{{initval}}}

Consider the example:
{{{
initval;
x = 1;
end;
steady;

endval;
x = 1.1;
steady;

shocks;
var x;
periods 1;
values 1.2;
end;
}}}
This sets {{{x}}} to
{{{#!latex
\[x = \left\{ {\begin{array}{*{20}{c}}
  {1 \: for \: t = - 2 \: to \: t = 0} \\
  {1.2 \: for \: t = 1} \\
  {1.1 \: for \: t = 2 \: to \: t = 103}
\end{array}} \right.\]
}}}

and {{{y}}} to
{{{#!latex
\[y = \left\{ {\begin{array}{*{20}{c}}
  {\bar y \: given \: x=1 \: for \:t = - 2 \: to \: t = 0} \\
  {\bar y \: given \: x=1.2 \: for \: t = 1} \\
  {\bar y \: given \: x=1.1 \: for \: t = 2 \: to \: t = 103}
\end{array}} \right.\]
}}}
Doing the same in the presence of {{{histval}}} requires
{{{
initval;
x = 1.1;
end;
steady;

histval;
x(-2) = 1;
x(-1) = 1;
x(-0) = 1;
y(-2) = ...;
y(-1) = ...;
y(-0) = ...;
end;

shocks;
var x;
periods 1;
values 1.2;
end;
}}}
That is, {{{initval}}} now takes over the function of setting the terminal steady state. At the same time, all initial values need to be entered explicitly as {{{initval}}} does not work with {{{steady}}}.

== Potential Improvements: ==
 1. Keep functionality of blocks constant regardless of other blocks. This minimizes interactions.
  a. even in the presence of a {{{histval}}}-block, {{{initval}}} should set the initial conditions. {{{histval}}} then selectively overrides those initial values (requires {{{initval}}} always before {{{histval}}})
  a. this would then allow using {{{endval}}} to set the terminal steady state even in the presence of {{{histval}}}
 1. Restrict the functionality of the blocks to what their name says and add dedicated blocks for auxiliary functions
  a. {{{initval}}}, {{{endval}}}, and {{{histval}}} only set initial and terminal conditions
  a. add blocks or functionality for setting exogenous variables that are constant at a particular value for the simulation periods from t=1 to 100. This functionality is basically already there with the {{{shocks}}}-block and is rather dirtily hacked by using {{{initval}}} and {{{endval}}} to set permanent values
  a. Add block to specify starting values. This block could allow specifying them explicitly or selecting the initial or terminal steady state (basically what {{{initval}}} if present alone and {{{endval}}} already do). Moreover, one could allow for using the steady state conditional on the specified exogenous variables, which could be useful if a {{{steady_state_model}}}-block is present
 1. allow {{{histval}}} with {{{steady}}}. This would prevent users from being forced to enter all endogenous variables manually.
 1. Potentially make {{{endval}}} also set initial conditions in the same way {{{initval}}} sets terminal conditions already (0 often is a poor initial condition) or always require {{{initval}}}-block.

Problems with the above suggestions:
   1. backward compatibility
   2. forces users to always specify {{{initval}}}, {{{endval}}}, and {{{shocks}}}-blocks. I see this as an advantage as it cleans up mod-files by making transparent which elements belong to the problem and need to be specified. If needed, one could still emulate the old behavior by allowing for an initial-value option for {{{endval}}} to emulate what happens if {{{endval}}} was not present and a terminal value option of {{{shocks}}} to emulate what happens when {{{endval}}} and no {{{shocks}}} block was present.

Interaction of initval, endval, and histval for deterministic simulations

The generic setup to to think about this issue is one of finding the optimal path for the endogenous variables, denoted here with y, given the path for exogenous variables, denoted with x. In addition, the endogenous variables are separated into backward- and forward-looking ones, y_forward and y_backward. Due to the presence of those variables, initial and terminal conditions are required.

For the sake of concreteness, assume the horizon is periods=100 and max_endo_lead=3 and max_endo_lag=3.

Dynare transforms this problem into one with 1 lead and lag by using auxiliary variables.

Functionality of Different Blocks

Here is what the respective Dynare blocks do:

  1. General Initialization:
    • periods -2 to 103 are set to +0
  2. initval-block

    • Main Purpose: set initial conditions at t=-2 to t=0 for respective specified values. All unspecified values are kept at zero.
    • Interaction with steady: use specified exogenous values to compute conditional steady state for endogenous variables and set t=-2 to t=0 to these values

    • Auxiliary Purposes:
      1. set terminal values for the endogenous variables (t=101 to 103) and the starting values for the optimizer from t=1 to t=100 to the specified values.
      2. set exogenous variables variables for simulation period from t=1 to t=103 to specified values.
  3. endval-block

    • Main Purpose: set terminal conditions at t=101 to t=103 for respective specified values. All unspecified values are kept at zero.
    • Interaction with steady: use specified exogenous values to compute conditional steady state for endogenous variables and set t=101 to t=103 to these values

    • Auxiliary Purposes:
      1. set the starting values for the optimizer from t=1 to t=100 to the specified values; without initval, t=-2 to t=0 initial conditions stay at 0

      2. Set exogenous variables variables for simulation period from t=1 to t=100 to specified values, thereby overriding initval's values

  4. histval-block

    • Main Purpose: sets initial conditions at t=-2 to t=0 for respective specified values. All unspecified values are kept at zero, even if initval is present

    • Interaction with steady: none. In contrast to other blocks, providing only exogenous variables and then computing a conditional steady state is not possible

    • currently excludes use of endval: after the last period specified in histval, the values from initval are used

  5. shocks-block

    • Main Purpose: sets values for exogenous variables for t=1 to t=100 for respective specified values. All unspecified values are kept at the values they inherit from either initval or endval.

The Problem

The auxiliary functionality of setting exogenous variables to the specified values even outside of the time periods for which the respective block is specified makes it confusing for users and is restrictive. In particular, depending on the presence of histval, initval changes its meaning, because:

  1. initial steady state + terminal steady state : initval + endval

  2. arbitrary initial condition + terminal steady state: histval + initval

Consider the example:

initval;
x = 1;
end;
steady;

endval;
x = 1.1;
steady;

shocks;
var x;
periods 1;
values 1.2;
end;

This sets x to

\[x = \left\{ {\begin{array}{*{20}{c}}
  {1 \: for \: t =  - 2 \: to \: t = 0} \\
  {1.2 \: for \: t = 1} \\
  {1.1 \: for \: t = 2 \: to \: t = 103}
\end{array}} \right.\]

and y to

\[y = \left\{ {\begin{array}{*{20}{c}}
  {\bar y \: given \: x=1 \: for \:t =  - 2 \: to \: t = 0} \\
  {\bar y \: given \: x=1.2 \: for \: t = 1} \\
  {\bar y \: given \: x=1.1 \: for \: t = 2 \: to \: t = 103}
\end{array}} \right.\]

Doing the same in the presence of histval requires

initval;
x = 1.1;
end;
steady;

histval;
x(-2) = 1;
x(-1) = 1;
x(-0) = 1;
y(-2) = ...;
y(-1) = ...;
y(-0) = ...;
end;

shocks;
var x;
periods 1;
values 1.2;
end;

That is, initval now takes over the function of setting the terminal steady state. At the same time, all initial values need to be entered explicitly as initval does not work with steady.

Potential Improvements:

  1. Keep functionality of blocks constant regardless of other blocks. This minimizes interactions.
    1. even in the presence of a histval-block, initval should set the initial conditions. histval then selectively overrides those initial values (requires initval always before histval)

    2. this would then allow using endval to set the terminal steady state even in the presence of histval

  2. Restrict the functionality of the blocks to what their name says and add dedicated blocks for auxiliary functions
    1. initval, endval, and histval only set initial and terminal conditions

    2. add blocks or functionality for setting exogenous variables that are constant at a particular value for the simulation periods from t=1 to 100. This functionality is basically already there with the shocks-block and is rather dirtily hacked by using initval and endval to set permanent values

    3. Add block to specify starting values. This block could allow specifying them explicitly or selecting the initial or terminal steady state (basically what initval if present alone and endval already do). Moreover, one could allow for using the steady state conditional on the specified exogenous variables, which could be useful if a steady_state_model-block is present

  3. allow histval with steady. This would prevent users from being forced to enter all endogenous variables manually.

  4. Potentially make endval also set initial conditions in the same way initval sets terminal conditions already (0 often is a poor initial condition) or always require initval-block.

Problems with the above suggestions:

  1. backward compatibility
  2. forces users to always specify initval, endval, and shocks-blocks. I see this as an advantage as it cleans up mod-files by making transparent which elements belong to the problem and need to be specified. If needed, one could still emulate the old behavior by allowing for an initial-value option for endval to emulate what happens if endval was not present and a terminal value option of shocks to emulate what happens when endval and no shocks block was present.

DynareWiki: DeterministicSimulationBlocks (last edited 2022-10-14 10:48:57 by JohannesPfeifer)