Cosmetic changes (remove trailing spaces).

mr#1895
Stéphane Adjemian (Charybdis) 2021-08-16 12:26:20 +02:00
parent 12cd217edf
commit c46f661669
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
4 changed files with 101 additions and 101 deletions

View File

@ -35,7 +35,7 @@ Bibliography
* Ferris, Michael C. and Todd S. Munson (1999): “Interfaces to PATH 3.0: Design, Implementation and Usage”, *Computational Optimization and Applications*, 12(1), 207227.
* Geweke, John (1992): “Evaluating the accuracy of sampling-based approaches to the calculation of posterior moments,” in J.O. Berger, J.M. Bernardo, A.P. Dawid, and A.F.M. Smith (eds.) Proceedings of the Fourth Valencia International Meeting on Bayesian Statistics, pp. 169194, Oxford University Press.
* Geweke, John (1999): “Using simulation methods for Bayesian econometric models: Inference, development and communication,” *Econometric Reviews*, 18(1), 173.
* Giovannini, Massimo, Philipp Pfeiffer, and Marco Ratto (2021), “Efficient and robust inference of models with occasionally binding constraints,” Working Papers 2021-03, Joint Research Centre, European Commission
* Giovannini, Massimo, Philipp Pfeiffer, and Marco Ratto (2021), “Efficient and robust inference of models with occasionally binding constraints,” Working Papers 2021-03, Joint Research Centre, European Commission
* Giordani, Paolo, Michael Pitt, and Robert Kohn (2011): “Bayesian Inference for Time Series State Space Models” in: *The Oxford Handbook of Bayesian Econometrics*, ed. by John Geweke, Gary Koop, and Herman van Dijk, Oxford University Press, 61124.
* Guerrieri, Luca and Matteo Iacoviello (2015): “OccBin: A toolkit for solving dynamic models with occasionally binding constraints easily,” *Journal of Monetary Economics*, 70, 2238.
* Goffe, William L., Gary D. Ferrier, and John Rogers (1994): “Global Optimization of Statistical Functions with Simulated Annealing,” *Journal of Econometrics*, 60(1/2), 65100.

View File

@ -59,7 +59,7 @@ description, please refer to the comments inside the files themselves.
``Occbin_example.mod``
RBC model with two occasionally binding constraints. Demonstrates
RBC model with two occasionally binding constraints. Demonstrates
how to set up Occbin.
``Ramsey_Example.mod``
@ -72,4 +72,4 @@ description, please refer to the comments inside the files themselves.
File demonstrating how to conduct optimal policy experiments in a
simple New Keynesian model under commitment (Ramsey) with a user-defined
conditional steady state file
conditional steady state file

View File

@ -4628,15 +4628,15 @@ Dynare allows simulating models with up to two occasionally-binding constraints
relying on a piecewise linear solution as in *Guerrieri and Iacoviello (2015)*.
It also allows estimating such models employing either the inversion filter of
*Cuba-Borda, Guerrieri, and Iacoviello (2019)* or the piecewise Kalman filter of
*Giovannini, Pfeiffer, and Ratto (2021)*. To trigger computations involving
occasionally-binding constraints requires
*Giovannini, Pfeiffer, and Ratto (2021)*. To trigger computations involving
occasionally-binding constraints requires
#. defining and naming the occasionally-binding constraints using an ``occbin_constraints``-block
#. specifying the model equations for the respective regimes in the ``model``-block using appropriate equation tags.
#. potentially specifying a sequence of surprise shocks using a ``shocks(surprise)``-block
#. setting up Occbin simulations or estimation with ``occbin_setup``
#. triggering a simulation with ``occbin_solver`` or running ``estimation`` or ``calib_smoother``.
All of these elements are discussed in the following.
@ -4647,36 +4647,36 @@ All of these elements are discussed in the following.
name 'STRING'; bind EXPRESSION; [relax EXPRESSION;] [error_bind EXPRESSION;] [error_relax EXPRESSION;]
``STRING`` is the name of constraint that is used to reference the constraint in ``relax/bind``
equation-tags to identify the respective regime (see below). The ``bind``-expresssion is mandatory and defines
a logical condition that is evaluated in the baseline (non-binding) regime to check whether the
constraint becomes binding. In contrast, the ``relax``-expression is optional and specifies a
logical condition that is evaluated in the binding regime to check whether the regime returns
to the baseline non-binding state. If not specified, Dynare will simply check in the binding
regime whether the ``bind``-expression evaluates to false. However, there are cases
where the ``bind``-expression cannot be evaluated in the binding regime(s), because
the variables involved are constant by definition so that e.g. the value of the Lagrange
multiplier on the complementary slackness condition needs to be checked. In these cases,
it is necessary to provide an explicit condition that can be evaluated in the binding
``STRING`` is the name of constraint that is used to reference the constraint in ``relax/bind``
equation-tags to identify the respective regime (see below). The ``bind``-expresssion is mandatory and defines
a logical condition that is evaluated in the baseline (non-binding) regime to check whether the
constraint becomes binding. In contrast, the ``relax``-expression is optional and specifies a
logical condition that is evaluated in the binding regime to check whether the regime returns
to the baseline non-binding state. If not specified, Dynare will simply check in the binding
regime whether the ``bind``-expression evaluates to false. However, there are cases
where the ``bind``-expression cannot be evaluated in the binding regime(s), because
the variables involved are constant by definition so that e.g. the value of the Lagrange
multiplier on the complementary slackness condition needs to be checked. In these cases,
it is necessary to provide an explicit condition that can be evaluated in the binding
regime that allows to check whether it should be left.
Three things are important to keep in mind when specifying the expressions.
First, feasible expressions may only contain contemporaneous endogenous variables.
If you want to include leads/lags or exogenous variables, you need to define
an auxiliary variable. Second, Dynare will at the current stage not linearly
approximate the entered expressions. Because Occbin will work with a linearized
model, consistency will often require the user to enter a linearized constraint.
Otherwise, the condition employed for checking constraint violations may differ
from the one employed within model simulations based on the piecewise-linear
model solution. Third, in contrast to the original Occbin replication codes, the
variables used in expressions are not automatically demeaned, i.e. they refer to
the levels, not deviations from the steady state. To access the steady state
Three things are important to keep in mind when specifying the expressions.
First, feasible expressions may only contain contemporaneous endogenous variables.
If you want to include leads/lags or exogenous variables, you need to define
an auxiliary variable. Second, Dynare will at the current stage not linearly
approximate the entered expressions. Because Occbin will work with a linearized
model, consistency will often require the user to enter a linearized constraint.
Otherwise, the condition employed for checking constraint violations may differ
from the one employed within model simulations based on the piecewise-linear
model solution. Third, in contrast to the original Occbin replication codes, the
variables used in expressions are not automatically demeaned, i.e. they refer to
the levels, not deviations from the steady state. To access the steady state
level of a variable, the ``STEADY_STATE()``-operator can be used.
The ``error_bind`` and ``error_relax``-options are optional and allow specifying
numerical criteria for the size of the respective constraint violations employed
in numerical routines. By default, Dynare will simply use the absolute value of
the ``bind`` and ``relax`` inequalities. But occasionnally, user-specified
The ``error_bind`` and ``error_relax``-options are optional and allow specifying
numerical criteria for the size of the respective constraint violations employed
in numerical routines. By default, Dynare will simply use the absolute value of
the ``bind`` and ``relax`` inequalities. But occasionnally, user-specified
expressions perform better.
*Example*
@ -4688,20 +4688,20 @@ All of these elements are discussed in the following.
name 'INEG'; bind log_Invest-log(steady_state(Invest))<0;
end;
IRR is a constraint for irreversible investment that becomes binding if investment drops below its
steady state by more than 0.025 percent in the non-binding regime. The constraint will be relaxed whenever
the associated Lagrange multiplier ``Lambda`` in the binding regime becomes negative. Note that the
IRR is a constraint for irreversible investment that becomes binding if investment drops below its
steady state by more than 0.025 percent in the non-binding regime. The constraint will be relaxed whenever
the associated Lagrange multiplier ``Lambda`` in the binding regime becomes negative. Note that the
constraint here takes on a linear form to be consistent with a piecewise linear model solution
The specification of the model equations belonging to the respective regimes is done in the ``model``-block,
with equation tags indicating to which regime a particular equation belongs. All equations that differ across
regimes must have a ``name``-tag attached to them that allows uniquely identifying different versions of the
same equation. The name of the constraints specified is then used in conjunction with a ``bind`` or ``relax``
same equation. The name of the constraints specified is then used in conjunction with a ``bind`` or ``relax``
tag to indicate to which regime a particular equation belongs. In case of more than one occasionally-binding
constraint, if an equation belongs to several regimes (e.g. both constraints binding), the
constraint name tags must be separated by a comma. If only one name tag is present,
constraint, if an equation belongs to several regimes (e.g. both constraints binding), the
constraint name tags must be separated by a comma. If only one name tag is present,
the respective equation is assumed to hold for both states of the other constraint.
*Example*
@ -4714,24 +4714,24 @@ All of these elements are discussed in the following.
[name='investment',bind='IRR',relax='INEG']
(log_Invest - log(phi*steady_state(Invest))) = 0;
The three entered equations for the investment condition define the model
equation for all four possible combinations of the two constraints. The
first equation defines the model equation in the regime where both the
IRR and INEG constraint are binding. The second equation defines the
model equation for the regimes where the IRR constraint is non-binding,
regardless of whether the INEG constraint is binding or not. Finally,
the last equation defines the model equation for the final regime where the
The three entered equations for the investment condition define the model
equation for all four possible combinations of the two constraints. The
first equation defines the model equation in the regime where both the
IRR and INEG constraint are binding. The second equation defines the
model equation for the regimes where the IRR constraint is non-binding,
regardless of whether the INEG constraint is binding or not. Finally,
the last equation defines the model equation for the final regime where the
IRR constraint is binding, but the INEG one is not.
.. block:: shocks(surprise) ;
shocks(surprise,overwrite);
|br| The ``shocks(surprise)``-block allows specifying a sequence of temporary changes in
|br| The ``shocks(surprise)``-block allows specifying a sequence of temporary changes in
the value of exogenous variables that in each period come as a surprise to agents, i.e.
are not anticipated. Note that to actually use the specified shocks in subsequent commands
are not anticipated. Note that to actually use the specified shocks in subsequent commands
like ``occbin_solver``, the block needs to be followed by a call to ``occbin_setup``.
The block mirrors the perfect foresight syntax in that it should contain one or more
The block mirrors the perfect foresight syntax in that it should contain one or more
occurrences of the following group of three lines::
var VARIABLE_NAME;
@ -4753,36 +4753,36 @@ All of these elements are discussed in the following.
.. command:: occbin_setup ;
occbin_setup (OPTIONS...);
|br| Prepares a simulation with occasionally binding constraints. This command
|br| Prepares a simulation with occasionally binding constraints. This command
will also translate the contents of a ``shocks(surprise)``-block for use
in subsequent commands.
In order to conduct ``estimation`` with occasionally binding constraints, it needs to be
prefaced by a call to ``occbin_setup`` to trigger the use of either the inversion filter
or the piecewise Kalman filter (default). An issue that can arise in the context of
estimation is a structural shock dropping out of the model in a particular regime.
For example, at the zero lower bound on interest rates, the monetary policy shock
in the Taylor rule will not appear anymore. This may create a problem
of stochastic singularity if there are then more observables than shocks. To
avoid this issue, the data points for the zero interest rate should be set
to NaN and the standard deviation of the associated shock set to 0 for the
corresponding periods using the ``heteroskedastic_shocks``-block.
In order to conduct ``estimation`` with occasionally binding constraints, it needs to be
prefaced by a call to ``occbin_setup`` to trigger the use of either the inversion filter
or the piecewise Kalman filter (default). An issue that can arise in the context of
estimation is a structural shock dropping out of the model in a particular regime.
For example, at the zero lower bound on interest rates, the monetary policy shock
in the Taylor rule will not appear anymore. This may create a problem
of stochastic singularity if there are then more observables than shocks. To
avoid this issue, the data points for the zero interest rate should be set
to NaN and the standard deviation of the associated shock set to 0 for the
corresponding periods using the ``heteroskedastic_shocks``-block.
*Example*
::
occbin_setup(likelihood_inversion_filter,smoother_inversion_filter);
occbin_setup(likelihood_inversion_filter,smoother_inversion_filter);
estimation(smoother,heteroskedastic_filter,...);
The above piece of code sets up an estimation employing the inversion filter for both the likelihood
evaluation and the smoother, while also accounting for ``heteroskedastic_shocks`` using the
evaluation and the smoother, while also accounting for ``heteroskedastic_shocks`` using the
``heteroskedastic_filter``-option.
Be aware that Occbin has largely command-specific options, i.e. there are separate
options to control the behavior of Occbin when called by the smoother or when
computing the likelihood. These latter commands will not inherit the options
potentially previously set for simulations.
options to control the behavior of Occbin when called by the smoother or when
computing the likelihood. These latter commands will not inherit the options
potentially previously set for simulations.
*Options*
@ -4797,13 +4797,13 @@ All of these elements are discussed in the following.
.. option:: simul_check_ahead_periods = INTEGER
Number of periods for which to check ahead for return to the baseline regime.
Number of periods for which to check ahead for return to the baseline regime.
This number should be chosen large enough, because Occbin requires the simulation
to return to the baseline regime at the end of time. Default: 200.
.. option:: simul_curb_retrench
Instead of basing the initial regime guess for the current iteration on the last iteration, update
Instead of basing the initial regime guess for the current iteration on the last iteration, update
the guess only one period at a time. This will slow down the iterations, but may lead to
more robust convergence behavior. Default: not enabled.
@ -4818,22 +4818,22 @@ All of these elements are discussed in the following.
.. option:: smoother_periods = INTEGER
Number of periods employed during the simulation when called by the smoother
Number of periods employed during the simulation when called by the smoother
(equivalent of ``simul_periods``). Default: 100.
.. option:: smoother_maxit = INTEGER
Maximum number of iterations employed during the simulation when called by the smoother
Maximum number of iterations employed during the simulation when called by the smoother
(equivalent of ``simul_maxit``). Default: 30.
.. option:: smoother_check_ahead_periods = INTEGER
Number of periods for which to check ahead for return to the baseline regime during the
Number of periods for which to check ahead for return to the baseline regime during the
simulation when called by the smoother (equivalent of ``simul_check_ahead_periods``). Default: 200.
.. option:: smoother_curb_retrench
Have the smoother invoke the ``simul_curb_retrench``-option during simulations.
Have the smoother invoke the ``simul_curb_retrench``-option during simulations.
Default: not enabled.
.. option:: smoother_periodic_solution
@ -4843,22 +4843,22 @@ All of these elements are discussed in the following.
.. option:: likelihood_periods = INTEGER
Number of periods employed during the simulation when computing the likelihood
Number of periods employed during the simulation when computing the likelihood
(equivalent of ``simul_periods``). Default: 100.
.. option:: likelihood_maxit = INTEGER
Maximum number of iterations employed during the simulation when computing the likelihood
Maximum number of iterations employed during the simulation when computing the likelihood
(equivalent of ``simul_maxit``). Default: 30.
.. option:: likelihood_check_ahead_periods = INTEGER
Number of periods for which to check ahead for return to the baseline regime during the
Number of periods for which to check ahead for return to the baseline regime during the
simulation when computing the likelihood (equivalent of ``simul_check_ahead_periods``). Default: 200.
.. option:: likelihood_curb_retrench
Have the likelihood computation invoke the ``simul_curb_retrench``-option during simulations.
Have the likelihood computation invoke the ``simul_curb_retrench``-option during simulations.
Default: not enabled.
.. option:: likelihood_periodic_solution
@ -4868,12 +4868,12 @@ All of these elements are discussed in the following.
.. option:: likelihood_inversion_filter
Employ the inversion filter of *Cuba-Borda, Guerrieri, and Iacoviello (2019)* when estimating
Employ the inversion filter of *Cuba-Borda, Guerrieri, and Iacoviello (2019)* when estimating
the model. Default: not enabled.
.. option:: likelihood_piecewise_kalman_filter
Employ the piecewise Kalman filter of *Giovannini, Pfeiffer, and Ratto (2021)* when estimating
Employ the piecewise Kalman filter of *Giovannini, Pfeiffer, and Ratto (2021)* when estimating
the model. Default: enabled.
.. option:: likelihood_max_kalman_iterations
@ -4882,12 +4882,12 @@ All of these elements are discussed in the following.
.. option:: smoother_inversion_filter
Employ the inversion filter of *Cuba-Borda, Guerrieri, and Iacoviello (2019)* when running the
Employ the inversion filter of *Cuba-Borda, Guerrieri, and Iacoviello (2019)* when running the
smoother. Default: not enabled.
.. option:: smoother_piecewise_kalman_filter
Employ the piecewise Kalman filter of *Giovannini, Pfeiffer, and Ratto (2021)* when running the
Employ the piecewise Kalman filter of *Giovannini, Pfeiffer, and Ratto (2021)* when running the
smoother. Default: enabled.
.. option:: filter_use_relaxation
@ -4903,9 +4903,9 @@ All of these elements are discussed in the following.
occbin_solver (OPTIONS...);
|br| Computes a simulation with occasionally-binding constraints based on
a piecewise-linear solution.
a piecewise-linear solution.
Note that ``occbin_setup`` must be called before this command in order for
Note that ``occbin_setup`` must be called before this command in order for
the simulation to take into account previous ``shocks(surprise)``-commands.
*Options*
@ -4943,23 +4943,23 @@ All of these elements are discussed in the following.
.. matvar:: oo_.occbin.linear
|br| Matrix storing the simulations based on the linear solution, i.e. ignoring
the occasionally binding constraint(s). The variables are arranged column by column,
in order of declaration (as in ``M_.endo_names``), while the the rows correspond to
the occasionally binding constraint(s). The variables are arranged column by column,
in order of declaration (as in ``M_.endo_names``), while the the rows correspond to
the ``simul_periods``.
.. matvar:: oo_.occbin.shocks_sequence
|br| Matrix storing the shock sequence employed during the simulation. The shocks are arranged
column by column, with their order in ``M_.exo_names`` stored in ``oo_.occbin.exo_pos``. The
|br| Matrix storing the shock sequence employed during the simulation. The shocks are arranged
column by column, with their order in ``M_.exo_names`` stored in ``oo_.occbin.exo_pos``. The
the rows correspond to the number of shock periods specified in a `surprise(shocks)`-block, which
may be smaller than ``simul_periods``.
.. matvar:: oo_.occbin.regime_history
|br| Structure storing information on the regime history, conditional on the shock that
happened in the respective period (stored along the rows). The subfield ``regime`` contains
a vector storing the regime state, while the the subfield ``regimestart`` indicates the
expected start of the respective regime state. For example, if row 40 contains ``[1,0]`` for
|br| Structure storing information on the regime history, conditional on the shock that
happened in the respective period (stored along the rows). The subfield ``regime`` contains
a vector storing the regime state, while the the subfield ``regimestart`` indicates the
expected start of the respective regime state. For example, if row 40 contains ``[1,0]`` for
``regime2`` and ``[1,6]`` for ``regimestart2``, it indicates that - after the shock in period 40
has occurred - the second constraint became binding (1) and is expected to revert to non-binding (0) six periods
later.
@ -4979,7 +4979,7 @@ All of these elements are discussed in the following.
.. option:: noconstant
Omit the steady state in the graphs.
.. command:: occbin_write_regimes ;
occbin_write_regimes (OPTIONS...);
@ -4997,7 +4997,7 @@ All of these elements are discussed in the following.
Name of the Excel-file to write. Default: ``FILENAME_occbin_regimes``.
.. _estim:
Estimation based on likelihood

View File

@ -1,18 +1,18 @@
/*
* This file shows how to solve an RBC model with two occasionally binding constraints:
* 1. The INEG constraint implements quadratic capital adjustment costs if investment
* falls below its steady state. If investment is above steady state, there are no
* falls below its steady state. If investment is above steady state, there are no
* adjustment costs
* 2. The IRR constraint implements irreversible investment. Investment cannot be lower
* 2. The IRR constraint implements irreversible investment. Investment cannot be lower
* than a factor phi of its steady state.
*
* Notes:
* - This mod-file is based on an example originally provided by Luca Guerrieri
* - This mod-file is based on an example originally provided by Luca Guerrieri
* and Matteo Iacoviello provided at https://www.matteoiacoviello.com/research_files/occbin_20140630.zip
* - The INEG constraint should theoretically be log_Invest-log(steady_state(Invest))<0, but this will lead
* to numerical issues. Instead we allow for a small negative value of <-0.000001
*
* Please note that the following copyright notice only applies to this Dynare
* Please note that the following copyright notice only applies to this Dynare
* implementation of the model.
*/
@ -42,8 +42,8 @@ var A $A$ (long_name='TFP')
log_K ${\hat K}$ (long_name='log capital')
log_Invest ${\hat I}$ (long_name='log investment')
log_C ${\hat C}$ (long_name='log consumption')
;
;
varexo epsilon $\varepsilon$ (long_name='TFP shock');
parameters alpha $\alpha$ (long_name='capital share')
@ -66,7 +66,7 @@ psi = 5;
model;
// 1.
[name='Euler', bind = 'INEG']
[name='Euler', bind = 'INEG']
-C^(-sigma)*(1+2*psi*(K/K(-1)-1)/K(-1))+ beta*C(+1)^(-sigma)*((1-delta)-2*psi*(K(+1)/K-1)*
(-K(+1)/K^2)+alpha*exp(A(+1))*K^(alpha-1))= -Lambda+beta*(1-delta)*Lambda(+1);
@ -74,7 +74,7 @@ model;
-C^(-sigma) + beta*C(+1)^(-sigma)*(1-delta+alpha*exp(A(+1))*K^(alpha-1))= -Lambda+beta*(1-delta)*Lambda(+1);
// 2.
[name='Budget constraint',bind = 'INEG']
[name='Budget constraint',bind = 'INEG']
C+K-(1-delta)*K(-1)+psi*(K/K(-1)-1)^2=exp(A)*K(-1)^(alpha);
[name='Budget constraint',relax = 'INEG']
@ -92,7 +92,7 @@ Lambda=0;
[name='investment',bind='IRR',relax='INEG']
(log_Invest - log(phi*steady_state(Invest))) = 0;
// 5.
// 5.
[name='LOM TFP']
A = rho*A(-1)+epsilon;
@ -136,4 +136,4 @@ end;
occbin_setup;
occbin_solver(simul_periods=200,simul_check_ahead_periods=200);
occbin_graph log_C epsilon Lambda log_K log_Invest A;
occbin_graph log_C epsilon Lambda log_K log_Invest A;