From d849b447ec415415a8f3958252acfd0ff40e08f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemia=20=28Scylla=29?= Date: Mon, 4 Feb 2019 14:44:01 +0100 Subject: [PATCH] Fixed indentation in sections 8 and 9. --- src/source/dynare-misc-commands.rst | 175 +++++++++++++++++++--------- src/source/examples.rst | 36 ++++-- 2 files changed, 143 insertions(+), 68 deletions(-) diff --git a/src/source/dynare-misc-commands.rst b/src/source/dynare-misc-commands.rst index b556d5cd0..d8540dffd 100644 --- a/src/source/dynare-misc-commands.rst +++ b/src/source/dynare-misc-commands.rst @@ -1,152 +1,211 @@ .. default-domain:: dynare +.. |br| raw:: html + +
+ #################### Dynare misc commands #################### .. command:: prior_function(OPTIONS); - 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``. + |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``. *Options* .. option:: function = FUNCTION_NAME - 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. - + 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. + .. option:: sampling_draws = INTEGER Number of draws used for sampling. Default: 500. .. command:: posterior_function(OPTIONS); - Same as the :comm:`prior_function` command but for the posterior distribution. Results returned in ``oo_.posterior_function_results``. + |br| Same as the :comm:`prior_function` command but for the + posterior distribution. Results returned in + ``oo_.posterior_function_results``. *Options* .. option:: function = FUNCTION_NAME See :opt:`prior_function_function `. - + .. option:: sampling_draws = INTEGER See :opt:`prior_function_sampling_draws `. .. command:: generate_trace_plots(CHAIN_NUMBER); - Generates trace plots of the MCMC draws for all estimated parameters and the posterior density in the specified Markov Chain ``CHAIN_NUMBER``. + |br| Generates trace plots of the MCMC draws for all estimated + parameters and the posterior density in the specified Markov Chain + ``CHAIN_NUMBER``. .. matcomm:: internals FLAG ROUTINENAME[.m]|MODFILENAME - 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. + |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. - *Flags* + *Flags* - ``--test`` + ``--test`` - Performs the unitary test associated to ROUTINENAME (if this routine exists and if the matlab/octave ``.m`` file has unitary test sections). + Performs the unitary test associated to ROUTINENAME (if this + routine exists and if the matlab/octave ``.m`` file has + unitary test sections). - :ex: + *Example* - :: + :: - >> internals --test ROUTINENAME + >> internals --test ROUTINENAME - if ``routine.m`` is not in the current directory, the full path has to be given:: + if ``routine.m`` is not in the current directory, the full + path has to be given:: - >> internals --test ../matlab/fr/ROUTINENAME + >> internals --test ../matlab/fr/ROUTINENAME - ``--info`` + ``--info`` - 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. + 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. - :ex: + *Example* - :: + :: - >> internals --doc ../matlab/fr/ROUTINENAME + >> internals --doc ../matlab/fr/ROUTINENAME - At this time, will work properly for only a small number of routines. At the top of the (available) Matlab/Octave 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. + At this time, will work properly for only a small number + of routines. At the top of the (available) Matlab/Octave + 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. - ``--display-mh-history`` + ``--display-mh-history`` - Displays information about the previously saved MCMC draws generated by a ``.mod`` file named MODFILENAME. This file must be in the current directory. + Displays information about the previously saved MCMC draws + generated by a ``.mod`` file named MODFILENAME. This file must + be in the current directory. - :ex: + *Example* - :: + :: - >> internals --display-mh-history MODFILENAME + >> internals --display-mh-history MODFILENAME - ``--load-mh-history`` + ``--load-mh-history`` - Loads into the Matlab/Octave’s workspace informations about the previously saved MCMC draws generated by a ``.mod`` file named MODFILENAME. + |br| Loads into the Matlab/Octave’s workspace informations + about the previously saved MCMC draws generated by a ``.mod`` + file named MODFILENAME. - :ex: + *Example* - :: + :: - >> internals --load-mh-history MODFILENAME + >> internals --load-mh-history MODFILENAME - This will create a structure called ``mcmc_informations`` (in the workspace) with the following fields: + This will create a structure called ``mcmc_informations`` + (in the workspace) with the following fields: - ``Nblck`` + ``Nblck`` - The number of MCMC chains. + The number of MCMC chains. - ``InitialParameters`` + ``InitialParameters`` - A ``Nblck*n``, where ``n`` is the number of estimated parameters, array of doubles. Initial state of the MCMC. + A ``Nblck*n``, where ``n`` is the number of estimated + parameters, array of doubles. Initial state of + the MCMC. - ``LastParameters`` + ``LastParameters`` - A ``Nblck*n``, where ``n`` is the number of estimated parameters, array of doubles. Current state of the MCMC. + A ``Nblck*n``, where ``n`` is the number of estimated + parameters, array of doubles. Current state of + the MCMC. - ``InitialLogPost`` + ``InitialLogPost`` - A ``Nblck*1`` array of doubles. Initial value of the posterior kernel. + A ``Nblck*1`` array of doubles. Initial value of the + posterior kernel. - ``LastLogPost`` + ``LastLogPost`` - A ``Nblck*1`` array of doubles. Current value of the posterior kernel. + A ``Nblck*1`` array of doubles. Current value of the + posterior kernel. - ``InitialSeeds`` + ``InitialSeeds`` - A ``1*Nblck`` structure array. Initial state of the random number generator. + A ``1*Nblck`` structure array. Initial state of the random + number generator. - ``LastSeeds`` + ``LastSeeds`` - A ``1*Nblck`` structure array. Current state of the random number generator. + A ``1*Nblck`` structure array. Current state of the random + number generator. - ``AcceptanceRatio`` + ``AcceptanceRatio`` - A ``1*Nblck`` array of doubles. Current acceptance ratios. + A ``1*Nblck`` array of doubles. Current acceptance ratios. .. matcomm:: prior [options[, ...]]; - 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: + 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: ``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). ``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). ``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). ``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. ``plot`` Plots the marginal prior density. - - - - - diff --git a/src/source/examples.rst b/src/source/examples.rst index 1868f7de2..4d31add01 100644 --- a/src/source/examples.rst +++ b/src/source/examples.rst @@ -4,39 +4,55 @@ Examples ######## -Dynare comes with a database of example ``.mod`` files, which are designed to show a broad range of Dynare features, and are taken from academic papers for most of them. You should have these files in the ``examples`` subdirectory of your distribution. +Dynare comes with a database of example ``.mod`` files, which are +designed to show a broad range of Dynare features, and are taken from +academic papers for most of them. You should have these files in the +``examples`` subdirectory of your distribution. -Here is a short list of the examples included. For a more complete description, please refer to the comments inside the files themselves. +Here is a short list of the examples included. For a more complete +description, please refer to the comments inside the files themselves. ``ramst.mod`` - An elementary real business cycle (RBC) model, simulated in a deterministic setup. + An elementary real business cycle (RBC) model, simulated in a + deterministic setup. ``example1.mod`` ``example2.mod`` - Two examples of a small RBC model in a stochastic setup, presented in *Collard (2001)* (see the file ``guide.pdf`` which comes with Dynare). + Two examples of a small RBC model in a stochastic setup, presented + in *Collard (2001)* (see the file ``guide.pdf`` which comes with + Dynare). ``example3.mod`` - A small RBC model in a stochastic setup, presented in *Collard (2001)*. The steady state is solved analytically using the ``steady_state_model`` block (see :bck:`steady_state_model`). + A small RBC model in a stochastic setup, presented in *Collard + (2001)*. The steady state is solved analytically using the + ``steady_state_model`` block (see :bck:`steady_state_model`). ``fs2000.mod`` - A cash in advance model, estimated by *Schorfheide (2000)*. The file shows how to use Dynare for estimation. + A cash in advance model, estimated by *Schorfheide (2000)*. The + file shows how to use Dynare for estimation. ``fs2000_nonstationary.mod`` - The same model than ``fs2000.mod``, but written in non-stationary form. Detrending of the equations is done by Dynare. + The same model than ``fs2000.mod``, but written in non-stationary + form. Detrending of the equations is done by Dynare. ``bkk.mod`` - Multi-country RBC model with time to build, presented in *Backus, Kehoe and Kydland (1992)*. The file shows how to use Dynare’s macro-processor. + Multi-country RBC model with time to build, presented in *Backus, + Kehoe and Kydland (1992)*. The file shows how to use Dynare’s + macro-processor. ``agtrend.mod`` - Small open economy RBC model with shocks to the growth trend, presented in *Aguiar and Gopinath (2004)*. + Small open economy RBC model with shocks to the growth trend, + presented in *Aguiar and Gopinath (2004)*. ``NK_baseline.mod`` - Baseline New Keynesian Model estimated in *Fernández-Villaverde (2010)*. It demonstrates how to use an explicit steady state file to update parameters and call a numerical solver. \ No newline at end of file + Baseline New Keynesian Model estimated in *Fernández-Villaverde + (2010)*. It demonstrates how to use an explicit steady state file + to update parameters and call a numerical solver.