Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • giovanma/dynare
  • giorgiomas/dynare
  • Vermandel/dynare
  • Dynare/dynare
  • normann/dynare
  • MichelJuillard/dynare
  • wmutschl/dynare
  • FerhatMihoubi/dynare
  • sebastien/dynare
  • lnsongxf/dynare
  • rattoma/dynare
  • CIMERS/dynare
  • FredericKarame/dynare
  • SumuduK/dynare
  • MinjeJeon/dynare
  • camilomrch/dynare
  • DoraK/dynare
  • avtishin/dynare
  • selma/dynare
  • claudio_olguin/dynare
  • jeffjiang07/dynare
  • EthanSystem/dynare
  • stepan-a/dynare
  • wjgatt/dynare
  • JohannesPfeifer/dynare
  • gboehl/dynare
  • ebenetce/dynare
  • chskcau/dynare-doc-fixes
28 results
Select Git revision
Loading items
Show changes

Commits on Source 92

Showing
with 1176 additions and 460 deletions
Announcement for Dynare 4.4.0 (on 2013-12-11)
=============================================
We are pleased to announce the release of Dynare 4.4.0.
This major release adds new features and fixes various bugs.
The Windows package is already available for download. The Mac and
Debian/Ubuntu packages should follow soon.
All users are strongly encouraged to upgrade.
This release is compatible with MATLAB versions ranging from 7.3 (R2006b) to
8.2 (R2013b) and with GNU Octave version 3.6.
Here is the list of major user-visible changes:
* New major algorithms:
- Extended path at order 1 and above, also known as “stochastic extended
path”. This method is triggered by setting the `order' option of the
`extended_path' command to a value greater than 0. Dynare will then use a
Gaussian quadrature to take into account the effects of future uncertainty.
The time series for the endogenous variables are generated by assuming that
the agents believe that there will no more shocks after period t+order.
- Alternative algorithms for computing decision rules of a stochastic model,
based on the cycle reduction and logarithmic reduction algorithms. These
methods are respectively triggered by giving `dr = cycle_reduction' or 'dr
= logarithmic_reduction' as an option to the `stoch_simul' command.
- Pruning now works with 3rd order approximation, along the lines of
Andreasen, Fernández-Villaverde and Rubio-Ramírez (2013).
- Computation of conditional forecast using an extended path method. This is
triggered by the new option `simulation_type = deterministic' in the
`conditional_forecast' command. In this case, the `expectation' command in
the `conditional_forecast_paths' block has to be used to indicate the nature
of expectations (whether shocks are a surprise or are perfectly
anticipated).
- Endogenous priors as in Christiano, Trabandt and Walentin (2011). Those are
triggered by the new option `endogenous_prior' of the `estimation' command.
* Other algorithmic improvements:
- New command `model_diagnostics' to perform various sanity checks on the
model. Note: in the past, some users may have used a preliminary MATLAB
function implementing this; the new command has the same syntax, except that
you shouldn't pass any argument to it.
- Terminal conditions of perfect foresight simulations can now be specified in
growth rates. More specifically, the new option `differentiate_forward_vars'
of the `model' block will create auxiliary forward looking variables
expressed in first differences or growth rates of the actual forward looking
variables defined in the model. These new variables have obvious zero
terminal conditions whatever the simulation context and this in many cases
helps convergence of simulations.
- Convergence diagnostics for single chain MCMC à la Geweke (1992, 1999).
- New optimizer for the posterior mode (triggered by `mode_compute=10'): it
uses the simpsa algorithm, based on the combination of the non-linear
simplex and simulated annealing algorithms and proposed by Cardoso, Salcedo
and Feyo de Azevedo (1996).
- The automatic detrending engine has been extended to work on models written
in logs. The corresponding trend variable type is `log_trend_var', and the
corresponding deflator type is `log_deflator'.
* New features in the user interface:
- New set of functions for easily creating PDF reports including figures and
tables. See the “Reporting” section in the reference manual for more
details.
- New MATLAB/Octave classes for handling time series. See the “Time series”
section in the reference manual for more details.
- Datafiles in CSV format can now be used for estimation.
- New macro processor `length' operator, returns the length of an array.
- New option `all_values_required' of `initval' and `endval' blocks: enforces
initialization of all endogenous and exogenous variables within the block.
- Option `ar' can now be given to the `estimation' command.
- New options `nograph', `nointeractive' and `nowarn' to the `dynare' command,
for a better control of what is displayed.
- New option `nostrict' to the `dynare' command, for allowing Dynare to
continue processing when there are more endogenous variables than equations
or when an undeclared symbol is assigned in `initval' or `endval'.
- The information on MCMC acceptance rates, seeds, last log posterior
likelihood, and last parameter draw are now saved on the disk and can
be displayed with `internals --display-mh-history' or loaded into the
workspace with `internals --load-mh-history'.
- New options `mode_check_neighbourhood_size', `mode_check_symmetric_plots'
and `mode_check_number_of_points', for a better control of the diagnostic
plots.
- New option `parallel_local_files' of `model' block, for transferring extra
files during parallel computations.
- New option `clock' of `set_dynare_seed', for setting a different seed at
each run.
- New option `qz_zero_threshold' of the `check', `stoch_simul' and
`estimation' commands, for a better control of the situation where a
generalized eigenvalue is close to 0/0.
- New `verbatim' block for inclusion of text that should pass through the
preprocessor and be placed as is in the `modfile.m' file.
- New option `mcmc_jumping_covariance' of the `estimation' command, for a
better control of the covariance matrix used for the proposal density of the
MCMC sampler.
- New option `use_calibration' of the `estimated_params_init', for using the
calibration of deep parameters and the elements of the covariance matrix
specified in the `shocks' block as starting values for the estimation.
- New option `save_draws' of the `ms_simulation' command.
- New option `irf_plot_threshold' of the `stoch_simul' and `estimation'
commands, for a better control of the display of IRFs which are almost nil.
- New option `long_name' for endogenous, exogenous and parameter declarations,
which can be used to declare a long name for variables. That long name can
be programmatically retrieved in `M_.endo_names_long'.
* Miscellaneous changes
- The deciles of some posterior moments were erroneously saved in a field
`Distribution' under `oo_'. This field is now called `deciles', for
consistency with other posterior moments and with the manual. Similarly, the
fields `Mean', `Median', `HPDsup', `HPDinf', and `Variance' are now
consistently capitalized.
- The console mode now implies the `nodisplay' option.
* Bugs and problems identified in version 4.3.3 and that have been fixed in
version 4.4.0:
- In an `endval' block, auxiliary variables were not given the right value.
This would not result in wrong results, but could prevent convergence of
the steady state computation.
- Deterministic simulations with `stack_solve_algo=0' (the default value) were
crashing if some exogenous had a lag strictly greater than 1.
- When using the `mode_file' option, the initial estimation checks were not
performed for the loaded mode, but for the original starting values. Thus,
potential prior violations by the mode only appeared during estimation,
leading to potentially cryptic crashes and error messages.
- If a shock/measurement error variance was set to 0 in calibration, the
correlation matrix featured a 0 instead of a 1 on the diagonal, leading to
wrong estimation results.
- In the presence of calibrated covariances, estimation did not enforce
positive definiteness of the covariance matrix.
- Estimation using the `diffuse_filter' option together with the univariate
Kalman filter and a diagonal measurement error matrix was broken.
- A purely backward model with `k_order_solver' was leading to crashes of
MATLAB/Octave.
- Non-linear estimation was not skipping the specified presample when
computing the likelihood.
- IRFs and theoretical moments at order > 1 were broken for purely
forward-looking models.
- Simulated moments with constant variables was leading to crashes when
displaying autocorrelations.
- The `osr' command was sometimes crashing with cryptic error messages because
of some unaccounted error codes returned from a deeper routine.
- The check for stochastic singularity during initial estimation checks was
broken.
- Recursive estimation starting with the pathological case of `nobs=1' was
crashing.
- Conditional variance decomposition within or after estimation was crashing
when at least one shock had been calibrated to zero variance.
- The `estimated_params_init' and `estimated_params_bounds' blocks were broken
for correlations.
- The `filter_step_ahead' option was not producing any output in Bayesian
estimation.
- Deterministic simulations were sometimes erroneously indicating convergence
although the residuals were actually NaN or Inf.
- Supplying a user function in the `mode_compute' option was leading to
a crash.
- Deterministic simulation of models without any exogenous variable was
crashing.
- The MS-SBVAR code was not updating files between runs on Windows. This means
that if a MOD file was updated between runs in the same folder and a
`file_tag' was not changed, then the results would not change.
- The `ramsey_policy' command was not putting in `oo_.planner_objective_value'
the value of the planner objective at the optimum.
* References:
- Andreasen, Martin M., Jesús Fernández-Villaverde, and Juan Rubio-Ramírez
(2013): “The Pruned State-Space System for Non-Linear DSGE Models: Theory
and Empirical Applications,” NBER Working Paper, 18983
- Cardoso, Margarida F., R. L. Salcedo and S. Feyo de Azevedo (1996): “The
simplex simulated annealing approach to continuous non-linear optimization,”
Computers chem. Engng, 20(9), 1065-1080
- Christiano, Lawrence J., Mathias Trabandt and Karl Walentin (2011):
“Introducing financial frictions and unemployment into a small open economy
model,” Journal of Economic Dynamics and Control, 35(12), 1999-2041
- 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. 169-194, Oxford University
Press
- Geweke, John (1999): “Using simulation methods for Bayesian econometric
models: Inference, development and communication,” Econometric Reviews,
18(1), 1-73
Announcement for Dynare 4.3.3 (on 2013-04-12) Announcement for Dynare 4.3.3 (on 2013-04-12)
============================================= =============================================
......
...@@ -78,9 +78,8 @@ If you have downloaded the sources from an official source archive or the source ...@@ -78,9 +78,8 @@ If you have downloaded the sources from an official source archive or the source
If you want to use Git, do the following from a terminal: If you want to use Git, do the following from a terminal:
git clone http://github.com/DynareTeam/dynare.git git clone --recursive http://github.com/DynareTeam/dynare.git
cd dynare cd dynare
git submodule update --init
autoreconf -si autoreconf -si
The last line runs Autoconf and Automake in order to prepare the build environment (this is not necessary if you got the sources from an official source archive or the source snapshot). The last line runs Autoconf and Automake in order to prepare the build environment (this is not necessary if you got the sources from an official source archive or the source snapshot).
......
...@@ -18,7 +18,7 @@ dnl You should have received a copy of the GNU General Public License ...@@ -18,7 +18,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>. dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.62]) AC_PREREQ([2.62])
AC_INIT([dynare], [4.4-unstable]) AC_INIT([dynare], [4.4.0])
AC_CONFIG_SRCDIR([preprocessor/DynareMain.cc]) AC_CONFIG_SRCDIR([preprocessor/DynareMain.cc])
AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax]) AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
...@@ -83,10 +83,6 @@ CPPFLAGS="$CPPFLAGS_SAVED" ...@@ -83,10 +83,6 @@ CPPFLAGS="$CPPFLAGS_SAVED"
# Don't use deprecated hash structures # Don't use deprecated hash structures
AC_DEFINE([BOOST_NO_HASH], [], [Don't use deprecated STL hash structures]) AC_DEFINE([BOOST_NO_HASH], [], [Don't use deprecated STL hash structures])
# Check for dlopen(), needed by tests for estimation DLL
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])
# Check for libmatio, needed by Dynare++ # Check for libmatio, needed by Dynare++
AX_MATIO AX_MATIO
AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"]) AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"])
...@@ -192,10 +188,6 @@ AC_CONFIG_FILES([Makefile ...@@ -192,10 +188,6 @@ AC_CONFIG_FILES([Makefile
dynare++/kord/Makefile dynare++/kord/Makefile
dynare++/src/Makefile dynare++/src/Makefile
mex/sources/Makefile mex/sources/Makefile
mex/sources/estimation/Makefile
mex/sources/estimation/tests/Makefile
mex/sources/estimation/libmat/Makefile
mex/sources/estimation/libmat/tests/Makefile
]) ])
AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes]) AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes])
......
switch_dw @ abb30501
Subproject commit 29c446f7fe8a773860ebee347662c4ae2494c5e9 Subproject commit abb3050121bb92b63e665f697930cdf11fe018f5
utilities_dw @ 216abedb
Subproject commit b388d5eac8c8d092088db5ef805584ae4dd2d952 Subproject commit 216abedb9ab4df5dd4dca07c721f7c07392801e9
...@@ -77,8 +77,6 @@ ...@@ -77,8 +77,6 @@
@emph{Algorithms} @emph{Algorithms}
@end macro @end macro
@macro customhead{title} @macro customhead{title}
@iftex @iftex
@sp 1 @sp 1
...@@ -351,7 +349,7 @@ institutions who cannot afford, or do not want to pay for, MATLAB and ...@@ -351,7 +349,7 @@ institutions who cannot afford, or do not want to pay for, MATLAB and
are willing to bear the concomitant performance loss. are willing to bear the concomitant performance loss.
The development of Dynare is mainly done at The development of Dynare is mainly done at
@uref{http://www.cepremap.ens.fr, Cepremap} by a core team of @uref{http://www.cepremap.fr, Cepremap} by a core team of
researchers who devote part of their time to software development. researchers who devote part of their time to software development.
Currently the development team of Dynare is composed of Stéphane Currently the development team of Dynare is composed of Stéphane
Adjemian (Université du Maine, Gains and Cepremap), Houtan Bastani Adjemian (Université du Maine, Gains and Cepremap), Houtan Bastani
...@@ -1020,9 +1018,9 @@ extension or if the filename contains a non-alphanumeric character; ...@@ -1020,9 +1018,9 @@ extension or if the filename contains a non-alphanumeric character;
Declarations of variables and parameters are made with the following commands: Declarations of variables and parameters are made with the following commands:
@deffn Command var @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffn Command var @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@deffnx Command var (deflator = @var{MODEL_EXPRESSION}) @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffnx Command var (deflator = @var{MODEL_EXPRESSION}) @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@deffnx Command var (log_deflator = @var{MODEL_EXPRESSION}) @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffnx Command var (log_deflator = @var{MODEL_EXPRESSION}) @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@descriptionhead @descriptionhead
...@@ -1075,7 +1073,7 @@ var c $C$ (long_name=`Consumption'); ...@@ -1075,7 +1073,7 @@ var c $C$ (long_name=`Consumption');
@end deffn @end deffn
@deffn Command varexo @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffn Command varexo @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@descriptionhead @descriptionhead
...@@ -1103,7 +1101,7 @@ varexo m gov; ...@@ -1103,7 +1101,7 @@ varexo m gov;
@end deffn @end deffn
@deffn Command varexo_det @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffn Command varexo_det @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@descriptionhead @descriptionhead
...@@ -1140,7 +1138,7 @@ varexo_det tau; ...@@ -1140,7 +1138,7 @@ varexo_det tau;
@end deffn @end deffn
@deffn Command parameters @var{PARAMETER_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffn Command parameters @var{PARAMETER_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@descriptionhead @descriptionhead
...@@ -2837,25 +2835,42 @@ steady(homotopy_mode = 1, homotopy_steps = 50); ...@@ -2837,25 +2835,42 @@ steady(homotopy_mode = 1, homotopy_steps = 50);
If you know how to compute the steady state for your model, you can If you know how to compute the steady state for your model, you can
provide a MATLAB/Octave function doing the computation instead of provide a MATLAB/Octave function doing the computation instead of
using @code{steady}. If your MOD-file is called using @code{steady}. Again, there are two options for doing that:
@file{@var{FILENAME}.mod}, the steady state file should be called
@file{@var{FILENAME}_steadystate.m}.
Again, there are two options for creating this file:
@itemize @itemize
@item @item
The easiest way is to write a @code{steady_state_model} block. The easiest way is to write a @code{steady_state_model} block, which
is described below in more details. See also @file{fs2000.mod} in the
@file{examples} directory for an example.
The steady state file generated by Dynare will be called
@file{@var{FILENAME}_steadystate2.m}.
@item @item
You can write the corresponding Matlab function by hand. See @file{fs2000_steadystate.m} You can write the corresponding MATLAB function by hand. If your
in the @file{examples} directory for an example. This option MOD-file is called @file{@var{FILENAME}.mod}, the steady state file
gives a bit more flexibility, at the expense of a heavier must be called @file{@var{FILENAME}_steadystate.m}. See
programming burden and a lesser efficiency. @file{NK_baseline_steadystate.m} in the @file{examples} directory for
an example. This option gives a bit more flexibility, at the expense
of a heavier programming burden and a lesser efficiency.
@end itemize @end itemize
Note that both files allow to update parameters in each call of
the function. This allows for example to calibrate a model to a labor
supply of 0.2 in steady state by setting the labor disutility parameter
to a corresponding value (see @file{NK_baseline_steadystate.m} in the
@file{examples} directory). They can also be used in estimation
where some parameter may be a function of an estimated parameter
and needs to be updated for every parameter draw. For example, one might
want to set the capital utilization cost parameter as a function
of the discount rate to ensure that capacity utilization is 1 in steady
state. Treating both parameters as independent or not updating one as
a function of the other would lead to wrong results. But this also means
that care is required. Do not accidentally overwrite your parameters
with new values as it will lead to wrong results.
@anchor{steady_state_model} @anchor{steady_state_model}
@deffn Block steady_state_model ; @deffn Block steady_state_model ;
...@@ -3017,6 +3032,7 @@ must have full rank. ...@@ -3017,6 +3032,7 @@ must have full rank.
@xref{solve_algo}, for the possible values and their meaning. @xref{solve_algo}, for the possible values and their meaning.
@item qz_zero_threshold = @var{DOUBLE} @item qz_zero_threshold = @var{DOUBLE}
@anchor{qz_zero_threshold}
Value used to test if a generalized eigenvalue is 0/0 in the generalized Value used to test if a generalized eigenvalue is 0/0 in the generalized
Schur decomposition (in which case the model does not admit a unique Schur decomposition (in which case the model does not admit a unique
solution). Default: @code{1e-6}. solution). Default: @code{1e-6}.
...@@ -3462,9 +3478,7 @@ problems. Default: @code{1.000001} (except when estimating with ...@@ -3462,9 +3478,7 @@ problems. Default: @code{1.000001} (except when estimating with
@code{0.999999} in that case; @pxref{Estimation}). @code{0.999999} in that case; @pxref{Estimation}).
@item qz_zero_threshold = @var{DOUBLE} @item qz_zero_threshold = @var{DOUBLE}
Value used to test if a generalized eigenvalue is 0/0 in the generalized @xref{qz_zero_threshold}.
Schur decomposition (in which case the model does not admit a unique
solution). Default: @code{1e-6}.
@item replic = @var{INTEGER} @item replic = @var{INTEGER}
Number of simulated series used to compute the IRFs. Default: @code{1} Number of simulated series used to compute the IRFs. Default: @code{1}
...@@ -4250,7 +4264,7 @@ stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME ...@@ -4250,7 +4264,7 @@ stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME
@table @code @table @code
@item use_calibration @item use_calibration
For not specifically intialized parameters, use the deep parameters and the elements of the covariance matrix specified in the @code{shocks}-block from calibration as starting values for estimation. For components of the @code{shocks}-block that were not explicitly specified during calibration or which violate the prior, the prior mean is used. For not specifically initialized parameters, use the deep parameters and the elements of the covariance matrix specified in the @code{shocks} block from calibration as starting values for estimation. For components of the @code{shocks} block that were not explicitly specified during calibration or which violate the prior, the prior mean is used.
@end table @end table
@xref{estimated_params}, for the meaning and syntax of the various components. @xref{estimated_params}, for the meaning and syntax of the various components.
...@@ -4313,23 +4327,45 @@ acceptance ratio should be close to one third or one quarter. If this ...@@ -4313,23 +4327,45 @@ acceptance ratio should be close to one third or one quarter. If this
not the case, you can stop the MCMC (@code{Ctrl-C}) and change the value not the case, you can stop the MCMC (@code{Ctrl-C}) and change the value
of option @code{mh_jscale} (see below). of option @code{mh_jscale} (see below).
Note that by default Dynare generates random numbers using the algorithm
@code{mt199937ar} (@i{ie} Mersenne Twister method) with a seed set equal
to @code{0}. Consequently the MCMCs in Dynare are deterministic: one
will get exactly the same results across different Dynare runs
(@i{ceteris paribus}). For instance, the posterior moments or posterior
densities will be exactly the same. This behaviour allows to easily
identify the consequences of a change on the model, the priors or the
estimation options. But one may also want to check that across multiple
runs, with different sequences of proposals, the returned results are
almost identical. This should be true if the number of iterations
(@i{ie} the value of @code{mh_replic}) is important enough to ensure the
convergence of the MCMC to its ergodic distribution. In this case the
default behaviour of the random number generators in not wanted, and the
user should set the seed according to the system clock before the
estimation command using the following command:
@example
set_dynare_seed('clock');
@end example
@noindent so that the sequence of proposals will be different across different runs.
@algorithmshead @algorithmshead
The Monte Carlo Markov Chain (MCMC) diagnostics are generated The Monte Carlo Markov Chain (MCMC) diagnostics are generated by the
by the estimation command if @ref{mh_replic} is larger than 2000 and if estimation command if @ref{mh_replic} is larger than 2000 and if option
option @ref{nodiagnostic} is not used. If @ref{mh_nblocks} is equal to one, @ref{nodiagnostic} is not used. If @ref{mh_nblocks} is equal to one, the
the convergence diagnostics of @cite{Geweke (1992,1999)} is computed. It uses a convergence diagnostics of @cite{Geweke (1992,1999)} is computed. It
chi square test to compare the means of the first and last draws specified by uses a chi square test to compare the means of the first and last draws
@ref{geweke_interval} after discarding the burnin of @ref{mh_drop}. The test is specified by @ref{geweke_interval} after discarding the burnin of
computed using variance estimates under the assumption of no serial correlation @ref{mh_drop}. The test is computed using variance estimates under the
as well as using tapering windows specified in @ref{taper_steps}. assumption of no serial correlation as well as using tapering windows
If @ref{mh_nblocks} is larger than 1, the convergence diagnostics of specified in @ref{taper_steps}. If @ref{mh_nblocks} is larger than 1,
@cite{Brooks and Gelman (1998)} are used instead. the convergence diagnostics of @cite{Brooks and Gelman (1998)} are used
As described in section 3 of @cite{Brooks and Gelman (1998)} the univariate instead. As described in section 3 of @cite{Brooks and Gelman (1998)}
convergence diagnostics are based on comparing pooled and within MCMC moments the univariate convergence diagnostics are based on comparing pooled and
(Dynare displays the second and third order moments, and within MCMC moments (Dynare displays the second and third order moments,
the length of the Highest Probability Density interval covering 80% of and the length of the Highest Probability Density interval covering 80%
the posterior distribution). Due to computational reasons, the of the posterior distribution). Due to computational reasons, the
multivariate convergence diagnostic does not follow @cite{Brooks and multivariate convergence diagnostic does not follow @cite{Brooks and
Gelman (1998)} strictly, but rather applies their idea for univariate Gelman (1998)} strictly, but rather applies their idea for univariate
convergence diagnostics to the range of the posterior likelihood convergence diagnostics to the range of the posterior likelihood
...@@ -4887,6 +4923,9 @@ Default value is @code{0}. ...@@ -4887,6 +4923,9 @@ Default value is @code{0}.
forecast covariance matrices. forecast covariance matrices.
@item filter_step_ahead = [@var{INTEGER1}:@var{INTEGER2}] @item filter_step_ahead = [@var{INTEGER1}:@var{INTEGER2}]
See below.
@item filter_step_ahead = [@var{INTEGER1} @var{INTEGER2} @dots{}]
@anchor{filter_step_ahead} @anchor{filter_step_ahead}
@vindex oo_.FilteredVariablesKStepAhead @vindex oo_.FilteredVariablesKStepAhead
@vindex oo_.FilteredVariablesKStepAheadVariances @vindex oo_.FilteredVariablesKStepAheadVariances
...@@ -5023,9 +5062,7 @@ the filter, but rather use a penalty value for the likelihood when ...@@ -5023,9 +5062,7 @@ the filter, but rather use a penalty value for the likelihood when
such a singularity is encountered. Default: @code{1}. such a singularity is encountered. Default: @code{1}.
@item qz_zero_threshold = @var{DOUBLE} @item qz_zero_threshold = @var{DOUBLE}
Value used to test if a generalized eigenvalue is 0/0 in the generalized @xref{qz_zero_threshold}.
Schur decomposition (in which case the model does not admit a unique
solution). Default: @code{1e-6}.
@item taper_steps = [@var{INTEGER1} @var{INTEGER2} @dots{}] @item taper_steps = [@var{INTEGER1} @var{INTEGER2} @dots{}]
@anchor{taper_steps} @anchor{taper_steps}
...@@ -5149,7 +5186,7 @@ Variable set by the @code{estimation} command, if it is used with the ...@@ -5149,7 +5186,7 @@ Variable set by the @code{estimation} command, if it is used with the
@defvr {MATLAB/Octave variable} oo_.FilteredVariablesKStepAhead @defvr {MATLAB/Octave variable} oo_.FilteredVariablesKStepAhead
Variable set by the @code{estimation} command, if it is used with the Variable set by the @code{estimation} command, if it is used with the
@code{filter_step_ahead} option. @code{filter_step_ahead} option. The k-steps are stored along the rows while the columns indicate the respective variables. The third dimension of the array provides the observation for which the forecast has been made. For example, if @code{filter_step_ahead=[1 2 4]} and @code{nobs=200}, the element (3,5,204) stores the four period ahead filtered value of variable 5 computed at time t=200 for time t=204. The periods at the beginning and end of the sample for which no forecasts can be made, e.g. entries (1,5,1) and (1,5,204) in the example, are set to zero.
@end defvr @end defvr
@defvr {MATLAB/Octave variable} oo_.FilteredVariablesKStepAheadVariances @defvr {MATLAB/Octave variable} oo_.FilteredVariablesKStepAheadVariances
...@@ -5157,6 +5194,16 @@ Variable set by the @code{estimation} command, if it is used with the ...@@ -5157,6 +5194,16 @@ Variable set by the @code{estimation} command, if it is used with the
@code{filter_step_ahead} option. @code{filter_step_ahead} option.
@end defvr @end defvr
@defvr {MATLAB/Octave variable} oo_.Filtered_Variables_X_step_ahead
Variable set by the @code{estimation} command, if it is used with the @code{filter_step_ahead} option in the context of Bayesian estimation. Fields are of the form:
@example
@code{oo_.Filtered_Variables_X_step_ahead.@var{VARIABLE_NAME}}
@end example
The nth entry stores the k-step ahead filtered variable computed at time n for time n+k.
@end defvr
@defvr {MATLAB/Octave variable} oo_.PosteriorIRF.dsge @defvr {MATLAB/Octave variable} oo_.PosteriorIRF.dsge
Variable set by the @code{estimation} command, if it is used with the Variable set by the @code{estimation} command, if it is used with the
@code{bayesian_irf} option. Fields are of the form: @code{bayesian_irf} option. Fields are of the form:
...@@ -5490,7 +5537,7 @@ option in @code{conditional_forecast} command set to @code{deterministic}. ...@@ -5490,7 +5537,7 @@ option in @code{conditional_forecast} command set to @code{deterministic}.
Because in this case deterministic simulations are carried out, Because in this case deterministic simulations are carried out,
the nature of the shocks (surprise or perfect foresight) has to be indicated the nature of the shocks (surprise or perfect foresight) has to be indicated
in the @code{conditional_forecast_paths} block, using the command @code{expectation} in the @code{conditional_forecast_paths} block, using the command @code{expectation}
for each endogenous path. The forecasts are plotted using the rplot command. for each endogenous path. The forecasts are plotted using the @code{rplot} command.
Finally, it is possible to do forecasting with a Bayesian VAR using Finally, it is possible to do forecasting with a Bayesian VAR using
the @code{bvar_forecast} command. the @code{bvar_forecast} command.
...@@ -6040,7 +6087,10 @@ This command declares the policy maker objective, for use with ...@@ -6040,7 +6087,10 @@ This command declares the policy maker objective, for use with
You need to give the one-period objective, not the discounted lifetime You need to give the one-period objective, not the discounted lifetime
objective. The discount factor is given by the @code{planner_discount} objective. The discount factor is given by the @code{planner_discount}
option of @code{ramsey_policy} and @code{discretionary_policy}. option of @code{ramsey_policy} and @code{discretionary_policy}. The
objective function can only contain current endogenous variables and no
exogenous ones. This limitation is easily circumvented by defining an
appropriate auxiliary variable in the model.
With @code{ramsey_policy}, you are not limited to quadratic With @code{ramsey_policy}, you are not limited to quadratic
objectives: you can give any arbitrary nonlinear expression. objectives: you can give any arbitrary nonlinear expression.
...@@ -6924,11 +6974,14 @@ The first period of data (@i{i.e.} for quarterly data, an integer in ...@@ -6924,11 +6974,14 @@ The first period of data (@i{i.e.} for quarterly data, an integer in
[@code{1,4}]). Default: @code{1} [@code{1,4}]). Default: @code{1}
@item final_year = @var{INTEGER} @item final_year = @var{INTEGER}
The last year of data. Default: Set to encompass entire dataset The last year of data. Default: Set to encompass entire dataset.
@item final_subperiod = @var{INTEGER} @item final_subperiod = @var{INTEGER}
The final period of data (@i{i.e.} for monthly data, an integer in The final period of data (@i{i.e.} for monthly data, an integer in
[@code{1,12}]. Default: Set to encompass entire dataset [@code{1,12}]. Default: When final_year is also missing, set to
encompass entire dataset; when final_year is indicated, set to the
maximum number of subperiods given the frequency (@i{i.e}. 4 for
quarterly data, 12 for monthly,...).
@item datafile = @var{FILENAME} @item datafile = @var{FILENAME}
@xref{datafile}. @xref{datafile}.
...@@ -8096,6 +8149,12 @@ the one that is highest on the MATLAB/Octave path). ...@@ -8096,6 +8149,12 @@ the one that is highest on the MATLAB/Octave path).
@end deffn @end deffn
@deffn {MATLAB/Octave command} write_latex_definitions ;
Writes the names, @LaTeX{} names and long names of model variables to
tables in a file named @code{<<M_.fname>>_latex_definitions.tex}.
@end deffn
@node The Configuration File @node The Configuration File
...@@ -8439,12 +8498,14 @@ using time series. ...@@ -8439,12 +8498,14 @@ using time series.
Dynare understands dates in a mod file. Users can declare annual, Dynare understands dates in a mod file. Users can declare annual,
quaterly, monthly or weekly dates using the following syntax: quaterly, monthly or weekly dates using the following syntax:
@example @example
1990Y 1990Y
1990Q3 1990Q3
1990M11 1990M11
1990W49 1990W49
@end example @end example
@noindent Behind the scene, the dynare's preprocessor translates these expressions @noindent Behind the scene, the dynare's preprocessor translates these expressions
into instantiations of the Matlab/Octave's class @dates described into instantiations of the Matlab/Octave's class @dates described
below. Basic operations can be performed on dates: below. Basic operations can be performed on dates:
...@@ -8507,6 +8568,33 @@ Tests if a @dates object follows another @dates object or is equal to this objec ...@@ -8507,6 +8568,33 @@ Tests if a @dates object follows another @dates object or is equal to this objec
@noindent One can select an element, or some elements, in a @dates object as he would extract some elements from a vector in Matlab/Octave. Let @code{a = 1950Q1:1951Q1} be a @dates object, then @code{a(1)==1950Q1} returns @code{1}, @code{a(end)==1951Q1} returns @code{1} and @code{a(end-1:end)} selects the two last elements of @code{a} (by instantiating the @dates object @code{[1950Q4, 1951Q1]}). @noindent One can select an element, or some elements, in a @dates object as he would extract some elements from a vector in Matlab/Octave. Let @code{a = 1950Q1:1951Q1} be a @dates object, then @code{a(1)==1950Q1} returns @code{1}, @code{a(end)==1951Q1} returns @code{1} and @code{a(end-1:end)} selects the two last elements of @code{a} (by instantiating the @dates object @code{[1950Q4, 1951Q1]}).
@remarkhead
@noindent Dynare substitutes any occurence of dates in the mod file into an instantiation of the @dates class regardless of the context. For instance, @code{d = 1950Q1;} will be translated as @code{a = dates('1950Q1');}. This automatic substitution can lead to a crash if a date is defined in a string. Typically, if the user wants to display a date:
@example
disp('Initial period is 1950Q1');
@end example
@noindent Dynare will translate this as:
@example
disp('Initial period is dates('1950Q1')');
@end example
@noindent which will lead to a crash because this expression is illegal in Matlab. For this situation, Dynare provides the @code{$} escape parameter. The following expression:
@example
disp('Initial period is $1950Q1');
@end example
@noindent will be translated as:
@example
disp('Initial period is 1950Q1');
@end example
@noindent in the generated matlab script.
@node dates class @node dates class
@subsection dates class @subsection dates class
...@@ -8528,7 +8616,9 @@ for monthly dates and 1-52 for weekly dates) are stored in the second ...@@ -8528,7 +8616,9 @@ for monthly dates and 1-52 for weekly dates) are stored in the second
column. column.
@end table @end table
@noindent Each member is private, one can display the content of a member but cannot change its value: @noindent Each member is private, one can display the content of a member but cannot change its value:
@example @example
>> d = dates('2009Q2'); >> d = dates('2009Q2');
>> d.time >> d.time
...@@ -8548,13 +8638,17 @@ ans = ...@@ -8548,13 +8638,17 @@ ans =
@deftypefnx {dates} dates (@code{FREQ}) @deftypefnx {dates} dates (@code{FREQ})
Returns an empty @dates object with a given frequency (if the constructor is called with one input argument). @code{FREQ} is a character equal to 'Y' or 'A' for annual dates, 'Q' for quaterly dates, 'M' for monthly dates or 'W' for weekly dates. Note that @code{FREQ} is not case sensitive, so that, for instance, 'q' is also allowed for quaterly dates. The frequency can also be set with an integer scalar equal to 1 (annual), 4 (quaterly), 12 (monthly) or 52 (weekly). The instantiation of empty objects can be used to rename the @dates class. For instance, if one only works with quaterly dates, he can create @code{qq} as: Returns an empty @dates object with a given frequency (if the constructor is called with one input argument). @code{FREQ} is a character equal to 'Y' or 'A' for annual dates, 'Q' for quaterly dates, 'M' for monthly dates or 'W' for weekly dates. Note that @code{FREQ} is not case sensitive, so that, for instance, 'q' is also allowed for quaterly dates. The frequency can also be set with an integer scalar equal to 1 (annual), 4 (quaterly), 12 (monthly) or 52 (weekly). The instantiation of empty objects can be used to rename the @dates class. For instance, if one only works with quaterly dates, he can create @code{qq} as:
@example @example
qq = dates('Q') qq = dates('Q')
@end example @end example
and a @dates object holding the date @code{2009Q2}:
@noindent and a @dates object holding the date @code{2009Q2}:
@example @example
d0 = dates(2009,2); d0 = dates(2009,2);
@end example @end example
@noindent which is much simpler if @dates objects have to be defined programatically. @noindent which is much simpler if @dates objects have to be defined programatically.
@end deftypefn @end deftypefn
...@@ -8568,7 +8662,6 @@ Returns a @dates object that represents a date as given by the string @code{STRI ...@@ -8568,7 +8662,6 @@ Returns a @dates object that represents a date as given by the string @code{STRI
@end deftypefn @end deftypefn
@sp 1 @sp 1
@deftypefn {dates} dates (@code{DATES}) @deftypefn {dates} dates (@code{DATES})
...@@ -8598,15 +8691,19 @@ do4 = dates('Q',1950, 1); ...@@ -8598,15 +8691,19 @@ do4 = dates('Q',1950, 1);
@sp 1 @sp 1
A list of the available methods, by alphabetical order, is given below. Note that the Matlab/Octave classes do not allow in place modifications: when a method is applied to an object a new object is instantiated. For instance, to apply the method @code{multiplybytwo} to an object @code{X} we write: @noindent A list of the available methods, by alphabetical order, is given below. Note that the Matlab/Octave classes do not allow in place modifications: when a method is applied to an object a new object is instantiated. For instance, to apply the method @code{multiplybytwo} to an object @code{X} we write:
@example @example
Y = X.multiplybytwo() Y = X.multiplybytwo()
@end example @end example
or equivalently:
@noindent or equivalently:
@example @example
Y = multiplybytwo(X) Y = multiplybytwo(X)
@end example @end example
the object @code{X} is left unchanged, and the object @code{Y} is a modified copy of @code{X}.
@noindent the object @code{X} is left unchanged, and the object @code{Y} is a modified copy of @code{X}.
@sp 1 @sp 1
...@@ -9070,7 +9167,7 @@ A @code{nobs} by @code{vobs} array of doubles, the data. ...@@ -9070,7 +9167,7 @@ A @code{nobs} by @code{vobs} array of doubles, the data.
@end table @end table
@noindent The following constructors are available: @noindent @code{freq}, @code{nobs}, @code{vobs}, @code{data}, @code{name}, @code{tex} are private members. The following constructors are available:
@deftypefn {dseries} dseries () @deftypefn {dseries} dseries ()
@deftypefnx {dseries} dseries (@var{INITIAL_DATE}) @deftypefnx {dseries} dseries (@var{INITIAL_DATE})
...@@ -9100,9 +9197,9 @@ If a @file{.mat} file is used instead, it should provide the same informations. ...@@ -9100,9 +9197,9 @@ If a @file{.mat} file is used instead, it should provide the same informations.
@sp 1 @sp 1
@deftypefn {dseries} dseries (@var{DATA_MATRIX}, @var{INITIAL_DATE}, @var{LIST_OF_NAMES}, @var{LIST_OF_TEX_NAMES}) @deftypefn {dseries} dseries (@var{DATA_MATRIX}[, @var{INITIAL_DATE}[, @var{LIST_OF_NAMES}[, @var{LIST_OF_TEX_NAMES}]]])
If the data is not read from a file, it can be provided via a @math{T}x@math{N} matrix as the first argument to @code{dseries}' constructor, with @math{T} representing the number of observations on @math{N} variables. The second argument, @var{INITIAL_DATE}, can be either a @dates object representing the period of the first observation or a string which would be used to instantiate a @dates object. The third argument, @var{LIST_OF_NAMES}, is a @math{N} by @math{1} cell of strings with one entry for each variable name. The final argument, @var{LIST_OF_TEX_NAMES}, is a @math{N} by @math{1} cell of strings composed of the @LaTeX{} names associated with the variables. Input arguments two, three and four are optional. The default value for @var{INITIAL_DATE} is @code{1Y}. If the data is not read from a file, it can be provided via a @math{T}x@math{N} matrix as the first argument to @code{dseries}' constructor, with @math{T} representing the number of observations on @math{N} variables. The optional second argument, @var{INITIAL_DATE}, can be either a @dates object representing the period of the first observation or a string which would be used to instantiate a @dates object. Its default value is @code{dates('1Y')}. The optional third argument, @var{LIST_OF_NAMES}, is a @math{N} by @math{1} cell of strings with one entry for each variable name. The default name associated with column @code{i} of @var{DATA_MATRIX} is @code{Variable_i}. The final argument, @var{LIST_OF_TEX_NAMES}, is a @math{N} by @math{1} cell of strings composed of the @LaTeX{} names associated with the variables. The default @LaTeX{} name associated with column @code{i} of @var{DATA_MATRIX} is @code{Variable\_i}.
@end deftypefn @end deftypefn
...@@ -9130,7 +9227,7 @@ do3 = dseries([1; 2; 3], 1999Q3, @{`var123'@}, @{`var_@{123@}'@}); ...@@ -9130,7 +9227,7 @@ do3 = dseries([1; 2; 3], 1999Q3, @{`var123'@}, @{`var_@{123@}'@});
@sp 1 @sp 1
A list of the available methods, by alphabetical order, is given below. @noindent A list of the available methods, by alphabetical order, is given below.
@deftypefn {dseries} {[@var{A}, @var{B}] = } align (@var{A}, @var{B}) @deftypefn {dseries} {[@var{A}, @var{B}] = } align (@var{A}, @var{B})
...@@ -9172,7 +9269,7 @@ ts1 is a dseries object: ...@@ -9172,7 +9269,7 @@ ts1 is a dseries object:
@deftypefn {dseries} {@var{B} = } baxter_king_filter (@var{A}, @var{hf}, @var{lf}, @var{K}) @deftypefn {dseries} {@var{B} = } baxter_king_filter (@var{A}, @var{hf}, @var{lf}, @var{K})
Implementation of Baxter and King (1999) band pass filter for @dseries objects. This filter isolates business cycle fluctuations with a period of length ranging between @var{hf} (high frequency) to @var{lf} (low frequency) using a symetric moving average smoother with @math{2K+1} points, so that K observations at the beginning and at the end of the sample are lost in the computation of the filter. Implementation of the Baxter and King (1999) band pass filter for @dseries objects. This filter isolates business cycle fluctuations with a period of length ranging between @var{hf} (high frequency) to @var{lf} (low frequency) using a symetric moving average smoother with @math{2K+1} points, so that K observations at the beginning and at the end of the sample are lost in the computation of the filter.
@examplehead @examplehead
@example @example
...@@ -9226,7 +9323,7 @@ Sanity check of @dseries object @var{A}. Returns @math{1} if there is an error, ...@@ -9226,7 +9323,7 @@ Sanity check of @dseries object @var{A}. Returns @math{1} if there is an error,
@deftypefn {dseries} {@var{B} = } cumsum (@var{A}[, @var{d}[, @var{v}]]) @deftypefn {dseries} {@var{B} = } cumsum (@var{A}[, @var{d}[, @var{v}]])
Overloads the Matlab/Octave @code{cumsum} function for @dseries objects. The cumulated sum cannot be computed if the variables in @dseries object @var{A} have @code{NaN}s. If a @dates object @var{d} is provided as a second argument, then the method computes the cumulated sum with the additional constraint that the variables in the @dseries object @var{B} are zero in period @var{d}. If a single observation @dseries object @var{v} is provided as a third argument, the cumulated sum in @var{B} is such that @code{B(d)} matches @var{v}. Overloads the Matlab/Octave @code{cumsum} function for @dseries objects. The cumulated sum cannot be computed if the variables in @dseries object @var{A} has @code{NaN}s. If a @dates object @var{d} is provided as a second argument, then the method computes the cumulated sum with the additional constraint that the variables in the @dseries object @var{B} are zero in period @var{d}. If a single observation @dseries object @var{v} is provided as a third argument, the cumulated sum in @var{B} is such that @code{B(@var{d})} matches @var{v} (@dseries objects @var{A} and @var{v} must have the same number of variables).
@examplehead @examplehead
@example @example
...@@ -9472,7 +9569,7 @@ The previous code should produce something like: ...@@ -9472,7 +9569,7 @@ The previous code should produce something like:
@deftypefn {dseries} {@var{C} = } insert (@var{A}, @var{B}, @var{I}) @deftypefn {dseries} {@var{C} = } insert (@var{A}, @var{B}, @var{I})
Inserts variables contained in @dseries object @var{B} in @dseries object @var{A} at positions specified by integer scalars in vector @var{I}, returns augmented @dseries object @var{C}. The integer scalars in @var{I} must take values between @code{1} and @code{A.length()+1} and refers to @var{A}'s column numbers. The @dseries objects @var{A} and @var{B} need not to be defined over the same time ranges, but it is assumled that they have common frequency. Inserts variables contained in @dseries object @var{B} in @dseries object @var{A} at positions specified by integer scalars in vector @var{I}, returns augmented @dseries object @var{C}. The integer scalars in @var{I} must take values between @code{1} and @code{A.length()+1} and refers to @var{A}'s column numbers. The @dseries objects @var{A} and @var{B} need not to be defined over the same time ranges, but it is assumed that they have common frequency.
@examplehead @examplehead
@example @example
...@@ -9620,6 +9717,7 @@ ts2 is a dseries object: ...@@ -9620,6 +9717,7 @@ ts2 is a dseries object:
@noindent @remarkhead @noindent @remarkhead
@noindent The overloading of the parenthesis for @dseries objects, allows to easily create new @dseries objects by copying/pasting equations declared in the @code{model} block. For instance, if an Euler equation is defined in the @code{model} block: @noindent The overloading of the parenthesis for @dseries objects, allows to easily create new @dseries objects by copying/pasting equations declared in the @code{model} block. For instance, if an Euler equation is defined in the @code{model} block:
@example @example
model; model;
... ...
...@@ -9627,11 +9725,14 @@ model; ...@@ -9627,11 +9725,14 @@ model;
... ...
end; end;
@end example @end example
@noindent and if variables @var{C}, @var{A} and @var{K} are defined as @dseries objects, then by writting: @noindent and if variables @var{C}, @var{A} and @var{K} are defined as @dseries objects, then by writting:
@example @example
Residuals = 1/C - beta/C(1)*(exp(A(1))*K^(alpha-1)+1-delta) ; Residuals = 1/C - beta/C(1)*(exp(A(1))*K^(alpha-1)+1-delta) ;
@end example @end example
@noindent outside of the @code{model} block, we create a new @dseries object, called @var{Residuals}, for the residuals of the Euler equation (the conditional expectation of the equation defined in the @code{model} block is zero, but the residuals are non zero).
@noindent outside of the @code{model} block, we create a new @dseries object, called @code{Residuals}, for the residuals of the Euler equation (the conditional expectation of the equation defined in the @code{model} block is zero, but the residuals are non zero).
@sp 1 @sp 1
...@@ -9746,6 +9847,36 @@ ans is a dseries object: ...@@ -9746,6 +9847,36 @@ ans is a dseries object:
@sp 1 @sp 1
@deftypefn{dseries} {@var{C} =} mpower (@var{A}, @var{B})
Overloads the @code{mpower} (@code{^}) operator for @dseries objects and computes element-by-element power. @var{A} is a @dseries object with @code{N} variables and @code{T} observations. If @var{B} is a real scalar, then @code{mpower(@var{A},@var{B})} returns a @dseries object @var{C} with @code{C.data(t,n)=A.data(t,n)^C}. If @var{B} is a @dseries object with @code{N} variables and @code{T} observations then @code{mpower(@var{A},@var{B})} returns a @dseries object @var{C} with @code{C.data(t,n)=A.data(t,n)^C.data(t,n)}.
@examplehead
@example
>> ts0 = dseries(transpose(1:3));
>> ts1 = ts0^2
ts1 is a dseries object:
| power(Variable_1,2)
1Y | 1
2Y | 4
3Y | 9
>> ts2 = ts0^ts0
ts2 is a dseries object:
| power(Variable_1,Variable_1)
1Y | 1
2Y | 4
3Y | 27
@end example
@end deftypefn
@sp 1
@deftypefn{dseries} {@var{C} =} mrdivide (@var{A}, @var{B}) @deftypefn{dseries} {@var{C} =} mrdivide (@var{A}, @var{B})
Overloads the @code{mrdivide} (@code{/}) operator for @dseries objects, element by element division (like the @code{./} Matlab/Octave operator). If both @var{A} and @var{B} are @dseries objects, they do not need to be defined over the same time ranges. If @var{A} and @var{B} are @dseries object with @math{T_A} and @math{T_B} observations and @math{N_A} and @math{N_B} variables, then @math{N_A} must be equal to @math{N_B} or @math{1} and @math{N_B} must be equal to @math{N_A} or @math{1}. If @math{T_A=T_B}, @code{isequal(A.init,B.init)} returns 1 and @math{N_A=N_B}, then the @code{mrdivide} operator will compute for each couple @math{(t,n)}, with @math{1<=t<=T_A} and @math{1<=n<=N_A}, @code{C.data(t,n)=A.data(t,n)/B.data(t,n)}. If @math{N_B} is equal to @math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is ``broadcast'' across the larger @dseries (@var{A}) so that they have compatible shapes, @code{mrdivides} operator will divide each variable defined in @var{A} by the variable in @var{B}, observation per observation. If @var{B} is a double scalar, then the method @code{mrdivide} will divide all the observations/variables in @var{A} by @var{B}. Overloads the @code{mrdivide} (@code{/}) operator for @dseries objects, element by element division (like the @code{./} Matlab/Octave operator). If both @var{A} and @var{B} are @dseries objects, they do not need to be defined over the same time ranges. If @var{A} and @var{B} are @dseries object with @math{T_A} and @math{T_B} observations and @math{N_A} and @math{N_B} variables, then @math{N_A} must be equal to @math{N_B} or @math{1} and @math{N_B} must be equal to @math{N_A} or @math{1}. If @math{T_A=T_B}, @code{isequal(A.init,B.init)} returns 1 and @math{N_A=N_B}, then the @code{mrdivide} operator will compute for each couple @math{(t,n)}, with @math{1<=t<=T_A} and @math{1<=n<=N_A}, @code{C.data(t,n)=A.data(t,n)/B.data(t,n)}. If @math{N_B} is equal to @math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is ``broadcast'' across the larger @dseries (@var{A}) so that they have compatible shapes, @code{mrdivides} operator will divide each variable defined in @var{A} by the variable in @var{B}, observation per observation. If @var{B} is a double scalar, then the method @code{mrdivide} will divide all the observations/variables in @var{A} by @var{B}.
...@@ -9865,9 +9996,9 @@ Overloads the @code{plus} (@code{+}) operator for @dseries objects, element by e ...@@ -9865,9 +9996,9 @@ Overloads the @code{plus} (@code{+}) operator for @dseries objects, element by e
@sp 1 @sp 1
@deftypefn{dseries} {@var{B} =} pop (@var{A}[, @var{a}]) @deftypefn{dseries} {@var{C} =} pop (@var{A}[, @var{B}])
Removes variable @var{a} from @dseries object @var{A}. By default, if the second argument is not provided, the last variable is removed. Removes variable @var{B} from @dseries object @var{A}. By default, if the second argument is not provided, the last variable is removed.
@examplehead @examplehead
@example @example
...@@ -9942,26 +10073,32 @@ ts1 is a dseries object: ...@@ -9942,26 +10073,32 @@ ts1 is a dseries object:
@sp 1 @sp 1
@deftypefn{dseries} save (@var{A}[, @var{basename}[, @var{format}]]) @deftypefn{dseries} save (@var{A}, @var{basename}[, @var{format}])
Overloads the Matlab/Octave @code{save} function, saves @dseries object @var{A} to disk. Possible formats are @code{csv} (this is the default), @code{m} (Matlab/Octave script), and @code{mat} (Matlab binary data file). The name of the file without extension is specified by @var{basename}, by default @var{basename} is the name of the first input (namely, the @dseries object @var{A}). Overloads the Matlab/Octave @code{save} function, saves @dseries object @var{A} to disk. Possible formats are @code{csv} (this is the default), @code{m} (Matlab/Octave script), and @code{mat} (Matlab binary data file). The name of the file without extension is specified by @var{basename}.
@examplehead @examplehead
@example @example
>> ts0 = dseries(ones(2,2)); >> ts0 = dseries(ones(2,2));
>> ts0.save(); >> ts0.save('ts0');
@end example @end example
@noindent The last command will create a file @code{ts0.csv} with the following content: @noindent The last command will create a file @code{ts0.csv} with the following content:
@example @example
,Variable_1,Variable_2 ,Variable_1,Variable_2
1Y, 1, 1 1Y, 1, 1
2Y, 1, 1 2Y, 1, 1
@end example @end example
To create a Matlab/octave script, the following command:
@noindent To create a Matlab/octave script, the following command:
@example @example
>> ts0.save([],'m'); >> ts0.save('ts0','m');
@end example @end example
will produce a file @code{ts0.m} with the following content:
@noindent will produce a file @code{ts0.m} with the following content:
@example @example
% File created on 14-Nov-2013 12:08:52. % File created on 14-Nov-2013 12:08:52.
...@@ -9979,6 +10116,7 @@ Variable_2 = [ ...@@ -9979,6 +10116,7 @@ Variable_2 = [
1 1
1]; 1];
@end example @end example
@noindent The generated (@code{csv}, @code{m}, or @code{mat}) files can be loaded when instantiating a @dseries object as explained above. @noindent The generated (@code{csv}, @code{m}, or @code{mat}) files can be loaded when instantiating a @dseries object as explained above.
@end deftypefn @end deftypefn
...@@ -10206,7 +10344,7 @@ command. Default: @code{`!'} ...@@ -10206,7 +10344,7 @@ command. Default: @code{`!'}
@end table @end table
@end defmethod @end defmethod
@defmethod Report addGraph data, figname, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTickLabels, yrange, showZeroline @defmethod Report addGraph data, figname, figDirName, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTicks, xTickLabels, yrange, showZeroline
Adds a @code{Graph} to a @code{Section}. Adds a @code{Graph} to a @code{Section}.
@optionshead @optionshead
@table @code @table @code
...@@ -10219,6 +10357,10 @@ The @code{dseries} that provides the data for the graph. Default: ...@@ -10219,6 +10357,10 @@ The @code{dseries} that provides the data for the graph. Default:
The name to use when saving this figure. Default: @code{[tempname The name to use when saving this figure. Default: @code{[tempname
`.tex']} `.tex']}
@item figDirName, @code{STRING}
The name of the folder in which to store this figure. Default:
@code{tmpFigDir}
@item graphSize, @code{NUMERICAL_VECTOR} @item graphSize, @code{NUMERICAL_VECTOR}
The width and height to be passed to the third and fourth elements of The width and height to be passed to the third and fourth elements of
the array passed to the @code{`Position'} option of Matlab's the array passed to the @code{`Position'} option of Matlab's
...@@ -10275,9 +10417,16 @@ The y-axis label. Default: @code{none} ...@@ -10275,9 +10417,16 @@ The y-axis label. Default: @code{none}
@item xrange, @code{dates} @item xrange, @code{dates}
The boundary on the x-axis to display in the graph. Default: all The boundary on the x-axis to display in the graph. Default: all
@anchor{xTicks}
@item xTicks, @code{NUMERICAL_VECTOR}
Used only in conjunction with @ref{xTickLabels}, this option denotes
the numerical position of the label along the x-axis. The positions
begin at @math{1}. Default: set by Matlab/Octave.
@anchor{xTickLabels}
@item xTickLabels, @code{CELL_ARRAY_STRINGS} @item xTickLabels, @code{CELL_ARRAY_STRINGS}
The labels to use for the xticks in the graph. Default: the dates of The labels to be mapped to the ticks provided by
the @code{dseries} @ref{xTicks}. Default: the dates of the @code{dseries}
@item yrange, @code{NUMERICAL_VECTOR} @item yrange, @code{NUMERICAL_VECTOR}
The boundary on the y-axis to display in the graph, represented as a The boundary on the y-axis to display in the graph, represented as a
...@@ -10515,8 +10664,12 @@ Two examples of a small RBC model in a stochastic setup, presented in ...@@ -10515,8 +10664,12 @@ Two examples of a small RBC model in a stochastic setup, presented in
@cite{Collard (2001)} (see the file @file{guide.pdf} which comes with @cite{Collard (2001)} (see the file @file{guide.pdf} which comes with
Dynare). Dynare).
@item example3.mod
A small RBC model in a stochastic setup, presented in
@cite{Collard (2001)}. The steady state is solved analytically using the @code{steady_state_model} block (@pxref{steady_state_model}).
@item fs2000.mod @item fs2000.mod
A cash in advance model, estimated by @cite{Schorfheide (2000)}. A cash in advance model, estimated by @cite{Schorfheide (2000)}. The file shows how to use Dynare for estimation.
@item fs2000_nonstationary.mod @item fs2000_nonstationary.mod
The same model than @file{fs2000.mod}, but written in non-stationary The same model than @file{fs2000.mod}, but written in non-stationary
...@@ -10524,12 +10677,15 @@ form. Detrending of the equations is done by Dynare. ...@@ -10524,12 +10677,15 @@ form. Detrending of the equations is done by Dynare.
@item bkk.mod @item bkk.mod
Multi-country RBC model with time to build, presented in @cite{Backus, Multi-country RBC model with time to build, presented in @cite{Backus,
Kehoe and Kydland (1992)}. Kehoe and Kydland (1992)}. The file shows how to use Dynare's macro-processor.
@item agtrend.mod @item agtrend.mod
Small open economy RBC model with shocks to the growth trend, presented Small open economy RBC model with shocks to the growth trend, presented
in @cite{Aguiar and Gopinath (2004)}. in @cite{Aguiar and Gopinath (2004)}.
@item NK_baseline.mod
Baseline New Keynesian Model estimated in @cite{Fernández-Villaverde (2010)}. It demonstrates how to use an explicit steady state file to update parameters and call a numerical solver.
@end table @end table
@node Dynare misc commands @node Dynare misc commands
...@@ -10627,7 +10783,7 @@ Aguiar, Mark and Gopinath, Gita (2004): ``Emerging Market Business ...@@ -10627,7 +10783,7 @@ Aguiar, Mark and Gopinath, Gita (2004): ``Emerging Market Business
Cycles: The Cycle is the Trend,'' @i{NBER Working Paper}, 10734 Cycles: The Cycle is the Trend,'' @i{NBER Working Paper}, 10734
@item @item
Andreasen, Martin M., Fernández-Villaverde, Jesús and Juan Rubio-Ramírez (2013): ``The Pruned State-Space System for Non-Linear DSGE Models: Theory and Empirical Applications,'' @i{NBER Working Paper}, 18983 Andreasen, Martin M., Jesús Fernández-Villaverde, and Juan Rubio-Ramírez (2013): ``The Pruned State-Space System for Non-Linear DSGE Models: Theory and Empirical Applications,'' @i{NBER Working Paper}, 18983
@item @item
Backus, David K., Patrick J. Kehoe, and Finn E. Kydland (1992): Backus, David K., Patrick J. Kehoe, and Finn E. Kydland (1992):
...@@ -10645,8 +10801,7 @@ monitoring convergence of iterative simulations,'' @i{Journal of ...@@ -10645,8 +10801,7 @@ monitoring convergence of iterative simulations,'' @i{Journal of
computational and graphical statistics}, 7, pp. 434--455 computational and graphical statistics}, 7, pp. 434--455
@item @item
Cardoso, Margarida F., R. L. Salcedo and S. Feyo de Azevedo (1996): ``The simplex simulated annealing approach to continuous non-linear optimization'', @i{Computers chem. Engng}, 20(9), 1065-1080 Cardoso, Margarida F., R. L. Salcedo and S. Feyo de Azevedo (1996): ``The simplex simulated annealing approach to continuous non-linear optimization,'' @i{Computers chem. Engng}, 20(9), 1065-1080
@item @item
Collard, Fabrice (2001): ``Stochastic simulations with Dynare: A practical guide'' Collard, Fabrice (2001): ``Stochastic simulations with Dynare: A practical guide''
...@@ -10696,9 +10851,13 @@ Fernández-Villaverde, Jesús and Juan Rubio-Ramírez (2005): ``Estimating ...@@ -10696,9 +10851,13 @@ Fernández-Villaverde, Jesús and Juan Rubio-Ramírez (2005): ``Estimating
Dynamic Equilibrium Economies: Linear versus Nonlinear Likelihood,'' Dynamic Equilibrium Economies: Linear versus Nonlinear Likelihood,''
@i{Journal of Applied Econometrics}, 20, 891--910 @i{Journal of Applied Econometrics}, 20, 891--910
@item
Fernández-Villaverde, Jesús (2010): ``The econometrics of DSGE models,''
@i{SERIEs}, 1, 3--49
@item @item
Geweke, John (1992): ``Evaluating the accuracy of sampling-based approaches Geweke, John (1992): ``Evaluating the accuracy of sampling-based approaches
to the calculation of posterior moments'', in J.O. Berger, J.M. Bernardo, 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 A.P. Dawid, and A.F.M. Smith (eds.) Proceedings of the Fourth Valencia
International Meeting on Bayesian Statistics, pp. 169--194, Oxford University Press International Meeting on Bayesian Statistics, pp. 169--194, Oxford University Press
......
...@@ -15,7 +15,14 @@ ...@@ -15,7 +15,14 @@
* equations. Moreover, it makes use of a steady state file to i) set * equations. Moreover, it makes use of a steady state file to i) set
* parameters that depend on other parameters that are potentially estimated * parameters that depend on other parameters that are potentially estimated
* and ii) solve a nonlinear equation using a numerical solver to find the steady * and ii) solve a nonlinear equation using a numerical solver to find the steady
* state of labor. * state of labor. It provides an example on how the steady state file can be used
* to circumvent some of the limitation of Dynare mod-file by accessing an external
* file that allows calling general Matlab routines. These capacities will mostly be
* interesting for power users. If one just wants to provide analytical steady state
* values and update parameters, the steady_state_model-block allows an easy and convenient
* alternative. It even allows calling numerical solvers like fsolve. For an example, see
* example3.mod
*
* The model is written in the beginning of period stock notation. To make the model * The model is written in the beginning of period stock notation. To make the model
* conform with Dynare's end of period stock notation, we use the * conform with Dynare's end of period stock notation, we use the
* predetermined_variables-command. * predetermined_variables-command.
......
function [ys,check] = NK_baseline_steadystate(ys,exe) function [ys,check] = NK_baseline_steadystate(ys,exo)
global M_ lgy_ % function [ys,check] = NK_baseline_steadystate(ys,exo)
% computes the steady state for the NK_baseline.mod and uses a numerical
if isfield(M_,'param_nbr') == 1 % solver to do so
% Inputs:
% - ys [vector] vector of initial values for the steady state of
% the endogenous variables
% - exo [vector] vector of values for the exogenous variables
%
% Output:
% - ys [vector] vector of steady state values fpr the the endogenous variables
% - check [scalar] set to 0 if steady state computation worked and to
% 1 of not (allows to impos restriction on parameters)
global M_
% read out parameters to access them with their name
NumberOfParameters = M_.param_nbr; NumberOfParameters = M_.param_nbr;
for i = 1:NumberOfParameters for ii = 1:NumberOfParameters
paramname = deblank(M_.param_names(i,:)); paramname = deblank(M_.param_names(ii,:));
eval([ paramname ' = M_.params(' int2str(i) ');']); eval([ paramname ' = M_.params(' int2str(ii) ');']);
end end
% initialize indicator
check = 0; check = 0;
end
%% Enter model equations here %% Enter model equations here
...@@ -32,6 +45,11 @@ Lambdax=mu_z; ...@@ -32,6 +45,11 @@ Lambdax=mu_z;
%set the parameter gammma1 %set the parameter gammma1
gammma1=mu_z*mu_I/betta-(1-delta); gammma1=mu_z*mu_I/betta-(1-delta);
if gammma1<0 % parameter violates restriction; Preventing this cannot be implemented via prior restriction as it is a composite of different parameters and the valid prior region has unknown form
check=1; %set failure indicator
return; %return without updating steady states
end
r=1*gammma1; r=1*gammma1;
R=1+(PI*mu_z/betta-1); R=1+(PI*mu_z/betta-1);
...@@ -49,9 +67,17 @@ vp=(1-thetap)/(1-thetap*PI^((1-chi)*epsilon))*PIstar^(-epsilon); ...@@ -49,9 +67,17 @@ vp=(1-thetap)/(1-thetap*PI^((1-chi)*epsilon))*PIstar^(-epsilon);
vw=(1-thetaw)/(1-thetaw*PI^((1-chiw)*eta)*mu_z^eta)*PIstarw^(-eta); vw=(1-thetaw)/(1-thetaw*PI^((1-chiw)*eta)*mu_z^eta)*PIstarw^(-eta);
tempvaromega=alppha/(1-alppha)*w/r*mu_z*mu_I; tempvaromega=alppha/(1-alppha)*w/r*mu_z*mu_I;
ld=fsolve(@(ld)(1-betta*thetaw*mu_z^(eta-1)*PI^(-(1-chiw)*(1-eta)))/(1-betta*thetaw*mu_z^(eta*(1+gammma))*PI^(eta*(1-chiw)*(1+gammma)))... [ld,fval,exitflag]=fsolve(@(ld)(1-betta*thetaw*mu_z^(eta-1)*PI^(-(1-chiw)*(1-eta)))/(1-betta*thetaw*mu_z^(eta*(1+gammma))*PI^(eta*(1-chiw)*(1+gammma)))...
-(eta-1)/eta*wstar/(varpsi*PIstarw^(-eta*gammma)*ld^gammma)*((1-h*mu_z^(-1))^(-1)-betta*h*(mu_z-h)^(-1))*... -(eta-1)/eta*wstar/(varpsi*PIstarw^(-eta*gammma)*ld^gammma)*((1-h*mu_z^(-1))^(-1)-betta*h*(mu_z-h)^(-1))*...
((mu_A*mu_z^(-1)*vp^(-1)*tempvaromega^alppha-tempvaromega*(1-(1-delta)*(mu_z*mu_I)^(-1)))*ld-vp^(-1)*Phi)^(-1),0.25,options); ((mu_A*mu_z^(-1)*vp^(-1)*tempvaromega^alppha-tempvaromega*(1-(1-delta)*(mu_z*mu_I)^(-1)))*ld-vp^(-1)*Phi)^(-1),0.25,options);
if exitflag <1
%indicate the SS computation was not sucessful; this would also be detected by Dynare
%setting the indicator here shows how to use this functionality to
%filter out parameter draws
check=1; %set failure indicator
return; %return without updating steady states
end
l=vw*ld; l=vw*ld;
k=tempvaromega*ld; k=tempvaromega*ld;
...@@ -68,27 +94,12 @@ g2=epsilon/(epsilon-1)*g1; ...@@ -68,27 +94,12 @@ g2=epsilon/(epsilon-1)*g1;
%% end own model equations %% end own model equations
for iter = 1:length(M_.params) %update parameters set in the file
for iter = 1:length(M_.params)
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ]) eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
end end
if isfield(M_,'param_nbr') == 1 NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
for ii = 1:NumberOfEndogenousVariables
if isfield(M_,'orig_endo_nbr') == 1 varname = deblank(M_.endo_names(ii,:));
NumberOfEndogenousVariables = M_.orig_endo_nbr; eval(['ys(' int2str(ii) ') = ' varname ';']);
else
NumberOfEndogenousVariables = M_.endo_nbr;
end
ys = zeros(NumberOfEndogenousVariables,1);
for i = 1:NumberOfEndogenousVariables
varname = deblank(M_.endo_names(i,:));
eval(['ys(' int2str(i) ') = ' varname ';']);
end
else
ys=zeros(length(lgy_),1);
for i = 1:length(lgy_)
ys(i) = eval(lgy_(i,:));
end
check = 0;
end end
/*
* Example 1 from F. Collard (2001): "Stochastic simulations with DYNARE:
* A practical guide" (see "guide.pdf" in the documentation directory).
*
* This file uses the steady_state_model-block to provide analytical steady state values.
* To do so, the equations of the model have been transformed into a non-linear equation in
* labor h. Within the steady_state_model-block, a helper function is called that uses fsolve
* to solve this non-linear equation. The use of the helper function is necessary to avoid
* interference of the Matlab syntax with Dynare's preprocessor. A more complicated alternative
* that provides more flexibility in the type of commands executed and functions called is the use
* of an explicit steady state file. See the NK_baseline.mod in the Examples Folder.
*
* This mod-file also shows how to use Dynare's capacities to generate TeX-files of the model equations.
* If you want to see the model equations belonging to this mod-file, run it using Dynare
* and then use a TeX-editor to compile the TeX-files generated.
*/
/*
* Copyright (C) 2013 Dynare Team
*
* This file is part of Dynare.
*
* Dynare is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Dynare is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
var y, c, k, a, h, b;
varexo e, u;
parameters beta $\beta$
rho $\rho$
alpha $\alpha$
delta $\delta$
theta $\theta$
psi $\psi$
tau $\tau$;
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;
phi = 0.1;
model;
c*theta*h^(1+psi)=(1-alpha)*y;
k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
*(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
k = exp(b)*(y-c)+(1-delta)*k(-1);
a = rho*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rho*b(-1) + u;
end;
steady_state_model;
h=example3_steady_state_helper(alpha,beta,delta,psi,theta);
k=((1/beta-(1-delta))/alpha)^(1/(alpha-1))*h;
y = k^alpha*h^(1-alpha);
c=(1-alpha)*y/(theta*h^(1+psi));
a=0;
b=0;
end;
shocks;
var e; stderr 0.009;
var u; stderr 0.009;
var e, u = phi*0.009*0.009;
end;
//use command to generate TeX-Files with dynamic and static model equations
write_latex_dynamic_model;
write_latex_static_model;
stoch_simul;
function h=example3_steady_state_helper(alpha,beta,delta,psi,theta)
options=optimset('Display','Final','TolX',1e-10,'TolFun',1e-10);
h=fsolve(@(h)1- ((((((1/beta-(1-delta))/alpha)^(1/(alpha-1))*h)^(alpha-1))*(h^(1-alpha))-(((1-alpha)*((((1/beta-(1-delta))/alpha)^(1/(alpha-1)))^alpha))/(theta*h^psi))/(((1/beta-(1-delta))/alpha)^(1/(alpha-1))*h))+(1-delta)),0.2,options);
...@@ -87,6 +87,32 @@ var e_a; stderr 0.014; ...@@ -87,6 +87,32 @@ var e_a; stderr 0.014;
var e_m; stderr 0.005; var e_m; stderr 0.005;
end; end;
steady_state_model;
dA = exp(gam);
gst = 1/dA;
m = mst;
khst = ( (1-gst*bet*(1-del)) / (alp*gst^alp*bet) )^(1/(alp-1));
xist = ( ((khst*gst)^alp - (1-gst*(1-del))*khst)/mst )^(-1);
nust = psi*mst^2/( (1-alp)*(1-psi)*bet*gst^alp*khst^alp );
n = xist/(nust+xist);
P = xist + nust;
k = khst*n;
l = psi*mst*n/( (1-psi)*(1-n) );
c = mst/P;
d = l - mst + 1;
y = k^alp*n^(1-alp)*gst^alp;
R = mst/bet;
W = l/n;
ist = y-c;
q = 1 - d;
e = 1;
gp_obs = m/dA;
gy_obs = dA;
end;
steady; steady;
check; check;
......
...@@ -23,7 +23,7 @@ separator = repmat(' | ',A.nobs+1,1); ...@@ -23,7 +23,7 @@ separator = repmat(' | ',A.nobs+1,1);
vspace = ' '; vspace = ' ';
TABLE = ' '; TABLE = ' ';
for t=1:A.nobs for t=1:A.nobs
TABLE = char(TABLE, format(A.dates(t))); TABLE = char(TABLE, date2string(A.dates(t)));
end end
for i = 1:A.vobs for i = 1:A.vobs
TABLE = horzcat(TABLE,separator); TABLE = horzcat(TABLE,separator);
......
function A = mpower(B,C) % --*-- Unitary tests --*--
%@info:
%! @deftypefn {Function File} {@var{A} =} mpower (@var{B},@var{C})
%! @anchor{@dseries/mpower}
%! @sp 1
%! Overloads the mpower method for the Dynare time series class (@ref{dseries}).
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item B
%! Dynare time series object instantiated by @ref{dseries}, with T observations and N variables.
%! @item C
%! Real scalar or a dseries object with T observations and N variables.
%! @end table
%! @sp 1
%! @strong{Outputs}
%! @sp 1
%! @table @ @var
%! @item A
%! dseries object with T observations and N variables.
%! @end deftypefn
%@eod:
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if isdseries(B) && isnumeric(C) && isreal(C) && isscalar(C)
A = dseries();
A.freq = B.freq;
A.init = B.init;
A.dates = B.dates;
A.nobs = B.nobs;
A.vobs = B.vobs;
A.name = cell(A.vobs,1);
A.tex = cell(A.vobs,1);
for i=1:A.vobs
A.name(i) = {['power(' B.name{i} ',' num2str(C) ')']};
A.tex(i) = {[B.tex{i} '^' num2str(C) ]};
end
A.data = B.data.^C;
return
end
if isdseries(B) && isdseries(C)
if isequal(B.nobs,C.nobs) && isequal(B.vobs,C.vobs) && isequal(B.freq,C.freq)
A = dseries();
A.freq = B.freq;
A.init = B.init;
A.dates = B.dates;
A.nobs = B.nobs;
A.vobs = B.vobs;
A.name = cell(A.vobs,1);
A.tex = cell(A.vobs,1);
for i=1:A.vobs
A.name(i) = {['power(' B.name{i} ',' C.name{i} ')']};
A.tex(i) = {[B.tex{i} '^{' C.tex{i} '}']};
end
A.data = B.data.^C.data;
else
error('dseries::mpower: If both input arguments are dseries objects, they must have the same numbers of variables and observations and common frequency!')
end
return
end
error(['dseries::mpower: Wrong calling sequence!'])
%@test:1
%$ % Define a datasets.
%$ A = rand(10,2); B = randn(10,2);
%$
%$ % Define names
%$ A_name = {'A1';'A2'}; B_name = {'B1';'B2'};
%$
%$
%$ % Instantiate a time series object.
%$ try
%$ ts1 = dseries(A,[],A_name,[]);
%$ ts2 = dseries(B,[],B_name,[]);
%$ ts3 = ts1^ts2;
%$ t = 1;
%$ catch
%$ t = 0;
%$ end
%$
%$ if t(1)
%$ t(2) = dyn_assert(ts3.vobs,2);
%$ t(3) = dyn_assert(ts3.nobs,10);
%$ t(4) = dyn_assert(ts3.data,A.^B,1e-15);
%$ t(5) = dyn_assert(ts3.name,{'power(A1,B1)';'power(A2,B2)'});
%$ t(6) = dyn_assert(ts3.tex,{'A1^{B1}';'A2^{B2}'});
%$ end
%$ T = all(t);
%@eof:1
%@test:2
%$ % Define a datasets.
%$ A = rand(10,2);
%$
%$ % Define names
%$ A_name = {'A1';'A2'};
%$
%$
%$ % Instantiate a time series object.
%$ try
%$ ts1 = dseries(A,[],A_name,[]);
%$ ts3 = ts1^2;
%$ t = 1;
%$ catch
%$ t = 0;
%$ end
%$
%$ if t(1)
%$ t(2) = dyn_assert(ts3.vobs,2);
%$ t(3) = dyn_assert(ts3.nobs,10);
%$ t(4) = dyn_assert(ts3.data,A.^2,1e-15);
%$ t(5) = dyn_assert(ts3.name,{'power(A1,2)';'power(A2,2)'});
%$ t(6) = dyn_assert(ts3.tex,{'A1^2';'A2^2'});
%$ end
%$ T = all(t);
%@eof:2
\ No newline at end of file
...@@ -56,6 +56,7 @@ switch ndseries ...@@ -56,6 +56,7 @@ switch ndseries
end end
hh = plot(ts.data); hh = plot(ts.data);
end end
axis tight;
id = get(gca,'XTick'); id = get(gca,'XTick');
if isequal(id(1),0) if isequal(id(1),0)
dates = strings([ts.dates(1)-1,ts.dates(id(2:end))]); dates = strings([ts.dates(1)-1,ts.dates(id(2:end))]);
......
function DirectoryName = CheckPath(type,dname) function [DirectoryName, info] = CheckPath(type,dname)
% Creates the subfolder "./M_.dname/type" if it does not exist yet. % Creates the subfolder "./M_.dname/type" if it does not exist yet.
% %
% INPUTS % INPUTS
...@@ -6,12 +6,13 @@ function DirectoryName = CheckPath(type,dname) ...@@ -6,12 +6,13 @@ function DirectoryName = CheckPath(type,dname)
% dname [string] Name of the directory % dname [string] Name of the directory
% %
% OUTPUTS % OUTPUTS
% none. % DirectoryName string, name of the directory (with path).
% info integer scalar, equal to 1 if the routine creates directory dname/type, zero otherwise.
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
% Copyright (C) 2005-2012 Dynare Team % Copyright (C) 2005-2013 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -28,6 +29,8 @@ function DirectoryName = CheckPath(type,dname) ...@@ -28,6 +29,8 @@ function DirectoryName = CheckPath(type,dname)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
info = 0;
DirectoryName = [ dname '/' type ]; DirectoryName = [ dname '/' type ];
if ~isdir(dname) if ~isdir(dname)
...@@ -44,4 +47,5 @@ if ~isdir(DirectoryName) ...@@ -44,4 +47,5 @@ if ~isdir(DirectoryName)
delete(DirectoryName) delete(DirectoryName)
end end
mkdir('.',DirectoryName); mkdir('.',DirectoryName);
info = 1;
end end
...@@ -107,7 +107,7 @@ if options.noprint == 0 ...@@ -107,7 +107,7 @@ if options.noprint == 0
if result if result
disp('The rank condition is verified.') disp('The rank condition is verified.')
else else
disp('The rank conditions ISN''T verified!') disp('The rank condition ISN''T verified!')
end end
skipline() skipline()
end end
...@@ -22,16 +22,19 @@ if nargout>1 ...@@ -22,16 +22,19 @@ if nargout>1
description = ''; description = '';
end end
%% Get informations about mcmc files. [MetropolisFolder, info] = CheckPath('metropolis',M_.dname);
if ~exist([ M_.dname '/metropolis'],'dir')
% Get informations about mcmc files.
if info
disp('check_posterior_analysis_data:: Can''t find any mcmc file!') disp('check_posterior_analysis_data:: Can''t find any mcmc file!')
return return
end end
mhname = get_name_of_the_last_mh_file(M_); mhname = get_name_of_the_last_mh_file(M_);
mhdate = get_date_of_a_file(mhname); mhdate = get_date_of_a_file([MetropolisFolder filesep mhname]);
%% Get informations about _posterior_draws files. % Get informations about _posterior_draws files.
drawsinfo = dir([ M_.dname '/metropolis/' M_.fname '_posterior_draws*.mat']); drawsinfo = dir([ MetropolisFolder filesep M_.fname '_posterior_draws*.mat']);
if isempty(drawsinfo) if isempty(drawsinfo)
info = 1; % select_posterior_draws has to be called first. info = 1; % select_posterior_draws has to be called first.
if nargout>1 if nargout>1
...@@ -40,8 +43,7 @@ if isempty(drawsinfo) ...@@ -40,8 +43,7 @@ if isempty(drawsinfo)
return return
else else
number_of_last_posterior_draws_file = length(drawsinfo); number_of_last_posterior_draws_file = length(drawsinfo);
pddate = get_date_of_a_file([ M_.dname '/metropolis/' M_.fname '_posterior_draws'... pddate = get_date_of_a_file([ MetropolisFolder filesep M_.fname '_posterior_draws' int2str(number_of_last_posterior_draws_file) '.mat']);
int2str(number_of_last_posterior_draws_file) '.mat']);
if pddate<mhdate if pddate<mhdate
info = 2; % _posterior_draws files have to be updated. info = 2; % _posterior_draws files have to be updated.
if nargout>1 if nargout>1
...@@ -56,7 +58,7 @@ else ...@@ -56,7 +58,7 @@ else
end end
end end
%% Get informations about posterior data files. % Get informations about posterior data files.
switch type switch type
case 'variance' case 'variance'
generic_post_data_file_name = 'Posterior2ndOrderMoments'; generic_post_data_file_name = 'Posterior2ndOrderMoments';
...@@ -69,7 +71,7 @@ switch type ...@@ -69,7 +71,7 @@ switch type
otherwise otherwise
disp('This feature is not yest implemented!') disp('This feature is not yest implemented!')
end end
pdfinfo = dir([ M_.dname '/metropolis/' M_.fname '_' generic_post_data_file_name '*']); pdfinfo = dir([ MetropolisFolder filesep M_.fname '_' generic_post_data_file_name '*']);
if isempty(pdfinfo) if isempty(pdfinfo)
info = 4; % posterior draws have to be processed. info = 4; % posterior draws have to be processed.
if nargout>1 if nargout>1
...@@ -79,8 +81,7 @@ if isempty(pdfinfo) ...@@ -79,8 +81,7 @@ if isempty(pdfinfo)
else else
number_of_the_last_post_data_file = length(pdfinfo); number_of_the_last_post_data_file = length(pdfinfo);
name_of_the_last_post_data_file = ... name_of_the_last_post_data_file = ...
[ pwd filesep M_.dname ... [ pwd filesep MetropolisFolder filesep ...
filesep 'metropolis' filesep ...
M_.fname '_' ... M_.fname '_' ...
generic_post_data_file_name ... generic_post_data_file_name ...
int2str(number_of_the_last_post_data_file) ... int2str(number_of_the_last_post_data_file) ...
......
...@@ -130,13 +130,18 @@ if ~isempty(estim_params_) && ~isempty(options_.mode_file) && ~options_.mh_poste ...@@ -130,13 +130,18 @@ if ~isempty(estim_params_) && ~isempty(options_.mode_file) && ~options_.mh_poste
number_of_estimated_parameters = length(xparam1); number_of_estimated_parameters = length(xparam1);
mode_file = load(options_.mode_file); mode_file = load(options_.mode_file);
if number_of_estimated_parameters>length(mode_file.xparam1) if number_of_estimated_parameters>length(mode_file.xparam1)
% More estimated parameters than parameters in the mode file.
skipline() skipline()
disp(['The posterior mode file ' options_.mode_file ' has been generated using another specification of the model or another model!']) disp(['The posterior mode file ' options_.mode_file ' has been generated using another specification of the model or another model!'])
disp(['Your mode file contains estimates for ' int2str(length(mode_file.xparam1)) ' parameters, while you are attempting to estimate ' int2str(number_of_estimated_parameters) ' parameters:']) disp(['Your mode file contains estimates for ' int2str(length(mode_file.xparam1)) ' parameters, while you are attempting to estimate ' int2str(number_of_estimated_parameters) ' parameters:'])
md = []; xd = [];
for i=1:number_of_estimated_parameters for i=1:number_of_estimated_parameters
id = strmatch(deblank(bayestopt_.name(i,:)),mode_file.parameter_names,'exact'); id = strmatch(deblank(bayestopt_.name(i,:)),mode_file.parameter_names,'exact');
if isempty(id) if isempty(id)
disp(['--> Estimated parameter ' bayestopt_.name{i} ' is not present in the loaded mod_file.']) disp(['--> Estimated parameter ' bayestopt_.name{i} ' is not present in the loaded mode file (prior mean will be used, if possible).'])
else
xd = [xd; i];
md = [md; id];
end end
end end
for i=1:length(mode_file.xparam1) for i=1:length(mode_file.xparam1)
...@@ -145,20 +150,30 @@ if ~isempty(estim_params_) && ~isempty(options_.mode_file) && ~options_.mh_poste ...@@ -145,20 +150,30 @@ if ~isempty(estim_params_) && ~isempty(options_.mode_file) && ~options_.mh_poste
disp(['--> Parameter ' mode_file.parameter_names{i} ' is not estimated according to the current mod file.']) disp(['--> Parameter ' mode_file.parameter_names{i} ' is not estimated according to the current mod file.'])
end end
end end
error('Please change the mode_file option or the list of estimated parameters.') if ~options_.mode_compute
% The posterior mode is not estimated.
error('Please change the mode_file option, the list of estimated parameters or set mode_compute>0.')
else
% The posterior mode is estimated, the Hessian evaluated at the mode is not needed so we set values for the parameters missing in the mode file using the prior mean.
if ~isempty(xd)
xparam1(xd) = mode_file.xparam1(md);
else
error('Please remove the mode_file option.')
end
end
elseif number_of_estimated_parameters<length(mode_file.xparam1) elseif number_of_estimated_parameters<length(mode_file.xparam1)
% Less estimated parameters than parameters in the mode file.
skipline() skipline()
disp(['The posterior mode file ' options_.mode_file ' has been generated using another specification of the model or another model!']) disp(['The posterior mode file ' options_.mode_file ' has been generated using another specification of the model or another model!'])
disp(['Your mode file contains estimates for ' int2str(length(mode_file.xparam1)) ' parameters, while you are attempting to estimate only ' int2str(number_of_estimated_parameters) ' parameters:']) disp(['Your mode file contains estimates for ' int2str(length(mode_file.xparam1)) ' parameters, while you are attempting to estimate only ' int2str(number_of_estimated_parameters) ' parameters:'])
Id = []; md = []; xd = [];
for i=1:number_of_estimated_parameters for i=1:number_of_estimated_parameters
id = strmatch(deblank(bayestopt_.name(i,:)),mode_file.parameter_names,'exact'); id = strmatch(deblank(bayestopt_.name(i,:)),mode_file.parameter_names,'exact');
if isempty(id) if isempty(id)
disp(['--> Estimated parameter ' deblank(bayestopt_.name(i,:)) ' is not present in the loaded mode file.']) disp(['--> Estimated parameter ' deblank(bayestopt_.name(i,:)) ' is not present in the loaded mode file (prior mean will be used, if possible).'])
Id = [];
break
else else
Id = [Id; id]; xd = [xd; i];
md = [md; id];
end end
end end
for i=1:length(mode_file.xparam1) for i=1:length(mode_file.xparam1)
...@@ -167,59 +182,72 @@ if ~isempty(estim_params_) && ~isempty(options_.mode_file) && ~options_.mh_poste ...@@ -167,59 +182,72 @@ if ~isempty(estim_params_) && ~isempty(options_.mode_file) && ~options_.mh_poste
disp(['--> Parameter ' mode_file.parameter_names{i} ' is not estimated according to the current mod file.']) disp(['--> Parameter ' mode_file.parameter_names{i} ' is not estimated according to the current mod file.'])
end end
end end
if isempty(Id) if ~options_.mode_compute
% None of the estimated parameters are present in the mode_file. % The posterior mode is not estimated. If possible, fix the mode_file.
error('Please change the mode_file option or the list of estimated parameters.') if isequal(length(xd),number_of_estimated_parameters)
else
% If possible, fix the mode_file.
if isequal(length(Id),number_of_estimated_parameters)
disp('==> Fix mode file (remove unused parameters).') disp('==> Fix mode file (remove unused parameters).')
mode_file.parameter_names = mode_file.parameter_names(Id,:); xparam1 = mode_file.xparam1(md);
mode_file.xparam1 = mode_file.xparam1(Id);
if isfield(mode_file,'hh') if isfield(mode_file,'hh')
mode_file.hh = mode_file.hh(Id,Id); hh = mode_file.hh(md,md);
end end
else
error('Please change the mode_file option, the list of estimated parameters or set mode_compute>0.')
end
else
% The posterior mode is estimated, the Hessian evaluated at the mode is not needed so we set values for the parameters missing in the mode file using the prior mean.
if ~isempty(xd)
xparam1(xd) = mode_file.xparam1(md);
else
% None of the estimated parameters are present in the mode_file.
error('Please remove the mode_file option.')
end end
end end
else else
% The number of declared estimated parameters match the number of parameters in the mode file. % The number of declared estimated parameters match the number of parameters in the mode file.
% Check that the parameters in the mode file and according to the current mod file are identical. % Check that the parameters in the mode file and according to the current mod file are identical.
if isequal(mode_file.parameter_names, bayestopt_.name) if isequal(mode_file.parameter_names, bayestopt_.name)
% Ok! Nothing to do here. xparam1 = mode_file.xparam1;
if isfield(mode_file,'hh')
hh = mode_file.hh;
end
else else
skipline() skipline()
disp(['The posterior mode file ' options_.mode_file ' has been generated using another specification of the model or another model!']) disp(['The posterior mode file ' options_.mode_file ' has been generated using another specification of the model or another model!'])
% Check if this only an ordering issue. % Check if this only an ordering issue or if the missing parameters can be initialized with the prior mean.
Id = []; md = []; xd = [];
for i=1:number_of_estimated_parameters for i=1:number_of_estimated_parameters
id = strmatch(deblank(bayestopt_.name(i,:)), mode_file.parameter_names,'exact'); id = strmatch(deblank(bayestopt_.name(i,:)), mode_file.parameter_names,'exact');
if isempty(id) if isempty(id)
disp(['--> Estimated parameter ' bayestopt_.name{i} ' is not present in the loaded mode file.']) disp(['--> Estimated parameter ' bayestopt_.name{i} ' is not present in the loaded mode file.'])
Id = [];
break
else else
Id = [Id; id]; xd = [xd; i];
md = [md; id];
end end
end end
if isempty(Id) if ~options_.mode_compute
% None of the estimated parameters are present in the mode_file. % The posterior mode is not estimated
error('Please change the mode_file option or the list of estimated parameters.') if isequal(length(xd), number_of_estimated_parameters)
else % This is an ordering issue.
% If possible, fix the mode_file. xparam1 = mode_file.xparam1(md);
if isequal(length(Id),number_of_estimated_parameters)
disp('==> Fix mode file (reorder the parameters).')
mode_file.parameter_names = mode_file.parameter_names(Id,:);
mode_file.xparam1 = mode_file.xparam1(Id);
if isfield(mode_file,'hh') if isfield(mode_file,'hh')
mode_file.hh = mode_file.hh(Id,Id); hh = mode_file.hh(md,md);
end end
else
error('Please change the mode_file option, the list of estimated parameters or set mode_compute>0.')
end end
else
% The posterior mode is estimated, the Hessian evaluated at the mode is not needed so we set values for the parameters missing in the mode file using the prior mean.
if ~isempty(xd)
xparam1(xd) = mode_file.xparam1(md);
if isfield(mode_file,'hh')
hh(xd,xd) = mode_file.hh(md,md);
end
else
% None of the estimated parameters are present in the mode_file.
error('Please remove the mode_file option.')
end end
end end
end end
xparam1 = mode_file.xparam1;
if isfield(mode_file,'hh')
hh = mode_file.hh;
end end
skipline() skipline()
end end
......
...@@ -207,15 +207,23 @@ else ...@@ -207,15 +207,23 @@ else
name_tex = [cellstr(M_.exo_names_tex); cellstr(M_.param_names_tex)]; name_tex = [cellstr(M_.exo_names_tex); cellstr(M_.param_names_tex)];
end end
skipline()
disp(['==== Identification analysis ====' ]),
skipline()
if nparam<2,
options_ident.advanced=0;
advanced = options_ident.advanced;
disp('There is only one parameter to study for identitification.')
disp('The advanced option is re-set to 0.')
skipline()
end
options_ident = set_default_option(options_ident,'max_dim_cova_group',min([2,nparam-1])); options_ident = set_default_option(options_ident,'max_dim_cova_group',min([2,nparam-1]));
options_ident.max_dim_cova_group = min([options_ident.max_dim_cova_group,nparam-1]); options_ident.max_dim_cova_group = min([options_ident.max_dim_cova_group,nparam-1]);
MaxNumberOfBytes=options_.MaxNumberOfBytes; MaxNumberOfBytes=options_.MaxNumberOfBytes;
store_options_ident = options_ident; store_options_ident = options_ident;
skipline()
disp(['==== Identification analysis ====' ]),
skipline()
if iload <=0, if iload <=0,
...@@ -326,6 +334,8 @@ if iload <=0, ...@@ -326,6 +334,8 @@ if iload <=0,
disp('----------- ') disp('----------- ')
skipline() skipline()
return return
else
parameters = 'Random_prior_params';
end end
else else
idehess_point.params=params; idehess_point.params=params;
...@@ -336,6 +346,7 @@ if iload <=0, ...@@ -336,6 +346,7 @@ if iload <=0,
% normJ = max(abs(siJ)')'; % normJ = max(abs(siJ)')';
% normLRE = max(abs(siLRE)')'; % normLRE = max(abs(siLRE)')';
save([IdentifDirectoryName '/' M_.fname '_identif.mat'], 'idehess_point', 'idemoments_point','idemodel_point', 'idelre_point','store_options_ident') save([IdentifDirectoryName '/' M_.fname '_identif.mat'], 'idehess_point', 'idemoments_point','idemodel_point', 'idelre_point','store_options_ident')
save([IdentifDirectoryName '/' M_.fname '_' parameters '_identif.mat'], 'idehess_point', 'idemoments_point','idemodel_point', 'idelre_point','store_options_ident')
disp_identification(params, idemodel_point, idemoments_point, name, advanced); disp_identification(params, idemodel_point, idemoments_point, name, advanced);
if ~options_.nograph, if ~options_.nograph,
plot_identification(params,idemoments_point,idehess_point,idemodel_point,idelre_point,advanced,parameters,name,IdentifDirectoryName); plot_identification(params,idemoments_point,idehess_point,idemodel_point,idelre_point,advanced,parameters,name,IdentifDirectoryName);
......
...@@ -281,10 +281,12 @@ if options_gsa.redform && ~isempty(options_gsa.namendo),% ... ...@@ -281,10 +281,12 @@ if options_gsa.redform && ~isempty(options_gsa.namendo),% ...
% check existence of the SS_ANOVA toolbox % check existence of the SS_ANOVA toolbox
if isempty(options_gsa.threshold_redform) && ... if isempty(options_gsa.threshold_redform) && ...
~(exist('gsa_sdp','file')==6 || exist('gsa_sdp','file')==2), ~(exist('gsa_sdp','file')==6 || exist('gsa_sdp','file')==2),
disp('Download Mapping routines at:') fprintf('\nThe "SS-ANOVA-R: MATLAB Toolbox for the estimation of Smoothing Spline ANOVA models with Recursive algorithms" is missing.\n')
disp('http://eemc.jrc.ec.europa.eu/softwareDYNARE-Dowload.htm') fprintf('To obtain it, go to:\n\n')
disp(' ' ) fprintf('http://ipsc.jrc.ec.europa.eu/?id=790 \n\n')
error('Mapping routines missing!') fprintf('and follow the instructions there.\n')
fprintf('After obtaining the files, you need to unpack them and set a Matlab Path to those files.\n')
error('SS-ANOVA-R Toolbox missing!')
end end
redform_map(OutputDirectoryName,options_gsa); redform_map(OutputDirectoryName,options_gsa);
......