Document new search matlab command.

silicon
Stéphane Adjemian (Ryûk) 2023-03-05 18:08:41 +01:00
parent ae085b9add
commit a9ee96d441
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
1 changed files with 91 additions and 51 deletions

View File

@ -10,7 +10,7 @@ Dynare misc commands
.. command:: prior_function(OPTIONS);
|br| Executes a user-defined function on parameter draws from the prior
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``.
@ -30,9 +30,11 @@ Dynare misc commands
Number of draws used for sampling. Default: 500.
|br|
.. command:: posterior_function(OPTIONS);
|br| Same as the :comm:`prior_function` command but for the
Same as the :comm:`prior_function` command but for the
posterior distribution. Results returned in
``oo_.posterior_function_results``.
@ -46,23 +48,27 @@ Dynare misc commands
See :opt:`prior_function_sampling_draws <sampling_draws = INTEGER>`.
|br|
.. command:: generate_trace_plots(CHAIN_NUMBER);
|br| Generates trace plots of the MCMC draws for all estimated
Generates trace plots of the MCMC draws for all estimated
parameters and the posterior density in the specified Markov Chain
``CHAIN_NUMBER``.
|br|
.. matcomm:: internals FLAG ROUTINENAME[.m]|MODFILENAME
|br| 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.
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.
*Flags*
*Flags*
``--test``
``--test``
Performs the unitary test associated to ROUTINENAME (if this
routine exists and if the matlab/octave ``.m`` file has
@ -79,7 +85,7 @@ Dynare misc commands
>> internals --test ../matlab/fr/ROUTINENAME
``--display-mh-history``
``--display-mh-history``
Displays information about the previously saved MCMC draws
generated by a ``.mod`` file named MODFILENAME. This file must
@ -91,9 +97,9 @@ Dynare misc commands
>> internals --display-mh-history MODFILENAME
``--load-mh-history``
``--load-mh-history``
|br| Loads into the MATLAB/Octaves workspace informations
Loads into the MATLAB/Octaves workspace informations
about the previously saved MCMC draws generated by a ``.mod``
file named MODFILENAME.
@ -146,56 +152,90 @@ Dynare misc commands
A ``1*Nblck`` array of doubles. Current acceptance ratios.
|br|
.. matcomm:: prior [OPTIONS[, ...]];
Prints information about the prior distribution given the provided
options. If no options are provided, the command returns the list of
available options.
Prints information about the prior distribution given the provided
options. If no options are provided, the command returns the list of
available options.
*Options*
*Options*
.. option:: table
.. option:: table
Prints a table describing the marginal prior distributions
(mean, mode, std., lower and upper bounds, HPD interval).
Prints a table describing the marginal prior distributions
(mean, mode, std., lower and upper bounds, HPD interval).
.. option:: moments
.. 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).
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)
.. 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.
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
.. 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).
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
.. 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.
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
.. option:: plot
Plots the marginal prior density.
Plots the marginal prior density.
|br|
.. matcomm:: search VARIABLENAME[ OPTION]
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
displayed instead of the name of the parameters.
*Example*
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`
::
>> search X
Y = alpha*X/(1-X)+e;
diff(X) = beta*(X(-1)-mX) + gamma1*Z + gamma2*R + u;
To replace the parameters with estimated or calibrated parameters:
::
>> search X withparamvalues
Y = 1.254634*X/(1-X)+e;
diff(X) = -0.031459*(X(-1)-mX) + 0.1*Z - 0.2*R + u;