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
|
|
|
|
|
####################
|
|
|
|
|
|
|
|
|
|
.. command:: prior_function(OPTIONS);
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
|br| Executes a user-defined function on parameter draws from the prior
|
|
|
|
|
distribution. Dynare returns the results of the computations for
|
|
|
|
|
all draws in an $ndraws$ by $n$ cell array named
|
|
|
|
|
``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.
|
|
|
|
|
|
|
|
|
|
.. command:: posterior_function(OPTIONS);
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
|br| Same as the :comm:`prior_function` command but for the
|
|
|
|
|
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>`.
|
|
|
|
|
|
|
|
|
|
.. command:: generate_trace_plots(CHAIN_NUMBER);
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
|br| Generates trace plots of the MCMC draws for all estimated
|
|
|
|
|
parameters and the posterior density in the specified Markov Chain
|
|
|
|
|
``CHAIN_NUMBER``.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
|
|
|
|
.. matcomm:: internals FLAG ROUTINENAME[.m]|MODFILENAME
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
|br| Depending on the value of ``FLAG``, the ``internals`` command
|
2019-10-02 11:36:05 +02:00
|
|
|
|
can be used to run unitary tests specific to a MATLAB/Octave
|
2019-02-04 14:44:01 +01:00
|
|
|
|
routine (if available), to display documentation about a
|
2019-10-02 11:36:05 +02:00
|
|
|
|
MATLAB/Octave routine, or to extract some informations about the
|
2019-02-04 14:44:01 +01:00
|
|
|
|
state of Dynare.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
*Flags*
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +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
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``--info``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
Prints on screen the internal documentation of ROUTINENAME (if
|
|
|
|
|
this routine exists and if this routine has a texinfo internal
|
|
|
|
|
documentation header). The path to ``ROUTINENAME`` has to be
|
|
|
|
|
provided, if the routine is not 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 --doc ../matlab/fr/ROUTINENAME
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
At this time, will work properly for only a small number
|
2019-10-02 11:36:05 +02:00
|
|
|
|
of routines. At the top of the (available) MATLAB/Octave
|
2019-02-04 14:44:01 +01:00
|
|
|
|
routines a commented block for the internal documentation
|
|
|
|
|
is written in the GNU texinfo documentation format. This
|
|
|
|
|
block is processed by calling texinfo from
|
|
|
|
|
MATLAB. Consequently, texinfo has to be installed on your
|
|
|
|
|
machine.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-04 14:44:01 +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
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
``--load-mh-history``
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-10-02 11:36:05 +02:00
|
|
|
|
|br| 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
|
|
|
|
|
|
|
|
|
.. matcomm:: prior [options[, ...]];
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
Prints various informations about the prior distribution depending
|
|
|
|
|
on the options. If no options are provided, the command returns
|
|
|
|
|
the list of available options. Following options are available:
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
|
|
|
|
``table``
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
Prints a table describing the marginal prior distributions
|
|
|
|
|
(mean, mode, std., lower and upper bounds, HPD interval).
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
|
|
|
|
``moments``
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
Computes and displays first and second order moments of the
|
|
|
|
|
endogenous variables at the prior mode (considering the
|
|
|
|
|
linearized version of the model).
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
2019-02-18 17:34:10 +01:00
|
|
|
|
``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.
|
|
|
|
|
|
2018-10-25 16:31:53 +02:00
|
|
|
|
``optimize``
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
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).
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
|
|
|
|
``simulate``
|
|
|
|
|
|
2019-02-04 14:44:01 +01:00
|
|
|
|
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.
|
2018-10-25 16:31:53 +02:00
|
|
|
|
|
|
|
|
|
``plot``
|
|
|
|
|
|
|
|
|
|
Plots the marginal prior density.
|