2018-10-25 16:31:53 +02:00
|
|
|
|
.. default-domain:: dynare
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
.. |br| raw:: html
|
|
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
2018-10-25 16:31:53 +02:00
|
|
|
|
####################
|
|
|
|
|
Dynare misc commands
|
|
|
|
|
####################
|
|
|
|
|
|
2024-01-17 16:18:10 +01:00
|
|
|
|
.. matcomm:: send_endogenous_variables_to_workspace ;
|
2023-12-11 10:39:17 +01:00
|
|
|
|
|
|
|
|
|
Puts the simulation results for the endogenous variables stored in ``oo_.endo_simul``
|
|
|
|
|
into vectors with the same name as the respective variables into the base workspace.
|
|
|
|
|
|
2024-01-17 16:18:10 +01:00
|
|
|
|
.. matcomm:: send_exogenous_variables_to_workspace ;
|
2023-12-11 10:39:17 +01:00
|
|
|
|
|
|
|
|
|
Puts the simulation results for the exogenous variables stored in ``oo_.exo_simul``
|
|
|
|
|
into vectors with the same name as the respective variables into the base workspace.
|
|
|
|
|
|
2024-01-17 16:18:10 +01:00
|
|
|
|
.. matcomm:: send_irfs_to_workspace ;
|
2023-12-11 10:39:17 +01:00
|
|
|
|
|
|
|
|
|
Puts the IRFs stored in ``oo_.irfs`` into vectors with the same name into the base workspace.
|
|
|
|
|
|
2018-10-25 16:31:53 +02:00
|
|
|
|
.. command:: prior_function(OPTIONS);
|
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
Executes a user-defined function on parameter draws from the prior
|
2019-02-04 14:44:01 +01:00
|
|
|
|
distribution. Dynare returns the results of the computations for
|
2023-03-05 18:10:33 +01:00
|
|
|
|
all draws in an `ndraws` by :math:`n` cell array named
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``oo_.prior_function_results``.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
|
|
|
|
*Options*
|
|
|
|
|
|
|
|
|
|
.. option:: function = FUNCTION_NAME
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
The function must have the following header ``output_cell =
|
|
|
|
|
FILENAME(xparam1,M_,options_,oo_,estim_params_,bayestopt_,dataset_,dataset_info)``,
|
|
|
|
|
providing read-only access to all Dynare structures. The only
|
|
|
|
|
output argument allowed is a :math:`1 \times n` cell array,
|
|
|
|
|
which allows for storing any type of output/computations. This
|
|
|
|
|
option is required.
|
|
|
|
|
|
2018-10-25 16:31:53 +02:00
|
|
|
|
.. option:: sampling_draws = INTEGER
|
|
|
|
|
|
|
|
|
|
Number of draws used for sampling. Default: 500.
|
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
|br|
|
|
|
|
|
|
2018-10-25 16:31:53 +02:00
|
|
|
|
.. command:: posterior_function(OPTIONS);
|
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
Same as the :comm:`prior_function` command but for the
|
2019-02-04 14:44:01 +01:00
|
|
|
|
posterior distribution. Results returned in
|
|
|
|
|
``oo_.posterior_function_results``.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
|
|
|
|
*Options*
|
|
|
|
|
|
|
|
|
|
.. option:: function = FUNCTION_NAME
|
|
|
|
|
|
|
|
|
|
See :opt:`prior_function_function <function = FUNCTION_NAME>`.
|
2019-02-04 14:44:01 +01:00
|
|
|
|
|
2018-10-25 16:31:53 +02:00
|
|
|
|
.. option:: sampling_draws = INTEGER
|
|
|
|
|
|
|
|
|
|
See :opt:`prior_function_sampling_draws <sampling_draws = INTEGER>`.
|
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
|br|
|
|
|
|
|
|
2018-10-25 16:31:53 +02:00
|
|
|
|
.. command:: generate_trace_plots(CHAIN_NUMBER);
|
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
Generates trace plots of the MCMC draws for all estimated
|
2023-09-08 22:02:35 +02:00
|
|
|
|
parameters and the posterior density for the specified Markov Chain(s)
|
|
|
|
|
``CHAIN_NUMBER``. If ``CHAIN_NUMBER`` is a vector of integers, the trace plots
|
|
|
|
|
will plot contains separate lines for each chain.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
|br|
|
|
|
|
|
|
2018-10-25 16:31:53 +02:00
|
|
|
|
.. matcomm:: internals FLAG ROUTINENAME[.m]|MODFILENAME
|
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
Depending on the value of ``FLAG``, the ``internals`` command
|
|
|
|
|
can be used to run unitary tests specific to a MATLAB/Octave
|
|
|
|
|
routine (if available), to display documentation about a
|
|
|
|
|
MATLAB/Octave routine, or to extract some informations about the
|
|
|
|
|
state of Dynare.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
*Flags*
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
``--test``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
Performs the unitary test associated to ROUTINENAME (if this
|
|
|
|
|
routine exists and if the matlab/octave ``.m`` file has
|
|
|
|
|
unitary test sections).
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
*Example*
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
::
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
>> internals --test ROUTINENAME
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
if ``routine.m`` is not in the current directory, the full
|
|
|
|
|
path has to be given::
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
>> internals --test ../matlab/fr/ROUTINENAME
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
``--display-mh-history``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
Displays information about the previously saved MCMC draws
|
|
|
|
|
generated by a ``.mod`` file named MODFILENAME. This file must
|
|
|
|
|
be in the current directory.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
*Example*
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
::
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
>> internals --display-mh-history MODFILENAME
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
``--load-mh-history``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
Loads into the MATLAB/Octave’s workspace informations
|
2019-02-04 14:44:01 +01:00
|
|
|
|
about the previously saved MCMC draws generated by a ``.mod``
|
|
|
|
|
file named MODFILENAME.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
*Example*
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
::
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
>> internals --load-mh-history MODFILENAME
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
This will create a structure called ``mcmc_informations``
|
|
|
|
|
(in the workspace) with the following fields:
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``Nblck``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
The number of MCMC chains.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``InitialParameters``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
A ``Nblck*n``, where ``n`` is the number of estimated
|
|
|
|
|
parameters, array of doubles. Initial state of
|
|
|
|
|
the MCMC.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``LastParameters``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
A ``Nblck*n``, where ``n`` is the number of estimated
|
|
|
|
|
parameters, array of doubles. Current state of
|
|
|
|
|
the MCMC.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``InitialLogPost``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
A ``Nblck*1`` array of doubles. Initial value of the
|
|
|
|
|
posterior kernel.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``LastLogPost``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
A ``Nblck*1`` array of doubles. Current value of the
|
|
|
|
|
posterior kernel.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``InitialSeeds``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
A ``1*Nblck`` structure array. Initial state of the random
|
|
|
|
|
number generator.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``LastSeeds``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
A ``1*Nblck`` structure array. Current state of the random
|
|
|
|
|
number generator.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``AcceptanceRatio``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
A ``1*Nblck`` array of doubles. Current acceptance ratios.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
|br|
|
|
|
|
|
|
2023-10-08 20:20:52 +02:00
|
|
|
|
.. matcomm:: prior [OPTIONS[ ...]];
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
Prints information about the prior distribution given the provided
|
|
|
|
|
options. If no options are provided, the command returns the list of
|
|
|
|
|
available options.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
*Options*
|
|
|
|
|
|
|
|
|
|
.. option:: table
|
|
|
|
|
|
|
|
|
|
Prints a table describing the marginal prior distributions
|
|
|
|
|
(mean, mode, std., lower and upper bounds, HPD interval).
|
|
|
|
|
|
|
|
|
|
.. option:: moments
|
|
|
|
|
|
|
|
|
|
Computes and displays first and second order moments of the
|
|
|
|
|
endogenous variables at the prior mode (considering the
|
|
|
|
|
linearized version of the model).
|
|
|
|
|
|
|
|
|
|
.. option:: moments(distribution)
|
|
|
|
|
|
|
|
|
|
Computes and displays the prior mean and prior standard
|
|
|
|
|
deviation of the first and second moments of the endogenous
|
|
|
|
|
variables (considering the linearized version of the model) by
|
|
|
|
|
randomly sampling from the prior. The results will also be
|
|
|
|
|
stored in the ``prior`` subfolder in a
|
|
|
|
|
``_endogenous_variables_prior_draws.mat`` file.
|
|
|
|
|
|
|
|
|
|
.. option:: optimize
|
|
|
|
|
|
|
|
|
|
Optimizes the prior density (starting from a random initial
|
|
|
|
|
guess). The parameters such that the steady state does not
|
|
|
|
|
exist or does not satisfy the Blanchard and Kahn conditions
|
|
|
|
|
are penalized, as they would be when maximizing the posterior
|
|
|
|
|
density. If a significant proportion of the prior mass is
|
|
|
|
|
defined over such regions, the optimization algorithm may fail
|
|
|
|
|
to converge to the true solution (the prior mode).
|
|
|
|
|
|
|
|
|
|
.. option:: simulate
|
|
|
|
|
|
|
|
|
|
Computes the effective prior mass using a Monte-Carlo. Ideally
|
|
|
|
|
the effective prior mass should be equal to 1, otherwise
|
|
|
|
|
problems may arise when maximising the posterior density and
|
|
|
|
|
model comparison based on marginal densities may be
|
|
|
|
|
unfair. When comparing models, say :math:`A` and :math:`B`,
|
|
|
|
|
the marginal densities, :math:`m_A` and :math:`m_B`, should be
|
|
|
|
|
corrected for the estimated effective prior mass
|
|
|
|
|
:math:`p_A\neq p_B \leq 1` so that the prior mass of the
|
|
|
|
|
compared models are identical.
|
|
|
|
|
|
|
|
|
|
.. option:: plot
|
|
|
|
|
|
|
|
|
|
Plots the marginal prior density.
|
|
|
|
|
|
|
|
|
|
|br|
|
|
|
|
|
|
|
|
|
|
.. matcomm:: search VARIABLENAME[ OPTION]
|
2020-01-08 12:48:39 +01:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
Searches all occurrences of a variable in a model, and prints the
|
|
|
|
|
equations where the variable appear in the command line window. If OPTION is
|
|
|
|
|
set to `withparamvalues`, the values of the parameters (if available) are
|
2024-01-30 09:24:03 +01:00
|
|
|
|
displayed instead of the name of the parameters. Requires the `json` command
|
|
|
|
|
line option to be set.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2023-03-05 18:08:41 +01:00
|
|
|
|
*Example*
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
Assuming that we already ran a `.mod` file and that the workspace has not
|
|
|
|
|
been cleaned after, we can search for all the equations containing variable `X`
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
::
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
>> search X
|
2019-02-18 17:34:10 +01:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
Y = alpha*X/(1-X)+e;
|
2019-02-18 17:34:10 +01:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
diff(X) = beta*(X(-1)-mX) + gamma1*Z + gamma2*R + u;
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
To replace the parameters with estimated or calibrated parameters:
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
::
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
>> search X withparamvalues
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
Y = 1.254634*X/(1-X)+e;
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2024-01-29 20:57:12 +01:00
|
|
|
|
diff(X) = -0.031459*(X(-1)-mX) + 0.1*Z - 0.2*R + u;
|
|
|
|
|
|
|
|
|
|
|br|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. matcomm:: dplot [OPTION VALUE[ ...]]
|
|
|
|
|
|
|
|
|
|
Plot expressions extracting data from different dseries objects.
|
|
|
|
|
|
|
|
|
|
*Options*
|
|
|
|
|
|
|
|
|
|
.. option:: --expression EXPRESSION
|
|
|
|
|
|
|
|
|
|
``EXPRESSION`` is a mathematical expression involving variables
|
|
|
|
|
available in the dseries objects, dseries methods, numbers or
|
|
|
|
|
parameters. All the referenced objects are supposed to be
|
|
|
|
|
available in the calling workspace.
|
|
|
|
|
|
|
|
|
|
.. option:: --dseries NAME
|
|
|
|
|
|
|
|
|
|
``NAME`` is the name of a dseries object from which the
|
|
|
|
|
variables involved in ``EXPRESSION`` will be extracted.
|
|
|
|
|
|
|
|
|
|
.. option:: --range DATE1:DATE2
|
|
|
|
|
|
|
|
|
|
This option is not mandatory and allows to plot the expressions
|
|
|
|
|
only over a sub-range. ``DATE1`` and ``DATE2`` must be dates as
|
2024-02-02 16:42:18 +01:00
|
|
|
|
defined in :ref:`dates in a mod file`.
|
2024-01-29 20:57:12 +01:00
|
|
|
|
|
|
|
|
|
.. option:: --style MATLAB_SCRIPT_NAME
|
|
|
|
|
|
|
|
|
|
Name of a Matlab script (without extension) containing Matlab
|
|
|
|
|
commands to customize the produced figure.
|
|
|
|
|
|
|
|
|
|
.. option:: --title MATLAB_STRING
|
|
|
|
|
|
|
|
|
|
Adds a title to the figure.
|
|
|
|
|
|
|
|
|
|
.. option:: --with-legend
|
|
|
|
|
|
|
|
|
|
Prints a legend below the produced plot.
|
|
|
|
|
|
|
|
|
|
*Remarks*
|
|
|
|
|
|
|
|
|
|
- More than one --expression argument is allowed, and they must come first.
|
|
|
|
|
|
|
|
|
|
- For each dseries object we plot all the expressions. We use two
|
|
|
|
|
nested loops, the outer loop is over the dseries objects and the
|
|
|
|
|
inner loop over the expressions. This determines the ordering of
|
|
|
|
|
the plotted lines.
|
|
|
|
|
|
|
|
|
|
- All dseries objects must be defined in the calling workspace, if a
|
|
|
|
|
dseries object is missing the routine throws a warning (we only
|
|
|
|
|
build the plots for the available dseries objects), if all dseries
|
|
|
|
|
objects are missing the routine throws an error.
|
|
|
|
|
|
|
|
|
|
- If the range is not provided, the expressions cannot involve leads or lags.
|
|
|
|
|
|
|
|
|
|
*Example*
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
|
|
>> toto = dseries(randn(100,3), dates('2000Q1'), {'x','y','z'});
|
|
|
|
|
>> noddy = dseries(randn(100,3), dates('2000Q1'), {'x','y','z'});
|
|
|
|
|
>> b = 3;
|
|
|
|
|
>> dplot --expression 2/b*cumsum(x/y(-1)-1) --dseries toto --dseries noddy --range 2001Q1:2024Q1 --title 'This is my plot'
|
|
|
|
|
|
|
|
|
|
will produce plots for ``2/b*cumsum(x/y(-1)-1)``, where ``x`` and
|
|
|
|
|
``y`` are variables in dseries objects ``toto`` and ``noddy``, in
|
|
|
|
|
the same figure.
|