diff --git a/doc/bvar-a-la-sims.tex b/doc/bvar-a-la-sims.tex
index 07af9fb77..6caf4d8b2 100644
--- a/doc/bvar-a-la-sims.tex
+++ b/doc/bvar-a-la-sims.tex
@@ -26,7 +26,7 @@
}}
\author{S\'ebastien Villemot\thanks{Paris School of Economics and
- CEPREMAP.} \and Johannes Pfeifer\thanks{University of Mannheim. E-mail: \href{mailto:pfeifer@uni-mannheim.de}{\texttt{pfeifer@uni-mannheim.de}}.}}
+ CEPREMAP.} \and Johannes Pfeifer\thanks{University of Cologne. E-mail: \href{mailto:jpfeifer@uni-koeln.de}{\texttt{jpfeifer@uni-koeln.de}}.}}
\date{First version: September 2007 \hspace{1cm} This version: October 2016}
\maketitle
diff --git a/doc/dynare.texi b/doc/dynare.texi
index 8b31cf3b2..d5f9bf8da 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -2,6 +2,8 @@
@c %**start of header
@setfilename dynare.info
@documentencoding UTF-8
+@set txicodequoteundirected
+
@settitle Dynare Reference Manual
@afourwide
@dircategory Math
@@ -206,6 +208,9 @@ The Model file
* Deterministic simulation::
* Stochastic solution and simulation::
* Estimation::
+* Model Comparison::
+* Shock Decomposition::
+* Calibrated Smoother::
* Forecasting::
* Optimal policy::
* Sensitivity and identification analysis::
@@ -371,7 +376,7 @@ Adjemian (Université du Maine, Gains and Cepremap), Houtan Bastani
(Cepremap), Michel Juillard (Banque de France), Frédéric Karamé
(Université du Maine, Gains and Cepremap), Junior Maih (Norges Bank),
Ferhat Mihoubi (Université Paris-Est Créteil, Epee and Cepremap), George
-Perendia, Johannes Pfeifer (University of Mannheim), Marco Ratto (European Commission, Joint Research Centre - JRC)
+Perendia, Johannes Pfeifer (University of Cologne), Marco Ratto (European Commission, Joint Research Centre - JRC)
and Sébastien Villemot (OFCE – Sciences Po).
Increasingly, the developer base is expanding, as tools developed by
researchers outside of Cepremap are integrated into Dynare. Financial
@@ -1065,6 +1070,9 @@ end of line one and the parser would continue processing.
* Deterministic simulation::
* Stochastic solution and simulation::
* Estimation::
+* Model Comparison::
+* Shock Decomposition::
+* Calibrated Smoother::
* Forecasting::
* Optimal policy::
* Sensitivity and identification analysis::
@@ -1105,6 +1113,10 @@ mutually exclusive arguments are separated by vertical bars: @samp{|};
@item
@var{INTEGER} indicates an integer number;
+@item
+@var{INTEGER_VECTOR} indicates a vector of integer numbers separated by spaces,
+enclosed by square brackets;
+
@item
@var{DOUBLE} indicates a double precision number. The following syntaxes
are valid: @code{1.1e3}, @code{1.1E3}, @code{1.1d3}, @code{1.1D3}. In
@@ -2103,6 +2115,7 @@ Compiling the @TeX{} file requires the following @LaTeX{} packages:
@anchor{write_latex_dynamic_model}
@deffn Command write_latex_dynamic_model ;
+@deffnx Command write_latex_dynamic_model (@var{OPTIONS}) ;
@descriptionhead
@@ -2149,6 +2162,16 @@ also have been replaced by new auxiliary variables and equations.
For the required @LaTeX{} packages, @pxref{write_latex_original_model}.
+@optionshead
+
+@table @code
+
+@item write_equation_tags
+Write the equation tags in the @LaTeX{} output. NB: the equation tags will be
+interpreted with @LaTeX{} markups.
+
+@end table
+
@end deffn
@deffn Command write_latex_static_model ;
@@ -3486,6 +3509,7 @@ end;
@deffn Command check ;
@deffnx Command check (solve_algo = @var{INTEGER}) ;
+@anchor{check}
@descriptionhead
@@ -6369,6 +6393,22 @@ Sets the method for approximating the particle distribution. Possible values for
@item cpf_weights = @var{OPTION}
@anchor{cpf_weights} Controls the method used to update the weights in conditional particle filter, possible values are @code{amisanotristani} (@cite{Amisano et al (2010)}) or @code{murrayjonesparslow} (@cite{Murray et al. (2013)}). Default value is @code{amisanotristani}.
+@item nonlinear_filter_initialization = @var{INTEGER}
+@anchor{nonlinear_filter_initialization} Sets the initial condition of the
+nonlinear filters. By default the nonlinear filters are initialized with the
+unconditional covariance matrix of the state variables, computed with the
+reduced form solution of the first order approximation of the model. If
+@code{nonlinear_filter_initialization=2}, the nonlinear filter is instead
+initialized with a covariance matrix estimated with a stochastic simulation of
+the reduced form solution of the second order approximation of the model. Both
+these initializations assume that the model is stationary, and cannot be used
+if the model has unit roots (which can be seen with the @ref{check} command
+prior to estimation). If the model has stochastic trends, user must use
+@code{nonlinear_filter_initialization=3}, the filters are then initialized with
+an identity matrix for the covariance matrix of the state variables. Default
+value is @code{nonlinear_filter_initialization=1} (initialization based on the
+first order approximation of the model).
+
@end table
@@ -7006,6 +7046,24 @@ estimates using a higher tapering are usually more reliable.
@end table
@end defvr
+@deffn Command unit_root_vars @var{VARIABLE_NAME}@dots{};
+
+This command is deprecated. Use @code{estimation} option @code{diffuse_filter} instead for estimating a model with non-stationary observed variables or @code{steady} option @code{nocheck} to prevent @code{steady} to check the steady state returned by your steady state file.
+@end deffn
+
+Dynare also has the ability to estimate Bayesian VARs:
+
+@deffn Command bvar_density ;
+Computes the marginal density of an estimated BVAR model, using
+Minnesota priors.
+
+See @file{bvar-a-la-sims.pdf}, which comes with Dynare distribution,
+for more information on this command.
+@end deffn
+
+@node Model Comparison
+@section Model Comparison
+
@deffn Command model_comparison @var{FILENAME}[(@var{DOUBLE})]@dots{};
@deffnx Command model_comparison (marginal_density = laplace | modifiedharmonicmean) @var{FILENAME}[(@var{DOUBLE})]@dots{};
@anchor{model_comparison}
@@ -7081,6 +7139,8 @@ Posterior probability of the respective model
@end defvr
+@node Shock Decomposition
+@section Shock Decomposition
@deffn Command shock_decomposition [@var{VARIABLE_NAME}]@dots{};
@deffnx Command shock_decomposition (@var{OPTIONS}@dots{}) [@var{VARIABLE_NAME}]@dots{};
@@ -7102,19 +7162,14 @@ model).
@table @code
-@item parameter_set = @var{PARAMETER_SET}
-Specify the parameter set to use for running the smoother. The
-@var{PARAMETER_SET} can take one of the following seven values:
-@code{calibration}, @code{prior_mode}, @code{prior_mean},
-@code{posterior_mode}, @code{posterior_mean},
-@code{posterior_median}, @code{mle_mode}. Note that the parameter
-set used in subsequent commands like @code{stoch_simul} will be set to
-the specified @code{parameter_set}.
-Default value: @code{posterior_mean} if
+@item parameter_set = @code{calibration} | @code{prior_mode} | @code{prior_mean} | @code{posterior_mode} | @code{posterior_mean} | @code{posterior_median} | @code{mle_mode}
+@anchor{parameter_set} Specify the parameter set to use for running the smoother. Note that the
+parameter set used in subsequent commands like @code{stoch_simul} will be set
+to the specified @code{parameter_set}. Default value: @code{posterior_mean} if
Metropolis has been run, @code{mle_mode} if MLE has been run.
@item datafile = @var{FILENAME}
-@xref{datafile}. Useful when computing the shock decomposition on a
+@anchor{datafile_shock_decomp} @xref{datafile}. Useful when computing the shock decomposition on a
calibrated model.
@item first_obs = @var{INTEGER}
@@ -7123,22 +7178,21 @@ calibrated model.
@item nobs = @var{INTEGER}
@xref{nobs}.
-@item use_shock_groups [= @var{SHOCK_GROUPS_NAME}]
-@anchor{use_shock_groups} Uses groups of shocks instead of individual shocks in
-the decomposition. Groups of shocks are defined in the @ref{shock_groups} block.
+@item use_shock_groups [= @var{STRING}]
+@anchor{use_shock_groups} Uses shock grouping defined by the string instead of individual shocks in
+the decomposition. The groups of shocks are defined in the @ref{shock_groups} block.
-@item colormap = @var{COLORMAP_NAME}
+@item colormap = @var{STRING}
@anchor{colormap} Controls the colormap used for the shocks decomposition
-graphs. See @code{colormap} in Matlab/Octave manual.
+graphs. See @code{colormap} in Matlab/Octave manual for valid arguments.
@item nograph
-@xref{nograph} Suppresses the display and creation only within the
-@code{shock_decomposition}-command but does not affect other commands.
+@xref{nograph}. Suppresses the display and creation only within the
+@code{shock_decomposition}-command, but does not affect other commands.
@xref{plot_shock_decomposition} for plotting graphs.
-@item init_state = @var{INTEGER}
-@anchor{init_state} It can take values of @math{0} or @math{1}. If equal to
-@math{0}, the shock decomposition is computed conditional on the smoothed state
+@item init_state = @var{BOOLEAN}
+@anchor{init_state} If equal to @math{0}, the shock decomposition is computed conditional on the smoothed state
variables in period @math{0}, @i{i.e.} the smoothed shocks starting in period
@math{1} are used. If equal to @math{1}, the shock decomposition is computed
conditional on the smoothed state variables in period @math{1}. Default:
@@ -7147,10 +7201,12 @@ conditional on the smoothed state variables in period @math{1}. Default:
@outputhead
+@defvr {MATLAB/Octave variable} oo_.shock_decomposition
@vindex oo_.shock_decomposition
+@anchor{oo_.shock_decomposition}
The results are stored in the field @code{oo_.shock_decomposition}, which is a three
dimensional array. The first dimension contains the @code{M_.endo_nbr} endogenous variables.
-The second dimension stores
+The second dimension stores
in the first @code{M_.exo_nbr} columns the contribution of the respective shocks.
Column @code{M_.exo_nbr+1} stores the contribution of the initial conditions,
while column @code{M_.exo_nbr+2} stores the smoothed value of the respective
@@ -7158,6 +7214,7 @@ endogenous variable in deviations from their steady state, @i{i.e.} the mean and
subtracted. The third dimension stores the time periods. Both the variables
and shocks are stored in the order of declaration, @i{i.e.} @code{M_.endo_names} and
@code{M_.exo_names}, respectively.
+@end defvr
@end deffn
@@ -7168,11 +7225,11 @@ and shocks are stored in the order of declaration, @i{i.e.} @code{M_.endo_names}
of the shock groups is written in a block delimited by @code{shock_groups} and
@code{end}.
-Each line defines a group of shock as a list of exogenous variables:
+Each line defines a group of shocks as a list of exogenous variables:
@example
SHOCK_GROUP_NAME = VARIABLE_1 [[,] VARIABLE_2 [,]@dots{}];
-`SHOCK GROUP NAME' = VARIABLE_1 [[,] VARIABLE_2 [,]@dots{}];
+'SHOCK GROUP NAME' = VARIABLE_1 [[,] VARIABLE_2 [,]@dots{}];
@end example
@optionshead
@@ -7196,12 +7253,13 @@ varexo e_a, e_b, e_c, e_d;
shock_groups(name=group1);
supply = e_a, e_b;
-`aggregate demand' = e_c, e_d;
+'aggregate demand' = e_c, e_d;
end;
shocks_decomposition(use_shock_groups=group1);
@end example
-
+This example defines a shock grouping with the name @code{group1}, containing a set of supply and demand shocks
+and conducts the shock decomposition for these two groups.
@end deffn
@deffn Command realtime_shock_decomposition [@var{VARIABLE_NAME}]@dots{};
@@ -7212,16 +7270,22 @@ shocks_decomposition(use_shock_groups=group1);
This command computes the realtime historical shock decomposition for a given
sample based on the Kalman smoother. For each period
-@math{T=[@code{presample}@dots{}@code{nobs}]}, it computes the:
+@math{T=[@code{presample},@dots{},@code{nobs}]}, it recursively computes three objects:
@itemize @bullet
@item
-realtime historical shock decomposition @math{Y(t|T)} for @math{t=[1@dots{}T]},
-@i{i.e.} without observing data in @math{[T+1@dots{}@code{nobs}]};
+realtime historical shock decomposition @math{Y(t|T)} for @math{t=[1,@dots{},T]},
+@i{i.e.} without observing data in @math{[T+1,@dots{},@code{nobs}]}. This results in a standard
+shock decomposition being computed for each additional datapoint becoming available after @code{presample}.
@item
-conditional shock decomposition @math{Y(T|T)} conditional on @math{Y(T|T-1)},
-@i{i.e.} @math{Y(t|T)} for @math{t=[T-1@dots{}T]};
+forecast shock decomposition @math{Y(T+k|T)} for @math{k=[1,@dots{},forecast]}, @i{i.e.} the @math{k}-step
+ahead forecast made for every @math{T} is decomposed in its shock contributions.
@item
-forecast shock decomposition @math{Y(T|T-1)}.
+realtime conditional shock decomposition of the difference between the realtime historical shock decomposition and the
+forecast shock decomposition. If @ref{vintage} is equal to @math{0}, it computes the effect of shocks realizing in period
+@math{T}, @i{i.e.} decomposes @math{Y(T|T)-Y(T|T-1)}. Put differently it conducts a @math{1}-period ahead shock decomposition from
+@math{T-1} to @math{T}, by decomposing the update step of the Kalman filter. If @code{vintage>0} and smaller than @code{nobs},
+the decomposition is conducted of the forecast revision @math{Y(T+k|T+k)-Y(T+k|T)}.
+
@end itemize
Like @ref{shock_decomposition} it decomposes the historical deviations of the endogenous
@@ -7237,17 +7301,11 @@ model).
@table @code
-@item parameter_set = @var{PARAMETER_SET}
-Specify the parameter set to use for running the smoother.
-@var{PARAMETER_SET} can take one of the following seven values:
-@code{calibration}, @code{prior_mode}, @code{prior_mean},
-@code{posterior_mode}, @code{posterior_mean},
-@code{posterior_median}, @code{mle_mode}. Default value: @code{posterior_mean} if
-Metropolis has been run, @code{mle_mode} if MLE has been run.
+@item parameter_set = @code{calibration} | @code{prior_mode} | @code{prior_mean} | @code{posterior_mode} | @code{posterior_mean} | @code{posterior_median} | @code{mle_mode}
+@xref{parameter_set}.
@item datafile = @var{FILENAME}
-@xref{datafile}. Useful when computing the shock decomposition on a
-calibrated model.
+@xref{datafile_shock_decomp}.
@item first_obs = @var{INTEGER}
@xref{first_obs}.
@@ -7255,14 +7313,11 @@ calibrated model.
@item nobs = @var{INTEGER}
@xref{nobs}.
-@item use_shock_groups [= @var{SHOCK_GROUPS_NAME}]
-@anchor{use_shock_groups_realtime} Uses groups of shocks instead of individual
-shocks in the decomposition. Groups of shocks are defined in the
-@ref{shock_groups} block.
+@item use_shock_groups [= @var{STRING}]
+@xref{use_shock_groups}.
-@item colormap = @var{COLORMAP_NAME}
-@anchor{colormap_realtime} Controls the colormap used for the shocks
-decomposition graphs. See @code{colormap} in Matlab/Octave manual.
+@item colormap = @var{STRING}
+@xref{colormap}.
@item nograph
@xref{nograph}. Only shock decompositions are computed and stored in @code{oo_.realtime_shock_decomposition},
@@ -7278,40 +7333,79 @@ realtime shock decompositions are computed, @i{i.e.} for
@anchor{forecast_shock_decomposition} Compute shock decompositions up to
@math{T+k} periods, @i{i.e.} get shock contributions to k-step ahead forecasts.
-@item save_realtime = [@var{integer1} ... @var{integern}]
+@item save_realtime = @var{INTEGER_VECTOR}
@anchor{save_realtime} Choose for which vintages to save the full realtime
shock decomposition. Default: @math{0}.
@end table
@outputhead
+@defvr {MATLAB/Octave variable} oo_.realtime_shock_decomposition
@vindex oo_.realtime_shock_decomposition
-The results of realtime historical decompositions are stored in the field
-@code{oo_.realtime_shock_decomposition}, which is a structure. Field
-@code{pool} stores the pooled decomposition (@xref{plot_shock_decomposition}).
-Fields @code{time_*} store the vintages of realtime historical shock
-decompositions.
+Structure storing the results of realtime historical decompositions. Fields are three-dimensional arrays with
+the first two dimension equal to the ones of @ref{oo_.shock_decomposition}. The third dimension stores the time
+periods and is therefore of size @code{T+forecast}. Fields are of the form:
+@example
+@code{oo_.realtime_shock_decomposition.@var{OBJECT}}
+@end example
+where @var{OBJECT} is one of the following:
-@vindex oo_.conditional_shock_decomposition
-The results of realtime conditional decompositions are stored in the field
-@code{oo_.conditional_shock_decomposition}, which is a structure. Field
-@code{pool} stores the pooled decomposition @math{Y(t|T)} for
-@math{t=T-1@dots{}T} @xref{plot_shock_decomposition}. Conditional shock
-decomposition sets the initial condition in @math{T-1}, so only computes the
-effect of shocks in period @math{T}, @i{i.e.} it is just a @math{1}-period
-shock decomposition from @math{T-1} to @math{T}. In practice it decomposes the
-update step of the Kalman filter. Fields @code{time_*} store the vintages of
-@math{k}-step conditional forecast shock decompositions @math{Y(t|T+k)}, for
-@math{t=[T@dots{}T+k}. @xref{vintage}.
+@table @code
+@item pool
+Stores the pooled decomposition, @i{i.e.} for every realtime shock decomposition terminal period
+@math{T=[@code{presample},@dots{},@code{nobs}]} it collects the last period's decomposition @math{Y(T|T)}
+(see also @ref{plot_shock_decomposition}). The third dimension of the array will have size
+@code{nobs+forecast}.
+
+@item time_*
+Stores the vintages of realtime historical shock decompositions if @code{save_realtime} is used. For example, if
+@code{save_realtime=[5]} and @code{forecast=8}, the third dimension will be of size 13.
+
+@end table
+@end defvr
+
+@defvr {MATLAB/Octave variable} oo_.realtime_conditional_shock_decomposition
+@vindex oo_.realtime_conditional_shock_decomposition
+Structure storing the results of realtime conditional decompositions. Fields are of the form:
+@example
+@code{oo_.realtime_conditional_shock_decomposition.@var{OBJECT}}
+@end example
+where @var{OBJECT} is one of the following:
+
+@table @code
+
+@item pool
+Stores the pooled realtime conditional shock decomposition, @i{i.e.} collects the decompositions of
+@math{Y(T|T)-Y(T|T-1)} for the terminal periods @math{T=[@code{presample},@dots{},@code{nobs}]}.
+The third dimension is of size @code{nobs}.
+
+@item time_*
+Store the vintages of @math{k}-step conditional forecast shock decompositions @math{Y(t|T+k)}, for
+@math{t=[T@dots{}T+k]}. @xref{vintage}. The third dimension is of size @code{1+forecast}.
+
+@end table
+@end defvr
+
+@defvr {MATLAB/Octave variable} oo_.realtime_forecast_shock_decomposition
@vindex oo_.realtime_forecast_shock_decomposition
-The results of realtime forecast decompositions are stored in the field
-@code{oo_.realtime_forecast_shock_decomposition}, which is a structure. Field
-@code{pool} stores the pooled decomposition @xref{plot_shock_decomposition}.
-Forecast shock decomposition computes the @math{1}-step ahead effect of shocks
-on the @math{1}-step ahead prediction, @i{i.e.} @math{Y(T|T-1)}. Fields
-@code{time_*} store the vintages of @math{k}-step out-of-sample forecast shock
+Structure storing the results of realtime forecast decompositions. Fields are of the form:
+@example
+@code{oo_.realtime_forecast_shock_decomposition.@var{OBJECT}}
+@end example
+where @var{OBJECT} is one of the following:
+
+@table @code
+
+@item pool
+Stores the pooled realtime forecast decomposition of the @math{1}-step ahead effect of shocks
+on the @math{1}-step ahead prediction, @i{i.e.} @math{Y(T|T-1)}.
+
+@item time_*
+Stores the vintages of @math{k}-step out-of-sample forecast shock
decompositions, @i{i.e.} @math{Y(t|T)}, for @math{t=[T@dots{}T+k]}. @xref{vintage}.
+@end table
+@end defvr
@end deffn
@@ -7321,139 +7415,113 @@ decompositions, @i{i.e.} @math{Y(t|T)}, for @math{t=[T@dots{}T+k]}. @xref{vintag
@descriptionhead
-This command plots the historical shock decomposition already computed by command
-@code{shock_decomposition}.
-The @code{variable_names} provided govern for which
-variables the decomposition is plotted.
+This command plots the historical shock decomposition already computed by
+@code{shock_decomposition} or @code{realtime_shock_decomposition}. For that reason,
+it must come after one of these commands. The @code{variable_names} provided govern which
+variables the decomposition is plotted for.
-Note that this command must come after @code{shock_decomposition} or @code{realtime_shock_decomposition}.
+Further note that, unlike the majority of Dynare commands, the options
+specified below are overwritten with their defaults before every call to
+@code{plot_shock_decomposition}. Hence, if you want to reuse an option in a
+subsequent call to @code{plot_shock_decomposition}, you must pass it to the
+command again.
@optionshead
@table @code
-@item use_shock_groups [= @var{SHOCK_GROUPS_NAME}]
-@anchor{use_shock_groups_plot} Uses groups of shocks instead of individual
-shocks in the decomposition. Groups of shocks are defined in the
-@ref{shock_groups} block.
+@item use_shock_groups [= @var{STRING}]
+@xref{use_shock_groups}.
-@item colormap = @var{COLORMAP_NAME}
-@anchor{colormap_plot} Controls the colormap used for the shocks decomposition
-graphs. See @code{colormap} in Matlab/Octave manual.
+@item colormap = @var{STRING}
+@xref{colormap}.
@item nodisplay
@xref{nodisplay}.
-@item graph_format = (@var{GRAPH_FORMAT_LIST})
+@item graph_format = @var{FORMAT}
+@itemx graph_format = ( @var{FORMAT}, @var{FORMAT}@dots{} )
@xref{graph_format}.
-@item detailed
-@anchor{detailed} Plots shock contributions using subplots, one per shock (or group of shocks).
+@item detail_plot
+Plots shock contributions using subplots, one per shock (or group of
+shocks). Default: not activated
-@item interactive
-@anchor{interactive} Under MATLAB, add uimenu's for detailed group plots.
+@item interactive
+Under MATLAB, add uimenus for detailed group plots. Default: not activated
-@item screen
-@anchor{screen} For large models (@i{i.e.} for models with more than @math{16}
+@item screen_shocks
+@anchor{screen_shcoks} For large models (@i{i.e.} for models with more than @math{16}
shocks), plots only the shocks that have the largest historical contribution
for chosen selected @code{variable_names}. Historical contribution is ranked
by the mean absolute value of all historical contributions.
-@item steadystate = @var{INTEGER}
-@anchor{steadystate} If equal to @math{1}, the the @math{y}-axis value of the
-zero line in the shock decomposition plot is translated to the steady state
-level. Default: @math{0}
+@item steadystate
+@anchor{steadystate} If passed, the the @math{y}-axis value of the zero line in
+the shock decomposition plot is translated to the steady state level. Default:
+not activated
-@item type = @var{TYPE_NAME}
-@anchor{type} For quarterly data, @var{TYPE_NAME} can take one of the
-following values: @code{qoq} for quarter-on-quarter plots, @code{yoy} for
-year-on-year plots of growth rates, @code{aoa} for annualized variables,
-@i{i.e.} the value in the last quarter for each year is plotted. Default
-value: @code{empty}, @i{i.e.} standard period-on-period plots (@code{qoq} for
-quarterly data).
+@item type = @code{qoq} | @code{yoy} | @code{aoa}
+@anchor{type} For quarterly data, valid arguments are: @code{qoq} for
+quarter-on-quarter plots, @code{yoy} for year-on-year plots of growth rates,
+@code{aoa} for annualized variables, @i{i.e.} the value in the last quarter for
+each year is plotted. Default value: @code{empty}, @i{i.e.} standard
+period-on-period plots (@code{qoq} for quarterly data).
-@item fig_name = @var{FIG_NAME}
+@item fig_name = @var{STRING}
@anchor{fig_name} Specifies a user-defined keyword to be appended to the
default figure name set by @code{plot_shock_decomposition}. This can avoid to
overwrite plots in case of sequential calls to @code{plot_shock_decomposition}.
@item write_xls
-@anchor{write_xls} Saves shock decompositions to excel.
+@anchor{write_xls} Saves shock decompositions to Excel-file in the main directory, named
+@code{FILENAME_shock_decomposition_TYPE_FIG_NAME.xls}. This option requires your system to be
+configured to be able to write Excel files.@footnote{In case of Excel not being installed,
+@url{https://mathworks.com/matlabcentral/fileexchange/38591-xlwrite--generate-xls-x--files-without-excel-on-mac-linux-win} may be helpful.}
@item realtime = @var{INTEGER}
@anchor{realtime} Which kind of shock decomposition to plot. @var{INTEGER} can take following values:
@itemize @bullet
@item
-@code{0}: historical shock decomposition: @math{Y(t|T)} for
-@math{t=[1@dots{}T]}, @math{T=} @code{nobs} full sample
+@code{0}: standard historical shock decomposition. @xref{shock_decomposition}.
@item
-@code{1}: realtime historical shock decomposition: for
-@math{T=[1@dots{}@code{nobs}]}, realtime shock decomposition @math{Y(t|T)} for
-@math{t=[1@dots{}T]}
+@code{1}: realtime historical shock decomposition. @xref{realtime_shock_decomposition}.
@item
-@code{2}: conditional shock decomposition: for @code{T=1:nobs}, realtime shock
-decomposition of @math{Y(T|T)} conditional on @math{Y(T|T-1)}, @i{i.e.}
-@math{Y(t|T)} for @math{t=[T-1@dots{}T]}
+@code{2}: conditional realtime shock decomposition. @xref{realtime_shock_decomposition}.
@item
-@code{3}: forecast shock decomposition: for @math{T=[1@dots{}@code{nobs}]},
-realtime shock decomposition of @math{Y(T|T-1)}
+@code{3}: realtime forecast shock decomposition. @xref{realtime_shock_decomposition}.
@end itemize
+If no @ref{vintage} is requested, @i{i.e.} @code{vintage=0} then the pooled objects from @ref{realtime_shock_decomposition}
+will be plotted and the respective vintage otherwise.
Default: @math{0}
@item vintage = @var{INTEGER}
-@anchor{vintage} Applies if @code{realtime}@math{>0}. Can take following values:
-@itemize @bullet
-@item
-@code{0}: plots @math{1}-step pooled shock decompositions
-@item
-@code{1}: pooled realtime shock decomposition. For @math{T=[1@dots{}@code{nobs}]}, plots last
-time point @math{Y(T|T)} of each vintage shock decomposition @math{Y(1:T|T)}
-@item
-@code{2}: pooled conditional shock decomposition. For
-@math{T=[1@dots{}@code{nobs}]}, realtime @math{1}-step shock decomposition of
-@math{Y(T|T)} conditional on @math{Y(T|T-1)} (@i{i.e.} decomposition of
-@math{1}-step filter updates of each vintage @math{T})
-@item
-@code{3}: pooled forecast shock decomposition. For
-@math{T=[1@dots{}@code{nobs}]}, realtime @math{1}-step ahead shock
-decomposition of @math{Y(T|T-1)} (@i{i.e.} decomposition of shock
-contributions to @math{1}-step ahead forecasts of each vintage @math{T})
-@end itemize
-When the value passed is greater than @math{0}, it plots the shock
+@anchor{vintage} Selects a particular data vintage in @math{[presample,@dots{},nobs]} for which to plot the results from
+@ref{realtime_shock_decomposition} selected via the @ref{realtime} option. If the standard
+historical shock decomposition is selected (@code{realtime=0}), @code{vintage} will have no effect. If @code{vintage=0}
+the pooled objects from @ref{realtime_shock_decomposition} will be plotted. If @code{vintage>0}, it plots the shock
decompositions for vintage @math{T=@code{vintage}} under the following scenarios:
@itemize @bullet
@item
@code{realtime=1}: the full vintage shock decomposition @math{Y(t|T)} for
-@math{t=[1@dots{}T]}
+@math{t=[1,@dots{},T]}
@item
@code{realtime=2}: the conditional forecast shock decomposition from @math{T},
@i{i.e.} plots @math{Y(T+j|T+j)} and the shock contributions needed to get to
the data @math{Y(T+j)} conditional on @math{T=}@code{vintage}, with
-@math{j=[0@dots{}@code{forecast}]}.
+@math{j=[0,@dots{},@code{forecast}]}.
@item
@code{realtime=3}: plots unconditional forecast shock decomposition from
@math{T}, @i{i.e.} @math{Y(T+j|T)}, where @math{T=@code{vintage}} and
-@math{j=[0@dots{}@code{forecast}]}.
+@math{j=[0,@dots{},@code{forecast}]}.
@end itemize
Default: @math{0}
@end table
@end deffn
-@deffn Command unit_root_vars @var{VARIABLE_NAME}@dots{};
-
-This command is deprecated. Use @code{estimation} option @code{diffuse_filter} instead for estimating a model with non-stationary observed variables or @code{steady} option @code{nocheck} to prevent @code{steady} to check the steady state returned by your steady state file.
-@end deffn
-
-Dynare also has the ability to estimate Bayesian VARs:
-
-@deffn Command bvar_density ;
-Computes the marginal density of an estimated BVAR model, using
-Minnesota priors.
-
-See @file{bvar-a-la-sims.pdf}, which comes with Dynare distribution,
-for more information on this command.
-@end deffn
+@node Calibrated Smoother
+@section Calibrated Smoother
Dynare can also run the smoother on a calibrated model:
@@ -12234,7 +12302,7 @@ plot(ts2.data,'--r'); % Plot of the filtered y.
hold off
axis tight
id = get(gca,'XTick');
-set(gca,'XTickLabel',strings(ts.dates(id)));
+set(gca,'XTickLabel',strings(ts1.dates(id)));
@end example
@iftex
diff --git a/matlab/DsgeSmoother.m b/matlab/DsgeSmoother.m
index f9e459e00..08b7011e9 100644
--- a/matlab/DsgeSmoother.m
+++ b/matlab/DsgeSmoother.m
@@ -255,7 +255,9 @@ if kalman_algo == 2 || kalman_algo == 4
[Pstar,Pinf] = compute_Pinf_Pstar(mf,ST,R1,Q,options_.qz_criterium);
else
Pstar = blkdiag(Pstar,H);
- Pinf = blkdiag(Pinf,zeros(vobs));
+ if ~isempty(Pinf)
+ Pinf = blkdiag(Pinf,zeros(vobs));
+ end
end
%now reset H to 0
H = zeros(vobs,vobs);
diff --git a/matlab/PlotPosteriorDistributions.m b/matlab/PlotPosteriorDistributions.m
index 2ae183793..d2e89ea00 100644
--- a/matlab/PlotPosteriorDistributions.m
+++ b/matlab/PlotPosteriorDistributions.m
@@ -16,7 +16,7 @@ function oo_ = PlotPosteriorDistributions(estim_params_, M_, options_, bayestopt
% SPECIAL REQUIREMENTS
% none
-% Copyright (C) 2005-2016 Dynare Team
+% Copyright (C) 2005-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -63,7 +63,7 @@ for i=1:npar
subplotnum = subplotnum+1;
if subplotnum == 1
figunumber = figunumber+1;
- hfig=dyn_figure(options_,'Name',figurename);
+ hfig=dyn_figure(options_.nodisplay,'Name',figurename);
end
[nam,texnam] = get_the_name(i,TeX,M_,estim_params_,options_);
if subplotnum == 1
@@ -152,7 +152,7 @@ for i=1:npar
hold off;
drawnow
if subplotnum == MaxNumberOfPlotPerFigure || i == npar;
- dyn_saveas(hfig,[OutputDirectoryName '/' M_.fname '_PriorsAndPosteriors' int2str(figunumber)],options_);
+ dyn_saveas(hfig,[OutputDirectoryName '/' M_.fname '_PriorsAndPosteriors' int2str(figunumber)],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for j = 1:size(NAMES,1)
diff --git a/matlab/PosteriorIRF_core2.m b/matlab/PosteriorIRF_core2.m
index 295f6d5eb..abf1c3cbd 100644
--- a/matlab/PosteriorIRF_core2.m
+++ b/matlab/PosteriorIRF_core2.m
@@ -30,7 +30,7 @@ function myoutput=PosteriorIRF_core2(myinputs,fpar,npar,whoiam,ThisMatlab)
% SPECIAL REQUIREMENTS.
% None.
%
-% Copyright (C) 2006-2016 Dynare Team
+% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -103,9 +103,9 @@ for i=fpar:npar,
if max(abs(MeanIRF(:,j,i))) >= options_.impulse_responses.plot_threshold
subplotnum = subplotnum+1;
if subplotnum == 1 && options_.relative_irf
- hh = dyn_figure(options_,'Name',['Relative response to orthogonalized shock to ' tit(i,:)]);
+ hh = dyn_figure(options_.nodisplay,'Name',['Relative response to orthogonalized shock to ' tit(i,:)]);
elseif subplotnum == 1 && ~options_.relative_irf
- hh = dyn_figure(options_,'Name',['Orthogonalized shock to ' tit(i,:)]);
+ hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit(i,:)]);
end
set(0,'CurrentFigure',hh)
@@ -152,7 +152,7 @@ for i=fpar:npar,
if subplotnum == MaxNumberOfPlotPerFigure || (j == nvar && subplotnum> 0)
figunumber = figunumber+1;
- dyn_saveas(hh,[DirectoryName '/' M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber)],options_);
+ dyn_saveas(hh,[DirectoryName '/' M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber)],options_.nodisplay,options_.graph_format);
if RemoteFlag==1,
OutputFileName = [OutputFileName; {[DirectoryName,filesep], [M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber) '.*']}];
end
diff --git a/matlab/UnivariateSpectralDensity.m b/matlab/UnivariateSpectralDensity.m
index fa0a9e22c..ab00d1856 100644
--- a/matlab/UnivariateSpectralDensity.m
+++ b/matlab/UnivariateSpectralDensity.m
@@ -19,7 +19,7 @@ function [oo_] = UnivariateSpectralDensity(M_,oo_,options_,var_list)
% Adapted from th_autocovariances.m.
-% Copyright (C) 2006-2015 Dynare Team
+% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -159,12 +159,12 @@ if options_.nograph == 0
end
for i= 1:nvar
- hh = dyn_figure(options_,'Name',['Spectral Density of ' deblank(M_.endo_names(ivar(i),:)) '.']);
+ hh = dyn_figure(options_.nodisplay,'Name',['Spectral Density of ' deblank(M_.endo_names(ivar(i),:)) '.']);
plot(freqs,f(i,:),'-k','linewidth',2)
xlabel('0 \leq \omega \leq \pi')
ylabel('f(\omega)')
box on
axis tight
- dyn_saveas(hh,[M_.fname ,filesep,'graphs', filesep, 'SpectralDensity_' deblank(M_.endo_names(ivar(i),:))],options_)
+ dyn_saveas(hh,[M_.fname ,filesep,'graphs', filesep, 'SpectralDensity_' deblank(M_.endo_names(ivar(i),:))],options_.nodisplay,options_.graph_format)
end
end
diff --git a/matlab/WriteShockDecomp2Excel.m b/matlab/WriteShockDecomp2Excel.m
index f6259dff6..dff5c79bb 100644
--- a/matlab/WriteShockDecomp2Excel.m
+++ b/matlab/WriteShockDecomp2Excel.m
@@ -31,9 +31,9 @@ function WriteShockDecomp2Excel(z,shock_names,endo_names,i_var,initial_date,Dyna
SteadyState=[];
fig_mode='';
fig_mode1='';
-fig_names='';
+fig_name='';
screen_shocks=0;
-use_shock_groups = DynareOptions.use_shock_groups;
+use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
if use_shock_groups
shock_groups = DynareModel.shock_groups.(use_shock_groups);
shock_ind = fieldnames(shock_groups);
@@ -52,21 +52,21 @@ if nargin==8 ,
fig_mode = [fig_mode '_'];
end
if isfield(opts_decomp,'screen_shocks')
- if DynareOptions.use_shock_groups,
+ if use_shock_groups
screen_shocks=0;
elseif comp_nbr>18
screen_shocks = opts_decomp.screen_shocks;
end
end
- if isfield(opts_decomp,'fig_names')
- fig_names = opts_decomp.fig_names;
-% fig_names = ['_' fig_names];
- fig_names1 = [fig_names];
- fig_names = [fig_names '_'];
+ if isfield(opts_decomp,'fig_name')
+ fig_name = opts_decomp.fig_name;
+% fig_name = ['_' fig_name];
+ fig_name1 = [fig_name];
+ fig_name = [fig_name '_'];
end
if screen_shocks
- fig_names1 = [fig_names1 '_screen'];
- fig_names = [fig_names 'screen_'];
+ fig_name1 = [fig_name1 '_screen'];
+ fig_name = [fig_name 'screen_'];
end
end
@@ -115,9 +115,9 @@ for j=1:nvar
warning off
if ~ismac
- [STATUS,MESSAGE] = xlswrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_names1],d0,deblank(endo_names(i_var(j),:)));
+ [STATUS,MESSAGE] = xlswrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,deblank(endo_names(i_var(j),:)));
else
- [STATUS] = xlwrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_names1],d0,deblank(endo_names(i_var(j),:)));
+ [STATUS] = xlwrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,deblank(endo_names(i_var(j),:)));
end
warning on
diff --git a/matlab/annualized_shock_decomposition.m b/matlab/annualized_shock_decomposition.m
index 8552b9d4f..9590699b3 100644
--- a/matlab/annualized_shock_decomposition.m
+++ b/matlab/annualized_shock_decomposition.m
@@ -49,7 +49,7 @@ function [z, endo_names, endo_names_tex, steady_state, i_var, oo_] = annualized_
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-opts = options_.shock_decomp;
+opts = options_.plot_shock_decomp;
nvar = length(i_var);
GYTREND0 = q2a.GYTREND0;
var_type = q2a.type;
@@ -61,8 +61,8 @@ cumfix = q2a.cumfix;
if isstruct(oo_)
% z = oo_.shock_decomposition;
myopts=options_;
- myopts.shock_decomp.type='qoq';
- myopts.shock_decomp.realtime=0;
+ myopts.plot_shock_decomp.type='qoq';
+ myopts.plot_shock_decomp.realtime=0;
[z, junk] = plot_shock_decomposition(M_,oo_,myopts,[]);
else
z = oo_;
@@ -93,8 +93,8 @@ end
if isstruct(aux)
if ischar(aux.y)
myopts=options_;
- myopts.shock_decomp.type='qoq';
- myopts.shock_decomp.realtime=0;
+ myopts.plot_shock_decomp.type='qoq';
+ myopts.plot_shock_decomp.realtime=0;
[y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,myopts,aux.y);
aux.y=y_aux;
aux.yss=steady_state_aux;
@@ -183,9 +183,9 @@ for i=t0:4:t1,
za=[];
gza=[];
myopts=options_;
- myopts.shock_decomp.type='qoq';
- myopts.shock_decomp.realtime=1;
- myopts.shock_decomp.vintage=i;
+ myopts.plot_shock_decomp.type='qoq';
+ myopts.plot_shock_decomp.realtime=1;
+ myopts.plot_shock_decomp.vintage=i;
[z, steady_state_aux] = plot_shock_decomposition(M_,oo_,myopts,[]);
z = z(i_var,:,:);
if isstruct(aux)
@@ -271,6 +271,17 @@ end
% fix total
oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-nfrcst)])(:,end,:) = ...
oo_.annualized_realtime_shock_decomposition.pool(:,end,yr-nfrcst:end);
+ if i==t1
+ for my_forecast_=(nfrcst-1):-1:1,
+ oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-my_forecast_)]) = ...
+ oo_.annualized_realtime_shock_decomposition.pool(:,:,yr-my_forecast_:yr) - ...
+ oo_.annualized_realtime_forecast_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,:,1:my_forecast_+1);
+ oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,end-1,:) = ...
+ oo_.annualized_realtime_forecast_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,end,1:my_forecast_+1);
+ oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,end,:) = ...
+ oo_.annualized_realtime_shock_decomposition.pool(:,end,yr-my_forecast_:yr);
+ end
+ end
end
end
% ztmp=oo_.realtime_shock_decomposition.pool(:,:,21:29)-oo_.realtime_forecast_shock_decomposition.time_21;
diff --git a/matlab/bvar_forecast.m b/matlab/bvar_forecast.m
index 9b22ff679..d070884b4 100644
--- a/matlab/bvar_forecast.m
+++ b/matlab/bvar_forecast.m
@@ -11,7 +11,7 @@ function bvar_forecast(nlags)
% SPECIAL REQUIREMENTS
% none
-% Copyright (C) 2007-2013 Dynare Team
+% Copyright (C) 2007-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -125,7 +125,7 @@ for i = 1:ny
options_.varobs{i});
end
-dyn_saveas(dyn_graph.fh,[OutputDirectoryName '/' M_.fname '_BVAR_forecast_',num2str(nlags)],options_)
+dyn_saveas(dyn_graph.fh,[OutputDirectoryName '/' M_.fname '_BVAR_forecast_',num2str(nlags)],options_.nodisplay,options_.graph_format)
% Compute RMSE
diff --git a/matlab/check_posterior_sampler_options.m b/matlab/check_posterior_sampler_options.m
index 299b4b3f6..1980c0a79 100644
--- a/matlab/check_posterior_sampler_options.m
+++ b/matlab/check_posterior_sampler_options.m
@@ -418,6 +418,10 @@ if strcmp(posterior_sampler_options.posterior_sampling_method,'slice')
posterior_sampler_options.V1=V1;
posterior_sampler_options.WR=sqrt(diag(D))*3;
end
+ else
+ if ~options_.load_mh_file && ~posterior_sampler_options.slice_initialize_with_mode,
+ posterior_sampler_options.invhess=[];
+ end
end
% needs to be re-set to zero otherwise posterior analysis is filtered
diff --git a/matlab/convergence_diagnostics/McMCDiagnostics.m b/matlab/convergence_diagnostics/McMCDiagnostics.m
index fb4f41262..c42467d31 100644
--- a/matlab/convergence_diagnostics/McMCDiagnostics.m
+++ b/matlab/convergence_diagnostics/McMCDiagnostics.m
@@ -16,7 +16,7 @@ function oo_ = McMCDiagnostics(options_, estim_params_, M_, oo_)
% PARALLEL CONTEXT
% See the comment in posterior_sampler.m funtion.
-% Copyright (C) 2005-2016 Dynare Team
+% Copyright (C) 2005-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -287,7 +287,7 @@ clear pmet temp moyenne CSUP CINF csup cinf n linea iter tmp;
pages = floor(npar/3);
k = 0;
for i = 1:pages
- h=dyn_figure(options_,'Name','MCMC univariate convergence diagnostic (Brooks and Gelman,1998)');
+ h=dyn_figure(options_.nodisplay,'Name','MCMC univariate convergence diagnostic (Brooks and Gelman,1998)');
boxplot = 1;
for j = 1:3 % Loop over parameters
k = k+1;
@@ -325,7 +325,7 @@ for i = 1:pages
boxplot = boxplot + 1;
end
end
- dyn_saveas(h,[OutputFolder '/' ModelName '_udiag' int2str(i)],options_);
+ dyn_saveas(h,[OutputFolder '/' ModelName '_udiag' int2str(i)],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:size(NAMES,1)
@@ -350,7 +350,7 @@ if reste
nr = 2;
nc = 3;
end
- h = dyn_figure(options_,'Name','MCMC univariate convergence diagnostic (Brooks and Gelman, 1998)');
+ h = dyn_figure(options_.nodisplay,'Name','MCMC univariate convergence diagnostic (Brooks and Gelman, 1998)');
boxplot = 1;
for j = 1:reste
k = k+1;
@@ -388,7 +388,7 @@ if reste
boxplot = boxplot + 1;
end
end
- dyn_saveas(h,[ OutputFolder '/' ModelName '_udiag' int2str(pages+1)],options_);
+ dyn_saveas(h,[ OutputFolder '/' ModelName '_udiag' int2str(pages+1)],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:size(NAMES,1);
@@ -461,7 +461,7 @@ for iter = Origin:StepSize:NumberOfDraws
end
MDIAG(:,[2 4 6],:) = MDIAG(:,[2 4 6],:)/nblck;
-h = dyn_figure(options_,'Name','Multivariate convergence diagnostic');
+h = dyn_figure(options_.nodisplay,'Name','Multivariate convergence diagnostic');
boxplot = 1;
for crit = 1:3
if crit == 1
@@ -493,7 +493,7 @@ for crit = 1:3
title(namnam,'Interpreter','none');
boxplot = boxplot + 1;
end
-dyn_saveas(h,[ OutputFolder '/' ModelName '_mdiag'],options_);
+dyn_saveas(h,[ OutputFolder '/' ModelName '_mdiag'],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
diff --git a/matlab/datatomfile.m b/matlab/datatomfile.m
index 4c7abec23..4f6a5ff49 100644
--- a/matlab/datatomfile.m
+++ b/matlab/datatomfile.m
@@ -1,20 +1,23 @@
-function datatomfile (s,var_list, names)
-% function datatomfile (s,var_list)
-% This optional command saves the simulation results in a text file. The name of each
-% variable preceeds the corresponding results. This command must follow SIMUL.
-%
-% INPUTS
-% s: data file name
-% var_list: vector of selected endogenous variables
-% names: vector of strings (alternative names for the endogenous variables in the data file)
-%
-% OUTPUTS
-% none
-%
-% SPECIAL REQUIREMENTS
-% none
+function datatomfile (s, var_list, names)
-% Copyright (C) 2001-2016 Dynare Team
+% This command saves the simulation results in a text file. The name of each
+% variable preceeds the corresponding results. This command must follow SIMUL
+% or STOCH_SIMUL commands.
+%
+% INPUTS
+% - s: data file name
+% - var_list: vector of selected endogenous variables
+% - names: vector of strings (alternative names for the endogenous variables in the data file)
+%
+% OUTPUTS
+% none
+%
+% REMARKS
+% Only the first argument is mandatory. If only one input argument is
+% provided, all the variables as defined in M_.endo_names will be saved in
+% the generated m file.
+
+% Copyright (C) 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
diff --git a/matlab/dsge_simulated_theoretical_covariance.m b/matlab/dsge_simulated_theoretical_covariance.m
index 38ef7c3b6..8296b90da 100644
--- a/matlab/dsge_simulated_theoretical_covariance.m
+++ b/matlab/dsge_simulated_theoretical_covariance.m
@@ -126,7 +126,6 @@ for file = 1:NumberOfDrawsFiles
if ~test% Prepare the last round...
Covariance_matrix = zeros(NumberOfLinesInTheLastCovarFile,nvar*(nvar+1)/2);
NumberOfCovarLines = NumberOfLinesInTheLastCovarFile;
- CovarFileNumber = CovarFileNumber - 1;
elseif test<0
Covariance_matrix = zeros(MaXNumberOfCovarLines,nvar*(nvar+1)/2);
else
diff --git a/matlab/dyn_figure.m b/matlab/dyn_figure.m
index f26a39345..62182a291 100644
--- a/matlab/dyn_figure.m
+++ b/matlab/dyn_figure.m
@@ -1,9 +1,9 @@
-function h=dyn_figure(DynareOptions,varargin)
-%function h=dyn_figure(DynareOptions,varargin)
+function h = dyn_figure(nodisplay, varargin)
+%function h = dyn_figure(nodisplay, varargin)
% initializes figures for DYNARE
%
% INPUTS
-% DynareOptions: dynare options
+% nodisplay: the value of the command-specific nodisplay argument or options_.nodisplay
% varargin: the same list of possible inputs of the MATLAB function figure
%
% OUTPUTS
@@ -12,7 +12,7 @@ function h=dyn_figure(DynareOptions,varargin)
% SPECIAL REQUIREMENTS
% none
-% Copyright (C) 2012 Dynare Team
+% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -29,7 +29,7 @@ function h=dyn_figure(DynareOptions,varargin)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-if DynareOptions.nodisplay,
+if nodisplay
h = figure(varargin{:},'visible','off');
else
h = figure(varargin{:});
diff --git a/matlab/dyn_saveas.m b/matlab/dyn_saveas.m
index 4c897a620..a31c724b2 100644
--- a/matlab/dyn_saveas.m
+++ b/matlab/dyn_saveas.m
@@ -1,11 +1,12 @@
-function dyn_saveas(h,fname,DynareOptions)
-%function dyn_saveas(h,fname,DynareOptions)
+function dyn_saveas(h, fname, nodisplay, graph_format)
+%function dyn_saveas(h, fname, nodisplay, graph_format)
% save figures for DYNARE
%
% INPUTS
% h : figure handle
% fname : name of the saved figure
-% DynareOptions: dynare options
+% nodisplay: the value of the command-specific nodisplay argument or options_.nodisplay
+% graph_format: the value of the command-specific graph_format argument or options_.graph_format
%
% OUTPUTS
% none
@@ -13,7 +14,7 @@ function dyn_saveas(h,fname,DynareOptions)
% SPECIAL REQUIREMENTS
% none
-% Copyright (C) 2012-2013 Dynare Team
+% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -30,28 +31,28 @@ function dyn_saveas(h,fname,DynareOptions)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-if any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+if any(strcmp('eps',cellstr(graph_format)))
if isoctave
fname = strrep(fname,'/',filesep);
fname = strrep(fname,'\',filesep);
- if DynareOptions.nodisplay && ispc,
+ if nodisplay && ispc
set(h, 'Visible','on');
end
end
print(h,'-depsc2',[fname,'.eps'])
end
-if any(strcmp('pdf',cellstr(DynareOptions.graph_format)))
+if any(strcmp('pdf',cellstr(graph_format)))
if isoctave
error('Octave cannot create pdf files!')
else
print(h,'-dpdf',[fname,'.pdf'])
end
end
-if any(strcmp('fig',cellstr(DynareOptions.graph_format)))
+if any(strcmp('fig',cellstr(graph_format)))
if isoctave
error('Octave cannot create fig files!')
else
- if DynareOptions.nodisplay
+ if nodisplay
% THE FOLLOWING LINES COULD BE USED IF BUGS/PROBLEMS ARE REPORTED USING LINE 60
% set(h,'Units','Normalized')
% mypos=get(h,'Position');
@@ -62,10 +63,10 @@ if any(strcmp('fig',cellstr(DynareOptions.graph_format)))
saveas(h,[fname '.fig']);
end
end
-if any(strcmp('none',cellstr(DynareOptions.graph_format)))
+if any(strcmp('none',cellstr(graph_format)))
% don't save
% check here as a reminder that none is an option to graph_format
end
-if DynareOptions.nodisplay
+if nodisplay
close(h);
end
diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m
index e5812af90..6463a7506 100644
--- a/matlab/dynare_config.m
+++ b/matlab/dynare_config.m
@@ -118,6 +118,11 @@ if (isoctave && ~user_has_octave_forge_package('statistics')) ...
p{end+1} = '/missing/nanmean';
end
+% Check if struct2array is available.
+if ~exist('struct2array')
+ p{end+1} = '/missing/struct2array';
+end
+
P = cellfun(@(c)[dynareroot(1:end-1) c], p, 'uni',false);
% Get mex files folder(s)
diff --git a/matlab/dynare_estimation.m b/matlab/dynare_estimation.m
index 56221affe..5d140bd18 100644
--- a/matlab/dynare_estimation.m
+++ b/matlab/dynare_estimation.m
@@ -12,7 +12,7 @@ function oo_recursive_=dynare_estimation(var_list,dname)
% SPECIAL REQUIREMENTS
% none
-% Copyright (C) 2003-2015 Dynare Team
+% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -151,7 +151,7 @@ if nnobs > 1 && horizon > 0
for i = 1:size(var_list,1)
if mod(i,nstar) == 1
plot_index=plot_index+1;
- hfig = dyn_figure(options_,'Name',['Out of sample forecasts (',num2str(plot_index),')']);
+ hfig = dyn_figure(options_.nodisplay,'Name',['Out of sample forecasts (',num2str(plot_index),')']);
m = 1;
end
subplot(nr,nc,m)
@@ -208,7 +208,7 @@ if nnobs > 1 && horizon > 0
xlim([nobs(1)-offsetx nobs(end)+horizon])
m = m + 1;
if mod(i+1,nstar) == 1 || i ==size(var_list,1)
- dyn_saveas(hfig,[M_.fname,filesep,'graphs',filesep M_.fname '_RecursiveForecasts_' int2str(plot_index)],options_);
+ dyn_saveas(hfig,[M_.fname,filesep,'graphs',filesep M_.fname '_RecursiveForecasts_' int2str(plot_index)],options_.nodisplay,options_.graph_format);
end
end
end
diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m
index 6693768ce..0a27271de 100644
--- a/matlab/dynare_estimation_1.m
+++ b/matlab/dynare_estimation_1.m
@@ -12,7 +12,7 @@ function dynare_estimation_1(var_list_,dname)
% SPECIAL REQUIREMENTS
% none
-% Copyright (C) 2003-2016 Dynare Team
+% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -44,6 +44,11 @@ end
%store qz_criterium
qz_criterium_old=options_.qz_criterium;
+if isnan(options_.first_obs)
+ first_obs_nan_indicator=true;
+else
+ first_obs_nan_indicator=false;
+end
% Set particle filter flag.
if options_.order > 1
@@ -414,7 +419,6 @@ end
if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
(any(bayestopt_.pshape >0 ) && options_.load_mh_file) %% not ML estimation
- bounds = prior_bounds(bayestopt_, options_.prior_trunc);
outside_bound_pars=find(xparam1 < bounds.lb | xparam1 > bounds.ub);
if ~isempty(outside_bound_pars)
for ii=1:length(outside_bound_pars)
@@ -542,7 +546,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
fprintf(fidTeX,' \n');
end
for plt = 1:nbplt,
- fh = dyn_figure(options_,'Name','Smoothed shocks');
+ fh = dyn_figure(options_.nodisplay,'Name','Smoothed shocks');
NAMES = [];
if options_.TeX, TeXNAMES = []; end
nstar0=min(nstar,M_.exo_nbr-(plt-1)*nstar);
@@ -583,7 +587,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
end
title(name,'Interpreter','none')
end
- dyn_saveas(fh,[M_.fname '_SmoothedShocks' int2str(plt)],options_);
+ dyn_saveas(fh,[M_.fname '_SmoothedShocks' int2str(plt)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:nstar0
@@ -621,7 +625,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
fprintf(fidTeX,' \n');
end
for plt = 1:nbplt
- fh = dyn_figure(options_,'Name','Smoothed observation errors');
+ fh = dyn_figure(options_.nodisplay,'Name','Smoothed observation errors');
NAMES = [];
if options_.TeX, TeXNAMES = []; end
nstar0=min(nstar,number_of_plots_to_draw-(nbplt-1)*nstar);
@@ -663,7 +667,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
end
title(name,'Interpreter','none')
end
- dyn_saveas(fh,[M_.fname '_SmoothedObservationErrors' int2str(plt)],options_);
+ dyn_saveas(fh,[M_.fname '_SmoothedObservationErrors' int2str(plt)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:nstar0
@@ -696,7 +700,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
fprintf(fidTeX,' \n');
end
for plt = 1:nbplt,
- fh = dyn_figure(options_,'Name','Historical and smoothed variables');
+ fh = dyn_figure(options_.nodisplay,'Name','Historical and smoothed variables');
NAMES = [];
if options_.TeX, TeXNAMES = []; end
nstar0=min(nstar,n_varobs-(plt-1)*nstar);
@@ -738,7 +742,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
end
title(name,'Interpreter','none')
end
- dyn_saveas(fh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)],options_);
+ dyn_saveas(fh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:nstar0,
@@ -776,3 +780,6 @@ if reset_options_related_to_estimation
options_.mode_compute = mode_compute_o;
options_.mh_replic = mh_replic_o;
end
+if first_obs_nan_indicator
+ options_.first_obs=NaN;
+end
\ No newline at end of file
diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m
index 7532f1432..b8e8b4ff6 100644
--- a/matlab/dynare_estimation_init.m
+++ b/matlab/dynare_estimation_init.m
@@ -527,13 +527,16 @@ if ~isempty(options_.datafile)
end
end
+if isnan(options_.first_obs)
+ options_.first_obs=1;
+end
[dataset_, dataset_info, newdatainterfaceflag] = makedataset(options_, options_.dsge_var*options_.dsge_varlag, gsa_flag);
%set options for old interface from the ones for new interface
if ~isempty(dataset_)
options_.nobs = dataset_.nobs;
- options_.first_obs=double(dataset_.init);
end
+
% setting steadystate_check_flag option
if options_.diffuse_filter || options_.steadystate.nocheck
steadystate_check_flag = 0;
diff --git a/matlab/dynare_graph_init.m b/matlab/dynare_graph_init.m
index 4e0af5b8c..0783a4029 100644
--- a/matlab/dynare_graph_init.m
+++ b/matlab/dynare_graph_init.m
@@ -12,7 +12,7 @@ function dyn_graph=dynare_graph_init(figure_name,nplot,line_types,line_width)
% SPECIAL REQUIREMENT
% none
-% Copyright (C) 2006-2013 Dynare Team
+% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -31,7 +31,7 @@ function dyn_graph=dynare_graph_init(figure_name,nplot,line_types,line_width)
global options_
-dyn_graph.fh = dyn_figure(options_,'Name',figure_name);
+dyn_graph.fh = dyn_figure(options_.nodisplay,'Name',figure_name);
dyn_graph.figure_name = figure_name;
if nargin > 2
dyn_graph.line_types = line_types;
diff --git a/matlab/evaluate_smoother.m b/matlab/evaluate_smoother.m
index 35ed0ea3d..fb3eaad7a 100644
--- a/matlab/evaluate_smoother.m
+++ b/matlab/evaluate_smoother.m
@@ -37,7 +37,7 @@ function [oo_,M_,options_,bayestopt_,Smoothed_variables_declaration_order_deviat
% [1] This function use persistent variables for the dataset and the description of the missing observations. Consequently, if this function
% is called more than once (by changing the value of parameters) the sample *must not* change.
-% Copyright (C) 2010-2016 Dynare Team
+% Copyright (C) 2010-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -54,21 +54,17 @@ function [oo_,M_,options_,bayestopt_,Smoothed_variables_declaration_order_deviat
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-persistent dataset_ dataset_info
-
-%store qz_criterium
+% store qz_criterium
qz_criterium_old=options_.qz_criterium;
if ischar(parameters) && strcmp(parameters,'calibration')
options_.smoother=1;
end
-if isempty(dataset_) || isempty(bayestopt_) || (options_.nobs ~= dataset_.nobs)
- [dataset_,dataset_info,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] = dynare_estimation_init(var_list, M_.fname, [], M_, options_, oo_, estim_params_, bayestopt_);
-else
+[dataset_,dataset_info,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] = dynare_estimation_init(var_list, M_.fname, [], M_, options_, oo_, estim_params_, bayestopt_);
+
% set the qz_criterium
- options_=select_qz_criterium_value(options_);
-end
+options_=select_qz_criterium_value(options_);
if nargin==0
parameters = 'posterior_mode';
diff --git a/matlab/expand_group.m b/matlab/expand_group.m
index 145208660..7681ffeea 100644
--- a/matlab/expand_group.m
+++ b/matlab/expand_group.m
@@ -37,7 +37,7 @@ end
% define expanded group
label = mydata.shock_group.label;
shocks = mydata.shock_group.shocks;
-options.shock_decomp.fig_names = [mydata.fig_names '. Expand'];
+options.shock_decomp.fig_name = [mydata.fig_name '. Expand'];
options.use_shock_groups = strrep(label,' ','_'); %[use_shock_groups_old int2str(ic)];
for j=1:length(shocks)
M.shock_groups.(options.use_shock_groups).(['group' int2str(j)]).label=shocks{j};
diff --git a/matlab/forecast_graphs.m b/matlab/forecast_graphs.m
index be6f49399..50e682c3a 100644
--- a/matlab/forecast_graphs.m
+++ b/matlab/forecast_graphs.m
@@ -8,7 +8,7 @@ function forecast_graphs(var_list,M_, oo_,options_)
% o oo_ outputs structure
% o options_ options structure
-% Copyright (C) 2008-2016 Dynare Team
+% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -61,10 +61,10 @@ end
m = 1;
n_fig = 1;
-hh=dyn_figure(options_,'Name','Forecasts (I)');
+hh=dyn_figure(options_.nodisplay,'Name','Forecasts (I)');
for j= 1:nvar
if m > nc*nr;
- dyn_saveas(hh,[ dname '/graphs/forcst' int2str(n_fig)],options_);
+ dyn_saveas(hh,[ dname '/graphs/forcst' int2str(n_fig)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
fprintf(fidTeX,'\\centering \n');
@@ -75,7 +75,7 @@ for j= 1:nvar
fprintf(fidTeX,' \n');
end
n_fig =n_fig+1;
- eval(['hh=dyn_figure(options_,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
+ eval(['hh=dyn_figure(options_.nodisplay,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
m = 1;
end
subplot(nr,nc,m);
@@ -100,7 +100,7 @@ for j= 1:nvar
end
if m > 1
- dyn_saveas(hh,[dname '/graphs/forcst' int2str(n_fig)],options_);
+ dyn_saveas(hh,[dname '/graphs/forcst' int2str(n_fig)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
fprintf(fidTeX,'\\centering \n');
@@ -125,10 +125,10 @@ if isfield(oo_.forecast,'HPDinf_ME')
m = 1;
n_fig = 1;
- hh=dyn_figure(options_,'Name','Forecasts including ME (I)');
+ hh=dyn_figure(options_.nodisplay,'Name','Forecasts including ME (I)');
for j= 1:length(var_names)
if m > nc*nr;
- dyn_saveas(hh,[ dname '/graphs/forcst_ME' int2str(n_fig)],options_);
+ dyn_saveas(hh,[ dname '/graphs/forcst_ME' int2str(n_fig)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
fprintf(fidTeX,'\\centering \n');
@@ -139,7 +139,7 @@ if isfield(oo_.forecast,'HPDinf_ME')
fprintf(fidTeX,' \n');
end
n_fig =n_fig+1;
- eval(['hh=dyn_figure(options_,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
+ eval(['hh=dyn_figure(options_.nodisplay,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
m = 1;
end
subplot(nr,nc,m);
@@ -158,7 +158,7 @@ if isfield(oo_.forecast,'HPDinf_ME')
end
if m > 1
- dyn_saveas(hh,[dname '/graphs/forcst_ME' int2str(n_fig)],options_);
+ dyn_saveas(hh,[dname '/graphs/forcst_ME' int2str(n_fig)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
fprintf(fidTeX,'\\centering \n');
diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m
index 9af259811..1df3ea3a0 100644
--- a/matlab/global_initialization.m
+++ b/matlab/global_initialization.m
@@ -11,7 +11,7 @@ function global_initialization()
% SPECIAL REQUIREMENTS
% none
-% Copyright (C) 2003-2016 Dynare Team
+% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -723,23 +723,13 @@ options_.discretionary_tol = 1e-7;
options_.parameter_set = [];
options_.use_shock_groups = '';
options_.colormap = '';
-options_.shock_decomp.detail_plot=0;
-options_.shock_decomp.fig_names='';
options_.shock_decomp.init_state = 0;
-options_.shock_decomp.interactive = 0;
-options_.shock_decomp.plot_end_date=[];
-options_.shock_decomp.plot_init_date=[];
-options_.shock_decomp.screen_shocks=0;
-options_.shock_decomp.steadystate=0;
-options_.shock_decomp.type = '';
-options_.shock_decomp.write_xls=0;
-% Shock decomposition realtime
-options_.shock_decomp.realtime=0; % 0 is standard; 1 is realtime (pool/vintage); 2 is conditional (pool/vintage); 3 is forecast (pool/vintage)
-options_.shock_decomp.vintage=0; % 0 pool realtime/conditional; int: forecast/conditional shock decompositions
-options_.shock_decomp.forecast=0;
-options_.shock_decomp.presample=NaN;
-options_.shock_decomp.save_realtime=0; % saves memory
+% Shock decomposition realtime
+options_.shock_decomp.forecast = 0;
+options_.shock_decomp.presample = NaN;
+options_.shock_decomp.save_realtime = 0; % saves memory
+options_ = set_default_plot_shock_decomposition_options(options_);
% Nonlinearfilters
options_.nonlinear_filter = [];
diff --git a/matlab/graph_decomp.m b/matlab/graph_decomp.m
index 7740a07a9..6fae28f3b 100644
--- a/matlab/graph_decomp.m
+++ b/matlab/graph_decomp.m
@@ -11,7 +11,7 @@ function []=graph_decomp(z,shock_names,endo_names,i_var,initial_date,DynareModel
% DynareModel [structure] Dynare model structure
% DynareOptions [structure] Dynare options structure
-% Copyright (C) 2010-2016 Dynare Team
+% Copyright (C) 2010-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -29,7 +29,7 @@ function []=graph_decomp(z,shock_names,endo_names,i_var,initial_date,DynareModel
% along with Dynare. If not, see .
GraphDirectoryName = CheckPath('graphs',DynareModel.dname);
-new_colormap = DynareOptions.colormap;
+new_colormap = DynareOptions.plot_shock_decomp.colormap;
% number of components equals number of shocks + 1 (initial conditions)
comp_nbr = size(z,2)-1;
@@ -37,9 +37,9 @@ comp_nbr = size(z,2)-1;
SteadyState=[];
fig_mode='';
fig_mode1='';
-% fig_names='';
+% fig_name='';
% screen_shocks=0;
-opts_decomp = DynareOptions.shock_decomp;
+opts_decomp = DynareOptions.plot_shock_decomp;
if isfield(opts_decomp,'steady_state')
SteadyState = opts_decomp.steady_state;
end
@@ -48,9 +48,9 @@ if ~isempty(opts_decomp.type)
fig_mode1 = ['_' fig_mode];
fig_mode = [fig_mode '_'];
end
-fig_names_long = opts_decomp.fig_names;
+fig_name_long = opts_decomp.fig_name;
-use_shock_groups = DynareOptions.use_shock_groups;
+use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
screen_shocks = opts_decomp.screen_shocks;
if use_shock_groups | comp_nbr<=18,
screen_shocks=0;
@@ -60,16 +60,16 @@ if use_shock_groups
shock_ind = fieldnames(shock_groups);
end
if screen_shocks
- fig_names_long = [fig_names_long ' SCREEN'];
+ fig_name_long = [fig_name_long ' SCREEN'];
end
-fig_names=strrep(fig_names_long, '(given ', '');
-fig_names=strrep(fig_names, '(vintage ', '');
-fig_names=regexprep(fig_names, ' ', '_');
-fig_names=strrep(fig_names, '.', '');
-fig_names=strrep(fig_names, '-', '');
-fig_names=strrep(fig_names, ')', '');
-fig_names=strrep(fig_names, '(', '');
+fig_name=strrep(fig_name_long, '(given ', '');
+fig_name=strrep(fig_name, '(vintage ', '');
+fig_name=regexprep(fig_name, ' ', '_');
+fig_name=strrep(fig_name, '.', '');
+fig_name=strrep(fig_name, '-', '');
+fig_name=strrep(fig_name, ')', '');
+fig_name=strrep(fig_name, '(', '');
interactive = opts_decomp.interactive;
@@ -87,8 +87,8 @@ end
nvar = length(i_var);
%% write LaTeX-Header
-if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
- fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_names '.tex'],'w');
+if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
+ fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_name '.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare''s graph_decomp.m.\n');
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
fprintf(fidTeX,' \n');
@@ -128,7 +128,7 @@ for j=1:nvar
if ymax-ymin < 1e-6
continue
end
- fhandle = dyn_figure(DynareOptions,'Name',[preamble_txt fig_names_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) '.'], 'PaperPositionMode', 'auto','PaperOrientation','landscape','renderermode','auto');
+ fhandle = dyn_figure(DynareOptions.plot_shock_decomp.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) '.'], 'PaperPositionMode', 'auto','PaperOrientation','landscape','renderermode','auto');
set(fhandle,'position' ,[50 50 1500 750])
ax=axes('Position',[0.1 0.1 0.6 0.8],'box','on');
% plot(ax,x(2:end),z1(end,:),'k-','LineWidth',2)
@@ -190,15 +190,15 @@ for j=1:nvar
ht = text(0.3,y1+0.3*height,labels(i,:),'Interpreter','none');
hold on
if interactive & (~isoctave & use_shock_groups)
- mydata.fig_names = DynareOptions.shock_decomp.fig_names(2:end);
- mydata.use_shock_groups = DynareOptions.use_shock_groups;
+ mydata.fig_name = DynareOptions.plot_shock_decomp.fig_name(2:end);
+ mydata.use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
mydata.shock_group = shock_groups.(shock_ind{i});
- mydata.shock_decomp = DynareOptions.shock_decomp;
+ mydata.shock_decomp = DynareOptions.plot_shock_decomp;
if ~isempty(mydata.shock_group.shocks{1})
c = uicontextmenu;
hl.UIContextMenu=c;
browse_menu = uimenu(c,'Label','Browse group');
- expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.use_shock_groups ''',''' deblank(endo_names(i_var(j),:)) ''',' int2str(i) ')']);
+ expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.use_shock_groups ''',''' deblank(mydata.shock_decomp.orig_varlist(j,:)) ''',' int2str(i) ')']);
set(expand_menu,'UserData',mydata,'Tag',['group' int2str(i)]);
for jmember = mydata.shock_group.shocks
uimenu('parent',browse_menu,'Label',char(jmember))
@@ -213,20 +213,20 @@ for j=1:nvar
colormap(new_colormap)
end
hold off
- dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_names],DynareOptions);
- if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+ dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
+ if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
fprintf(fidTeX,'\\centering \n');
- fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_names]);
- fprintf(fidTeX,'\\label{Fig:shock_decomp:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_names]);
- fprintf(fidTeX,['\\caption{' preamble_txt fig_names_long strrep(fig_mode1, '_', ' ') ': $ %s $.}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
+ fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_name]);
+ fprintf(fidTeX,'\\label{Fig:shock_decomp:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_name]);
+ fprintf(fidTeX,['\\caption{' preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': $ %s $.}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
fprintf(fidTeX,'\\end{figure}\n');
fprintf(fidTeX,' \n');
end
end
%% write LaTeX-Footer
-if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
fprintf(fidTeX,' \n');
fprintf(fidTeX,'%% End of TeX file.\n');
fclose(fidTeX);
diff --git a/matlab/graph_decomp_detail.m b/matlab/graph_decomp_detail.m
index 931cb64a2..077653ea6 100644
--- a/matlab/graph_decomp_detail.m
+++ b/matlab/graph_decomp_detail.m
@@ -1,4 +1,4 @@
-function []=graph_decomp_detail(z,shock_names,endo_names,i_var,initial_date,DynareModel,DynareOptions,opts_decomp)
+function []=graph_decomp_detail(z,shock_names,endo_names,i_var,initial_date,DynareModel,DynareOptions)
%function []=graph_decomp_detail(z,shock_names,endo_names,i_var,initial_date,DynareModel,DynareOptions)
% Plots the results from the shock_decomposition command
%
@@ -11,7 +11,7 @@ function []=graph_decomp_detail(z,shock_names,endo_names,i_var,initial_date,Dyna
% DynareModel [structure] Dynare model structure
% DynareOptions [structure] Dynare options structure
-% Copyright (C) 2010-2016 Dynare Team
+% Copyright (C) 2010-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -32,9 +32,9 @@ GraphDirectoryName = CheckPath('graphs',DynareModel.dname);
% interactive = 0;
fig_mode='';
fig_mode1='';
-% fig_names='';
+% fig_name='';
% screen_shocks=0;
-use_shock_groups = DynareOptions.use_shock_groups;
+use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
if use_shock_groups
shock_groups = DynareModel.shock_groups.(use_shock_groups);
shock_ind = fieldnames(shock_groups);
@@ -43,7 +43,7 @@ end
% number of components equals number of shocks + 1 (initial conditions)
comp_nbr = size(z,2)-1;
-opts_decomp = DynareOptions.shock_decomp;
+opts_decomp = DynareOptions.plot_shock_decomp;
interactive = opts_decomp.interactive;
if ~isempty(opts_decomp.type)
@@ -52,26 +52,26 @@ if ~isempty(opts_decomp.type)
fig_mode = [fig_mode '_'];
end
screen_shocks = opts_decomp.screen_shocks;
-if DynareOptions.use_shock_groups | comp_nbr<=18,
+if DynareOptions.plot_shock_decomp.use_shock_groups | comp_nbr<=18,
screen_shocks=0;
end
-fig_names_long = opts_decomp.fig_names;
-% fig_names = ['_' fig_names];
+fig_name_long = opts_decomp.fig_name;
+% fig_name = ['_' fig_name];
if screen_shocks
-% fig_names1 = [fig_names1 '_screen'];
- fig_names_long = [fig_names_long ' SCREEN'];
+% fig_name1 = [fig_name1 '_screen'];
+ fig_name_long = [fig_name_long ' SCREEN'];
end
-fig_names=strrep(fig_names_long, '(given ', '');
-fig_names=strrep(fig_names, '(vintage ', '');
-fig_names=regexprep(fig_names, ' ', '_');
-fig_names=strrep(fig_names, '.', '');
-fig_names=strrep(fig_names, '-', '');
-fig_names=strrep(fig_names, ')', '');
-fig_names=strrep(fig_names, '(', '');
-% fig_names1 = [fig_names];
-% fig_names = [fig_names '_'];
+fig_name=strrep(fig_name_long, '(given ', '');
+fig_name=strrep(fig_name, '(vintage ', '');
+fig_name=regexprep(fig_name, ' ', '_');
+fig_name=strrep(fig_name, '.', '');
+fig_name=strrep(fig_name, '-', '');
+fig_name=strrep(fig_name, ')', '');
+fig_name=strrep(fig_name, '(', '');
+% fig_name1 = [fig_name];
+% fig_name = [fig_name '_'];
gend = size(z,3);
if isempty(initial_date)
@@ -105,8 +105,8 @@ end
nvar = length(i_var);
%% write LaTeX-Header
-if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
- fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_names '_detail.tex'],'w');
+if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
+ fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_name '_detail.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare''s graph_decomp_detail.m.\n');
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
fprintf(fidTeX,' \n');
@@ -151,7 +151,7 @@ for j=1:nvar
continue
end
for jf = 1:nfigs
- fhandle = dyn_figure(DynareOptions,'Name',[preamble_txt fig_names_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) ' (detail).'],'position',[200 100 650 850], 'PaperPositionMode', 'auto','PaperOrientation','portrait','renderermode','auto');
+ fhandle = dyn_figure(DynareOptions.plot_shock_decomp.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) ' (detail).'],'position',[200 100 650 850], 'PaperPositionMode', 'auto','PaperOrientation','portrait','renderermode','auto');
a0=zeros(1,4);
a0(3)=inf;
a0(4)=-inf;
@@ -179,15 +179,15 @@ for j=1:nvar
set(gca,'ylim',a0(3:4))
hold on, h1=plot(x(2:end),z1(end,:),'k-','LineWidth',2);
if interactive & (~isoctave & use_shock_groups)
- mydata.fig_names = DynareOptions.shock_decomp.fig_names(2:end);
- mydata.use_shock_groups = DynareOptions.use_shock_groups;
+ mydata.fig_name = DynareOptions.plot_shock_decomp.fig_name(2:end);
+ mydata.use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
mydata.shock_group = shock_groups.(shock_ind{ic});
- mydata.shock_decomp = DynareOptions.shock_decomp;
+ mydata.shock_decomp = DynareOptions.plot_shock_decomp;
if ~isempty(mydata.shock_group.shocks{1})
c = uicontextmenu;
hax.UIContextMenu=c;
browse_menu = uimenu(c,'Label','Browse group');
- expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.use_shock_groups ''',''' deblank(endo_names(i_var(j),:)) ''',' int2str(ic) ')']);
+ expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.use_shock_groups ''',''' deblank(mydata.shock_decomp.orig_varlist(j,:)) ''',' int2str(ic) ')']);
set(expand_menu,'UserData',mydata,'Tag',['group' int2str(ic)]);
for jmember = mydata.shock_group.shocks
uimenu('parent',browse_menu,'Label',char(jmember))
@@ -224,13 +224,13 @@ for j=1:nvar
else
suffix = ['_detail'];
end
- dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_names suffix],DynareOptions);
- if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+ dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name suffix],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
+ if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
fprintf(fidTeX,'\\centering \n');
- fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_names suffix]);
- fprintf(fidTeX,'\\label{Fig:shock_decomp_detail:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_names suffix]);
- fprintf(fidTeX,['\\caption{' preamble_txt fig_names_long strrep(fig_mode1, '_', ' ') ': $ %s $ (detail).}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
+ fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_name suffix]);
+ fprintf(fidTeX,'\\label{Fig:shock_decomp_detail:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_name suffix]);
+ fprintf(fidTeX,['\\caption{' preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': $ %s $ (detail).}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
fprintf(fidTeX,'\\end{figure}\n');
fprintf(fidTeX,' \n');
end
@@ -238,7 +238,7 @@ for j=1:nvar
end
%% write LaTeX-Footer
-if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
fprintf(fidTeX,' \n');
fprintf(fidTeX,'%% End of TeX file.\n');
fclose(fidTeX);
diff --git a/matlab/gsa/filt_mc_.m b/matlab/gsa/filt_mc_.m
index 06f717e0e..b6c4994d8 100644
--- a/matlab/gsa/filt_mc_.m
+++ b/matlab/gsa/filt_mc_.m
@@ -14,7 +14,7 @@ function [rmse_MC, ixx] = filt_mc_(OutDir,options_gsa_,dataset_,dataset_info)
% marco.ratto@ec.europa.eu
% Copyright (C) 2012-2016 European Commission
-% Copyright (C) 2012-2016 Dynare Team
+% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -407,7 +407,7 @@ else
end
if mod(i,9)==1,
ifig=ifig+1;
- hh=dyn_figure(options_,'name',[temp_name,' ',int2str(ifig)]);
+ hh=dyn_figure(options_.nodisplay,'name',[temp_name,' ',int2str(ifig)]);
end
subplot(3,3,i-9*(ifig-1))
h=cumplot(lnprior(ixx(1:nfilt0(i),i)));
@@ -423,18 +423,18 @@ else
annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-prior for WORSE R2', 'Color','Red','horizontalalignment','center');
end
if options_.opt_gsa.ppost
- dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnprior',int2str(ifig)],options_);
+ dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnprior',int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir '/' fname_ '_rmse_post_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_post_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1))
end
else
if options_.opt_gsa.pprior
- dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnprior',int2str(ifig) ],options_);
+ dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir '/' fname_ '_rmse_prior_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_prior_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1))
end
else
- dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnprior',int2str(ifig) ],options_);
+ dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnprior',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir '/' fname_ '_rmse_mc_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_mc_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1))
end
@@ -455,7 +455,7 @@ else
end
if mod(i,9)==1,
ifig=ifig+1;
- hh = dyn_figure(options_,'Name',[temp_name,' ',int2str(ifig)]);
+ hh = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
end
subplot(3,3,i-9*(ifig-1))
h=cumplot(likelihood(ixx(1:nfilt0(i),i)));
@@ -474,18 +474,18 @@ else
annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-likelihood for WORSE R2', 'Color','Red','horizontalalignment','center');
end
if options_.opt_gsa.ppost
- dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnlik',int2str(ifig) ],options_);
+ dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_post_lnprior',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_post_lnprior',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
else
if options_.opt_gsa.pprior
- dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnlik',int2str(ifig)],options_);
+ dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnlik',int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_lnlik',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_prior_lnlik',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
else
- dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnlik',int2str(ifig) ],options_);
+ dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnlik',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_lnlik',int2str(ifig) ],ifig,[temp_name,' ',int2str(ifig)],'rmse_mc_lnlik',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
@@ -506,7 +506,7 @@ else
end
if mod(i,9)==1,
ifig=ifig+1;
- hh = dyn_figure(options_,'Name',[temp_name,' ',int2str(ifig)]);
+ hh = dyn_figure(options_.nodisplay,'Name',[temp_name,' ',int2str(ifig)]);
end
subplot(3,3,i-9*(ifig-1))
h=cumplot(logpo2(ixx(1:nfilt0(i),i)));
@@ -525,18 +525,18 @@ else
annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-posterior for WORSE R2', 'Color','Red','horizontalalignment','center');
end
if options_.opt_gsa.ppost
- dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnpost',int2str(ifig) ],options_);
+ dyn_saveas(hh,[OutDir filesep fname_ '_rmse_post_lnpost',int2str(ifig) ],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_post_lnpost',int2str(ifig) ],ifig,[temp_name,' ',int2str(ifig)],'rmse_post_lnpost',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
else
if options_.opt_gsa.pprior
- dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnpost',int2str(ifig)],options_);
+ dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_lnpost',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_prior_lnpost',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
else
- dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnpost',int2str(ifig)],options_);
+ dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_lnpost',int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_lnpost',int2str(ifig)],ifig,[temp_name,' ',int2str(ifig)],'rmse_mc_lnpost',options_.figures.textwidth*min((i-9*(ifig-1))/3,1));
end
@@ -794,7 +794,7 @@ else
for iy=1:size(vvarvecm,1),
ipar = find(any(squeeze(PPV(iy,:,:))nbr_irf_couples,
@@ -325,7 +325,7 @@ if ~isempty(indx_irf),
end
end
if ~DynareOptions.nograph,
- dyn_saveas(h1,[OutputDirectoryName,filesep,fname_,'_',type,'_irf_restrictions'],DynareOptions);
+ dyn_saveas(h1,[OutputDirectoryName,filesep,fname_,'_',type,'_irf_restrictions'],DynareOptions.nodisplay,DynareOptions.graph_format);
create_TeX_loader(DynareOptions,[OutputDirectoryName,filesep,fname_,'_',type,'_irf_restrictions'],[type ' evaluation of irf restrictions'],'irf_restrictions',type,DynareOptions.figures.textwidth*min(ij/ncol,1))
end
skipline()
@@ -405,7 +405,7 @@ if ~isempty(indx_moment)
indx_moment = indx_moment(irestrictions,:);
if ~DynareOptions.nograph,
- h2=dyn_figure(DynareOptions,'name',[type ' evaluation of moment restrictions']);
+ h2=dyn_figure(DynareOptions.nodisplay,'name',[type ' evaluation of moment restrictions']);
nrow=ceil(sqrt(nbr_moment_couples));
ncol=nrow;
if nrow*(nrow-1)>nbr_moment_couples,
@@ -535,7 +535,7 @@ if ~isempty(indx_moment)
end
end
if ~DynareOptions.nograph,
- dyn_saveas(h2,[OutputDirectoryName,filesep,fname_,'_',type,'_moment_restrictions'],DynareOptions);
+ dyn_saveas(h2,[OutputDirectoryName,filesep,fname_,'_',type,'_moment_restrictions'],DynareOptions.nodisplay,DynareOptions.graph_format);
create_TeX_loader(DynareOptions,[OutputDirectoryName,filesep,fname_,'_',type,'_moment_restrictions'],[type ' evaluation of moment restrictions'],'moment_restrictions',type,DynareOptions.figures.textwidth*min(ij/ncol,1))
end
diff --git a/matlab/gsa/map_ident_.m b/matlab/gsa/map_ident_.m
index 7dc3873db..94e69f7fd 100644
--- a/matlab/gsa/map_ident_.m
+++ b/matlab/gsa/map_ident_.m
@@ -5,7 +5,7 @@ function map_ident_(OutputDirectoryName,opt_gsa)
% marco.ratto@ec.europa.eu
% Copyright (C) 2012-2016 European Commission
-% Copyright (C) 2012-2016 Dynare Team
+% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -90,7 +90,7 @@ if opt_gsa.load_ident_files==0,
ifig=0;
for j=1:M_.exo_nbr,
if mod(j,6)==1
- hh=dyn_figure(options_,'name',['Variance decomposition shocks']);
+ hh=dyn_figure(options_.nodisplay,'name',['Variance decomposition shocks']);
ifig=ifig+1;
iplo=0;
end
@@ -108,7 +108,7 @@ if opt_gsa.load_ident_files==0,
ylabel(' ')
title(M_.exo_names(j,:),'interpreter','none')
if mod(j,6)==0 | j==M_.exo_nbr,
- dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],options_);
+ dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],ifig,['Variance decomposition shocks'],'vdec_exo',options_.figures.textwidth*min(iplo/3,1))
end
end
@@ -219,7 +219,7 @@ if opt_gsa.morris==1,
load([OutputDirectoryName,'/',fname_,'_morris_IDE'],'SAvdec','vdec','ir_vdec','ic_vdec')
end
- hh = dyn_figure(options_,'name','Screening identification: variance decomposition');
+ hh = dyn_figure(options_.nodisplay,'name','Screening identification: variance decomposition');
% boxplot(SAvdec,'whis',10,'symbol','r.')
myboxplot(SAvdec,[],'.',[],10)
set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -232,7 +232,7 @@ if opt_gsa.morris==1,
end
xlabel(' ')
title('Elementary effects variance decomposition')
- dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morris_vdec'],options_);
+ dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morris_vdec'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_morris_vdec'],1,'Screening identification: variance decomposition','morris_vdec',1)
else
save([OutputDirectoryName,'/',fname_,'_morris_IDE.mat'],'vdec')
@@ -325,7 +325,7 @@ if opt_gsa.morris==1,
load([OutputDirectoryName,'/',fname_,'_morris_IDE'],'ac','ir_ac','ic_ac')
end
- hh=dyn_figure(options_,'name','Screening identification: theoretical moments');
+ hh=dyn_figure(options_.nodisplay,'name','Screening identification: theoretical moments');
% boxplot(SAcc,'whis',10,'symbol','r.')
myboxplot(SAcc,[],'.',[],10)
set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -338,7 +338,7 @@ if opt_gsa.morris==1,
end
xlabel(' ')
title('Elementary effects in the moments')
- dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morris_moments'],options_);
+ dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morris_moments'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_morris_moments'],1,'Screening identification: theoretical moments','morris_moments',1)
% close(gcf),
@@ -722,7 +722,7 @@ if opt_gsa.morris==1,
else
load([OutputDirectoryName,'/',fname_,'_morris_IDE'],'SAnorm','SAmunorm','SAsignorm')
end
- hh=dyn_figure(options_,'name','Screening identification: model'); %bar(SAnorm(:,irel))
+ hh=dyn_figure(options_.nodisplay,'name','Screening identification: model'); %bar(SAnorm(:,irel))
% boxplot(SAnorm','whis',10,'symbol','r.')
myboxplot(SAnorm',[],'.',[],10)
set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -736,10 +736,10 @@ if opt_gsa.morris==1,
end
xlabel(' ')
title('Elementary effects in the model')
- dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morris_par'],options_);
+ dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morris_par'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_morris_par'],1,'Screening identification: model','morris_par',1)
-% hh=dyn_figure(options_); %bar(SAmunorm(:,irel))
+% hh=dyn_figure(options_.nodisplay); %bar(SAmunorm(:,irel))
% % boxplot(SAmunorm','whis',10,'symbol','r.')
% myboxplot(SAmunorm',[],'.',[],10)
% set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -752,9 +752,9 @@ if opt_gsa.morris==1,
% end
% xlabel(' ')
% title('\mu in the model')
-% dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morrismu_par'],options_);
+% dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morrismu_par'],options_.nodisplay,options_.graph_format);
%
-% hh=dyn_figure(options_); %bar(SAsignorm(:,irel))
+% hh=dyn_figure(options_.nodisplay); %bar(SAsignorm(:,irel))
% % boxplot(SAsignorm','whis',10,'symbol','r.')
% myboxplot(SAsignorm',[],'.',[],10)
% set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
@@ -767,7 +767,7 @@ if opt_gsa.morris==1,
% end
% xlabel(' ')
% title('\sigma in the model')
-% dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morrissig_par'],options_);
+% dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_morrissig_par'],options_.nodisplay,options_.graph_format);
% figure, bar(SAnorm(:,irel)')
% set(gca,'xtick',[1:j0])
@@ -1522,7 +1522,7 @@ else, % main effects analysis
% SAmeanexo=mean(SAmomN(:,1:nshock));
% figure, bar(latent'*SAcc),
- hh=dyn_figure(options_,'Name',['Identifiability indices in the ',fsuffix,' moments.']);
+ hh=dyn_figure(options_.nodisplay,'Name',['Identifiability indices in the ',fsuffix,' moments.']);
bar(sum(SAcc)),
set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:npT])
set(gca,'xlim',[0.5 npT+0.5])
@@ -1535,7 +1535,7 @@ else, % main effects analysis
end
xlabel(' ')
title(['Identifiability indices in the ',fsuffix,' moments.'],'interpreter','none')
- dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_ident_ALL',fsuffix],options_);
+ dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_ident_ALL',fsuffix],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_ident_ALL',fsuffix],1,['Identifiability indices in the ',fsuffix,' moments.'],['ident_ALL',fsuffix]',1)
% figure, bar(SAmeanexo),
diff --git a/matlab/gsa/redform_map.m b/matlab/gsa/redform_map.m
index 4b1ceeb55..c7b257325 100644
--- a/matlab/gsa/redform_map.m
+++ b/matlab/gsa/redform_map.m
@@ -16,7 +16,7 @@ function redform_map(dirname,options_gsa_)
% marco.ratto@ec.europa.eu
% Copyright (C) 2012-2016 European Commission
-% Copyright (C) 2012-2016 Dynare Team
+% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -165,7 +165,7 @@ for j=1:size(anamendo,1)
if (max(y0)-min(y0))>1.e-10,
if mod(iplo,9)==0 && isempty(threshold) && ~options_.nograph,
ifig=ifig+1;
- hfig = dyn_figure(options_,'name',['Reduced Form Mapping: ', namendo,' vs shocks ',int2str(ifig)]);
+ hfig = dyn_figure(options_.nodisplay,'name',['Reduced Form Mapping: ', namendo,' vs shocks ',int2str(ifig)]);
iplo=0;
end
iplo=iplo+1;
@@ -193,7 +193,7 @@ for j=1:size(anamendo,1)
mkdir(xdir)
end
if ~options_.nograph,
- hf=dyn_figure(options_,'name',['Reduced Form Mapping (Monte Carlo Filtering): ',namendo,' vs ', namexo]);
+ hf=dyn_figure(options_.nodisplay,'name',['Reduced Form Mapping (Monte Carlo Filtering): ',namendo,' vs ', namexo]);
hc = cumplot(y0);
a=axis; delete(hc);
% hist(mat_moment{ij}),
@@ -206,7 +206,7 @@ for j=1:size(anamendo,1)
set(hc,'color','k','linewidth',2)
hold off,
title([namendo,' vs ', namexo ' - threshold [' num2str(threshold(1)) ' ' num2str(threshold(2)) ']'],'interpreter','none')
- dyn_saveas(hf,[xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namexo],options_);
+ dyn_saveas(hf,[xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namexo],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namexo],['Reduced Form Mapping (Monte Carlo Filtering): ',strrep(namendo,'_','\_'),' vs ', strrep(namexo,'_','\_')],[type '_' namendo,'_vs_', namexo])
end
si(:,js) = NaN(np,1);
@@ -275,7 +275,7 @@ for j=1:size(anamendo,1)
end
title([logflag,' ',namendo,' vs ',namexo],'interpreter','none')
if iplo==9
- dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_);
+ dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],[logflag,' ',strrep(namendo,'_','\_'),' vs ',strrep(namexo,'_','\_')],['redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],1)
end
end
@@ -284,7 +284,7 @@ for j=1:size(anamendo,1)
end
end
if iplo<9 && iplo>0 && ifig && ~options_.nograph,
- dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_);
+ dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],[logflag,' ',strrep(namendo,'_','\_'),' vs ',strrep(namexo,'_','\_')],['redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_.figures.textwidth*min(iplo/3,1))
end
ifig=0;
@@ -301,7 +301,7 @@ for j=1:size(anamendo,1)
if (max(y0)-min(y0))>1.e-10,
if mod(iplo,9)==0 && isempty(threshold) && ~options_.nograph,
ifig=ifig+1;
- hfig = dyn_figure(options_,'name',['Reduced Form Mapping: ' namendo,' vs lags ',int2str(ifig)]);
+ hfig = dyn_figure(options_.nodisplay,'name',['Reduced Form Mapping: ' namendo,' vs lags ',int2str(ifig)]);
iplo=0;
end
iplo=iplo+1;
@@ -329,7 +329,7 @@ for j=1:size(anamendo,1)
mkdir(xdir)
end
if ~options_.nograph,
- hf=dyn_figure(options_,'name',['Reduced Form Mapping (Monte Carlo Filtering): ',namendo,' vs lagged ', namlagendo]);
+ hf=dyn_figure(options_.nodisplay,'name',['Reduced Form Mapping (Monte Carlo Filtering): ',namendo,' vs lagged ', namlagendo]);
hc = cumplot(y0);
a=axis; delete(hc);
% hist(mat_moment{ij}),
@@ -342,7 +342,7 @@ for j=1:size(anamendo,1)
set(hc,'color','k','linewidth',2)
hold off,
title([namendo,' vs lagged ', namlagendo ' - threshold [' num2str(threshold(1)) ' ' num2str(threshold(2)) ']'],'interpreter','none')
- dyn_saveas(hf,[xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namlagendo],options_);
+ dyn_saveas(hf,[xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namlagendo],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namlagendo],['Reduced Form Mapping (Monte Carlo Filtering): ',strrep(namendo,'_','\_'),' vs lagged ', strrep(namlagendo,'_','\_')],[type '_' namendo,'_vs_', namlagendo],1)
end
@@ -412,7 +412,7 @@ for j=1:size(anamendo,1)
end
title([logflag,' ',namendo,' vs ',namlagendo,'(-1)'],'interpreter','none')
if iplo==9,
- dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],options_);
+ dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],[logflag,' ',strrep(namendo,'_','\_'),' vs ',strrep(namlagendo,'_','\_'),'(-1)'],['redform_', namendo,'_vs_lags_',logflag,':',num2str(ifig)],1)
end
end
@@ -421,14 +421,14 @@ for j=1:size(anamendo,1)
end
end
if iplo<9 && iplo>0 && ifig && ~options_.nograph,
- dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],options_);
+ dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],[logflag,' ',strrep(namendo,'_','\_'),' vs ',strrep(namlagendo,'_','\_'),'(-1)'],['redform_', namendo,'_vs_lags_',logflag,':',num2str(ifig)],options_.figures.textwidth*min(iplo/3,1));
end
end
if isempty(threshold) && ~options_.nograph,
if ilog==0,
- hfig=dyn_figure(options_,'name','Reduced Form GSA'); %bar(si)
+ hfig=dyn_figure(options_.nodisplay,'name','Reduced Form GSA'); %bar(si)
% boxplot(si','whis',10,'symbol','r.')
myboxplot(si',[],'.',[],10)
xlabel(' ')
@@ -440,11 +440,11 @@ if isempty(threshold) && ~options_.nograph,
text(ip,-0.02,deblank(pnames(ip,:)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
end
title('Reduced form GSA')
- dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_gsa'],options_);
+ dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_gsa'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_gsa'],'Reduced Form GSA','redform_gsa')
else
- hfig=dyn_figure(options_,'name','Reduced Form GSA'); %bar(silog)
+ hfig=dyn_figure(options_.nodisplay,'name','Reduced Form GSA'); %bar(silog)
% boxplot(silog','whis',10,'symbol','r.')
myboxplot(silog',[],'.',[],10)
set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:np])
@@ -456,7 +456,7 @@ if isempty(threshold) && ~options_.nograph,
text(ip,-0.02,deblank(pnames(ip,:)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
end
title('Reduced form GSA - Log-transformed elements')
- dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_gsa_log'],options_);
+ dyn_saveas(hfig,[dirname,filesep,M_.fname,'_redform_gsa_log'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,filesep,M_.fname,'_redform_gsa_log'],'Reduced form GSA - Log-transformed elements','redform_gsa_log')
end
@@ -522,7 +522,7 @@ if iload==0,
y1 = log(y0*isig+lam);
end
if ~options_.nograph,
- hfig=dyn_figure(options_,'name',options_map.figtitle);
+ hfig=dyn_figure(options_.nodisplay,'name',options_map.figtitle);
subplot(221)
if ilog,
hist(y1,30),
@@ -634,7 +634,7 @@ end
plot(yn,[yf yn],'.'),
title(['Out-of-sample prediction - R2=' num2str(r2,2)],'interpreter','none')
end
- dyn_saveas(hfig,fname,options_);
+ dyn_saveas(hfig,fname,options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,fname,['Out-of-sample prediction - R2=' num2str(r2,2)],'redform_gsa_log')
if options_.nodisplay
@@ -647,10 +647,10 @@ else
load([fname,'_map.mat'],'gsa_')
if ~options_.nograph,
yf = ss_anova_fcast(x0, gsa_);
- hfig=dyn_figure(options_,'name',options_map.title);
+ hfig=dyn_figure(options_.nodisplay,'name',options_map.title);
plot(y0,[yf y0],'.'),
title([namy,' vs ', namx,' pred'],'interpreter','none')
- dyn_saveas(hfig,[fname '_pred'],options_);
+ dyn_saveas(hfig,[fname '_pred'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[fname '_pred'],options_map.title,[namy,' vs ', namx,' pred'])
end
@@ -724,7 +724,7 @@ return
function indmcf = redform_mcf(y0, x0, options_mcf, options_)
-hfig=dyn_figure(options_,'name',options_mcf.amcf_title);
+hfig=dyn_figure(options_.nodisplay,'name',options_mcf.amcf_title);
[post_mean, post_median, post_var, hpd_interval, post_deciles, ...
density] = posterior_moments(y0,1,0.9);
@@ -770,7 +770,7 @@ if ~isoctave
'horizontalalignment','center');
end
-dyn_saveas(hfig,[options_mcf.OutputDirectoryName filesep options_mcf.fname_,'_',options_mcf.amcf_name],options_);
+dyn_saveas(hfig,[options_mcf.OutputDirectoryName filesep options_mcf.fname_,'_',options_mcf.amcf_name],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[options_mcf.OutputDirectoryName filesep options_mcf.fname_,'_',options_mcf.amcf_name],strrep(options_mcf.amcf_title,'_','\_'),[options_mcf.fname_,'_',options_mcf.amcf_name])
return
diff --git a/matlab/gsa/redform_screen.m b/matlab/gsa/redform_screen.m
index ae1d8df74..311c6b520 100644
--- a/matlab/gsa/redform_screen.m
+++ b/matlab/gsa/redform_screen.m
@@ -11,7 +11,7 @@ function redform_screen(dirname, options_gsa_)
% marco.ratto@ec.europa.eu
% Copyright (C) 2012-2016 European Commission
-% Copyright (C) 2012-2016 Dynare Team
+% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -68,7 +68,7 @@ for j=1:size(anamendo,1),
if ~isempty(y0),
if mod(iplo,9)==0,
ifig=ifig+1;
- hh=dyn_figure(options_,'name',[namendo,' vs. shocks ',int2str(ifig)]);
+ hh=dyn_figure(options_.nodisplay,'name',[namendo,' vs. shocks ',int2str(ifig)]);
iplo=0;
end
iplo=iplo+1;
@@ -87,7 +87,7 @@ for j=1:size(anamendo,1),
end
title([namendo,' vs. ',namexo],'interpreter','none')
if iplo==9,
- dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_shock_',num2str(ifig)],options_);
+ dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_shock_',num2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,'/',M_.fname,'_', namendo,'_vs_shock_',num2str(ifig)],ifig,[namendo,' vs. shocks ',int2str(ifig)],[namendo,'_vs_shock'],1)
end
@@ -95,7 +95,7 @@ for j=1:size(anamendo,1),
end
end
if iplo<9 && iplo>0 && ifig,
- dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_shocks_',num2str(ifig)],options_);
+ dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_shocks_',num2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,'/',M_.fname,'_', namendo,'_vs_shock_',num2str(ifig)],ifig,[namendo,' vs. shocks ',int2str(ifig)],[namendo,'_vs_shock'],options_.figures.textwidth*min(iplo/3))
end
@@ -110,7 +110,7 @@ for j=1:size(anamendo,1),
if ~isempty(y0),
if mod(iplo,9)==0,
ifig=ifig+1;
- hh=dyn_figure(options_,'name',[namendo,' vs. lagged endogenous ',int2str(ifig)]);
+ hh=dyn_figure(options_.nodisplay,'name',[namendo,' vs. lagged endogenous ',int2str(ifig)]);
iplo=0;
end
iplo=iplo+1;
@@ -130,19 +130,19 @@ for j=1:size(anamendo,1),
title([namendo,' vs. ',namlagendo,'(-1)'],'interpreter','none')
if iplo==9,
- dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_);
+ dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],ifig,[namendo,' vs. lagged endogenous ',int2str(ifig)],[namendo,'_vs_lags'],1)
end
end
end
end
if iplo<9 && iplo>0 && ifig,
- dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_);
+ dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],ifig,[namendo,' vs. lagged endogenous ',int2str(ifig)],[namendo,'_vs_lags'],options_.figures.textwidth*min(iplo/3))
end
end
-hh=dyn_figure(options_,'Name','Reduced form screening');
+hh=dyn_figure(options_.nodisplay,'Name','Reduced form screening');
%bar(SA)
% boxplot(SA','whis',10,'symbol','r.')
myboxplot(SA',[],'.',[],10)
@@ -156,7 +156,7 @@ end
xlabel(' ')
ylabel('Elementary Effects')
title('Reduced form screening')
-dyn_saveas(hh,[dirname,'/',M_.fname,'_redform_screen'],options_);
+dyn_saveas(hh,[dirname,'/',M_.fname,'_redform_screen'],options_.nodisplay,options_.graph_format);
create_TeX_loader(options_,[dirname,'/',M_.fname,'_redform_screen'],1,'Reduced form screening','redform_screen',1)
diff --git a/matlab/gsa/scatter_callback.m b/matlab/gsa/scatter_callback.m
index 8260cdf65..84b7d9ec0 100644
--- a/matlab/gsa/scatter_callback.m
+++ b/matlab/gsa/scatter_callback.m
@@ -23,7 +23,7 @@ function scatter_callback(K, type)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-global oo_ M_
+global oo_ M_ options_ bayestopt_ estim_params_
x=get(gcf,'userdata');
r2=x{1};
@@ -37,6 +37,6 @@ switch type
case 'eval'
disp('Evaluating smoother ...')
- oo_=evaluate_smoother(xparam1,M_.endo_names);
+ [oo_, M_]=evaluate_smoother(xparam1,M_.endo_names,M_,oo_,options_,bayestopt_,estim_params_);
% [rmse, lnam, r2,vv] = plot_fit(obsname{:});
end
diff --git a/matlab/gsa/scatter_mcf.m b/matlab/gsa/scatter_mcf.m
index f6f134a5c..fa4229375 100644
--- a/matlab/gsa/scatter_mcf.m
+++ b/matlab/gsa/scatter_mcf.m
@@ -5,7 +5,7 @@ function scatter_mcf(X,Y,vnames,plotsymbol, fnam, dirname, figtitle, xparam1, D
% marco.ratto@ec.europa.eu
% Copyright (C) 2014-2016 European Commission
-% Copyright (C) 2014-2016 Dynare Team
+% Copyright (C) 2014-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -84,7 +84,7 @@ figtitle_tex=strrep(figtitle,'_','\_');
fig_nam_=[fnam];
if ~nograph,
- hh=dyn_figure(DynareOptions,'name',figtitle);
+ hh=dyn_figure(DynareOptions.nodisplay,'name',figtitle);
end
bf = 0.1;
@@ -166,7 +166,7 @@ if ~isoctave
end
if ~nograph,
- dyn_saveas(hh,[dirname,filesep,fig_nam_],DynareOptions);
+ dyn_saveas(hh,[dirname,filesep,fig_nam_],DynareOptions.nodisplay,DynareOptions.graph_format);
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
fidTeX = fopen([dirname,'/',fig_nam_ '.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by scatter_mcf.m (Dynare).\n');
diff --git a/matlab/gsa/scatter_plots.m b/matlab/gsa/scatter_plots.m
index a2c71eeaf..e64195464 100644
--- a/matlab/gsa/scatter_plots.m
+++ b/matlab/gsa/scatter_plots.m
@@ -1,5 +1,4 @@
function scatter_plots(X,xp,vnames,plotsymbol, fnam, dirname, figtitle, xparam1, DynareOptions)
-
%
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
@@ -53,16 +52,17 @@ if nargin<4 || isempty(plotsymbol)
end
end
-if nargin<5
- fnam='';
+if nargin<5 || isempty(fnam)
+ fnam='scatter_plot';
end
-if nargin<6,
+if nargin<6 || isempty(dirname),
dirname='';
nograph=1;
+ DynareOptions.nodisplay=0;
else
nograph=0;
end
-if nargin<7,
+if nargin<7 || isempty(figtitle),
figtitle=fnam;
end
if nargin<8,
@@ -72,10 +72,9 @@ end
figtitle_tex=strrep(figtitle,'_','\_');
fig_nam_=[fnam];
-if ~nograph,
- hh=dyn_figure(DynareOptions,'name',figtitle);
+
+ hh=dyn_figure(DynareOptions.nodisplay,'name',figtitle);
set(hh,'userdata',{X,xp})
-end
bf = 0.1;
ffs = 0.05/(p-1);
@@ -173,7 +172,7 @@ end
% end
if ~nograph,
- dyn_saveas(hh,[dirname,filesep,fig_nam_],DynareOptions);
+ dyn_saveas(hh,[dirname,filesep,fig_nam_],DynareOptions.nodisplay,DynareOptions.graph_format);
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
fidTeX = fopen([dirname,'/',fig_nam_ '.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by scatter_plots.m (Dynare).\n');
diff --git a/matlab/gsa/stab_map_1.m b/matlab/gsa/stab_map_1.m
index 5295d0e30..8535a78ec 100644
--- a/matlab/gsa/stab_map_1.m
+++ b/matlab/gsa/stab_map_1.m
@@ -21,7 +21,7 @@ function [proba, dproba] = stab_map_1(lpmat, ibehaviour, inonbehaviour, aname, i
% marco.ratto@ec.europa.eu
% Copyright (C) 2012-2016 European Commission
-% Copyright (C) 2012-2016 Dynare Team
+% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -82,7 +82,7 @@ if iplot && ~options_.nograph
ftit=bayestopt_.name(ipar+nshock*(1-ishock));
for i=1:ceil(nparplot/12),
- hh=dyn_figure(options_,'name',atitle);
+ hh=dyn_figure(options_.nodisplay,'name',atitle);
for j=1+12*(i-1):min(nparplot,12*i),
subplot(3,4,j-12*(i-1))
if ~isempty(ibehaviour),
@@ -98,7 +98,7 @@ if iplot && ~options_.nograph
title([ftit{j},'. p-value ', num2str(proba(ipar(j)),2)],'interpreter','none')
end
if nparplot>12,
- dyn_saveas(hh,[dirname,filesep,fname_,'_',aname,'_SA_',int2str(i)],options_);
+ dyn_saveas(hh,[dirname,filesep,fname_,'_',aname,'_SA_',int2str(i)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([dirname,filesep,fname_,'_',aname,'_SA_',int2str(i) '.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by stab_map_1.m (Dynare).\n');
@@ -113,7 +113,7 @@ if iplot && ~options_.nograph
fclose(fidTeX);
end
else
- dyn_saveas(hh,[dirname,filesep,fname_,'_',aname,'_SA'],options_);
+ dyn_saveas(hh,[dirname,filesep,fname_,'_',aname,'_SA'],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([dirname,filesep,fname_,'_',aname,'_SA.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by stab_map_1.m (Dynare).\n');
diff --git a/matlab/gsa/stab_map_2.m b/matlab/gsa/stab_map_2.m
index 35c3df82c..beed786dc 100644
--- a/matlab/gsa/stab_map_2.m
+++ b/matlab/gsa/stab_map_2.m
@@ -6,7 +6,7 @@ function indcorr = stab_map_2(x,alpha2, pvalue_crit, fnam, dirname,xparam1,figti
% marco.ratto@ec.europa.eu
% Copyright (C) 2011-2016 European Commission
-% Copyright (C) 2011-2016 Dynare Team
+% Copyright (C) 2011-2017 Dynare Team
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
@@ -119,7 +119,7 @@ for j=1:npar,
if ~nograph,
if mod(j2,12)==1,
ifig=ifig+1;
- hh=dyn_figure(options_,'name',[figtitle,' sample bivariate projection ', num2str(ifig)]);
+ hh=dyn_figure(options_.nodisplay,'name',[figtitle,' sample bivariate projection ', num2str(ifig)]);
end
subplot(3,4,j2-(ifig-1)*12)
% bar(c0(i2,j)),
@@ -142,7 +142,7 @@ for j=1:npar,
end
title(['cc = ',num2str(c0(i2(jx),j))])
if (mod(j2,12)==0) && j2>0,
- dyn_saveas(hh,[dirname,filesep,fig_nam_,int2str(ifig)],options_);
+ dyn_saveas(hh,[dirname,filesep,fig_nam_,int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([dirname,filesep,fig_nam_,int2str(ifig),'.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by stab_map_2.m (Dynare).\n');
@@ -163,7 +163,7 @@ for j=1:npar,
end
end
if ~nograph && (j==(npar)) && j2>0 && (mod(j2,12)~=0),
- dyn_saveas(hh,[dirname,filesep,fig_nam_,int2str(ifig)],options_);
+ dyn_saveas(hh,[dirname,filesep,fig_nam_,int2str(ifig)],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([dirname,filesep,fig_nam_,int2str(ifig),'.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by stab_map_2.m (Dynare).\n');
diff --git a/matlab/initial_condition_decomposition.m b/matlab/initial_condition_decomposition.m
new file mode 100644
index 000000000..1eb2b7959
--- /dev/null
+++ b/matlab/initial_condition_decomposition.m
@@ -0,0 +1,131 @@
+function oo_ = initial_condition_decomposition(M_,oo_,options_,varlist,bayestopt_,estim_params_)
+% function oo_ = initial_condition_decomposition(M_,oo_,options_,varlist,bayestopt_,estim_params_)
+% Computes initial condition contribution to a simulated trajectory. The field set is
+% oo_.initval_decomposition. It is a n_var by n_var+2 by nperiods array. The
+% first n_var columns store the respective endogenous initval contribution, column n+1
+% stores the role of the shocks, while column n+2 stores the
+% value of the smoothed variables. Variables are stored
+% in the order of declaration, i.e. M_.endo_names.
+%
+% INPUTS
+% M_: [structure] Definition of the model
+% oo_: [structure] Storage of results
+% options_: [structure] Options
+% varlist: [char] List of variables
+% bayestopt_: [structure] describing the priors
+% estim_params_: [structure] characterizing parameters to be estimated
+%
+% OUTPUTS
+% oo_: [structure] Storage of results
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2017 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 .
+
+options_.plot_shock_decomp.detail_plot = options_.initial_condition_decomp.detail_plot;
+options_.plot_shock_decomp.steadystate = options_.initial_condition_decomp.steadystate;
+options_.plot_shock_decomp.write_xls = options_.initial_condition_decomp.write_xls;
+options_.plot_shock_decomp.type = options_.initial_condition_decomp.type;
+options_.plot_shock_decomp.plot_init_date = options_.initial_condition_decomp.plot_init_date;
+options_.plot_shock_decomp.plot_end_date = options_.initial_condition_decomp.plot_end_date;
+
+% indices of endogenous variables
+if size(varlist,1) == 0
+ varlist = M_.endo_names(1:M_.orig_endo_nbr,:);
+end
+
+[i_var,nvar] = varlist_indices(varlist,M_.endo_names);
+
+% number of variables
+endo_nbr = M_.endo_nbr;
+
+% parameter set
+parameter_set = options_.parameter_set;
+if isempty(parameter_set)
+ if isfield(oo_,'posterior_mean')
+ parameter_set = 'posterior_mean';
+ elseif isfield(oo_,'mle_mode')
+ parameter_set = 'mle_mode';
+ elseif isfield(oo_,'posterior')
+ parameter_set = 'posterior_mode';
+ else
+ error(['shock_decomposition: option parameter_set is not specified ' ...
+ 'and posterior mode is not available'])
+ end
+end
+
+if ~isfield(oo_,'initval_decomposition')
+options_.selected_variables_only = 0; %make sure all variables are stored
+options_.plot_priors=0;
+[oo,junk1,junk2,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_);
+
+% reduced form
+dr = oo.dr;
+
+% data reordering
+order_var = dr.order_var;
+inv_order_var = dr.inv_order_var;
+
+
+% coefficients
+A = dr.ghx;
+B = dr.ghu;
+
+% initialization
+gend = size(oo.SmoothedShocks.(deblank(M_.exo_names(1,:))),1); %+options_.forecast;
+z = zeros(endo_nbr,endo_nbr+2,gend);
+z(:,end,:) = Smoothed_Variables_deviation_from_mean;
+
+for i=1:endo_nbr,
+ z(i,i,1) = Smoothed_Variables_deviation_from_mean(i,1);
+end
+
+maximum_lag = M_.maximum_lag;
+
+k2 = dr.kstate(find(dr.kstate(:,2) <= maximum_lag+1),[1 2]);
+i_state = order_var(k2(:,1))+(min(i,maximum_lag)+1-k2(:,2))*M_.endo_nbr;
+for i=1:gend
+ if i > 1 && i <= maximum_lag+1
+ lags = min(i-1,maximum_lag):-1:1;
+ end
+
+ if i > 1
+ tempx = permute(z(:,1:endo_nbr,lags),[1 3 2]);
+ m = min(i-1,maximum_lag);
+ tempx = [reshape(tempx,endo_nbr*m,endo_nbr); zeros(endo_nbr*(maximum_lag-i+1),endo_nbr)];
+ z(:,1:endo_nbr,i) = A(inv_order_var,:)*tempx(i_state,:);
+ lags = lags+1;
+ end
+ z(:,endo_nbr+1,i) = z(:,endo_nbr+2,i) - sum(z(:,1:endo_nbr,i),2);
+
+end
+
+
+oo_.initval_decomposition = z;
+end
+% if ~options_.no_graph.shock_decomposition
+ oo=oo_;
+ oo.shock_decomposition = oo_.initval_decomposition;
+ M_.exo_names = M_.endo_names;
+ M_.exo_nbr = M_.endo_nbr;
+ options_.plot_shock_decomp.screen_shocks=1;
+ options_.plot_shock_decomp.use_shock_groups = '';
+ options_.plot_shock_decomp.fig_names='initval';
+ plot_shock_decomposition(M_,oo,options_,varlist);
+% end
\ No newline at end of file
diff --git a/matlab/initial_estimation_checks.m b/matlab/initial_estimation_checks.m
index 03f0eac05..588a014cd 100644
--- a/matlab/initial_estimation_checks.m
+++ b/matlab/initial_estimation_checks.m
@@ -165,8 +165,15 @@ elseif imag(fval)
end
if info(1) > 0
+ if DynareOptions.order>1
+ [eigenvalues_] = check(Model,DynareOptions, DynareResults);
+ if any(abs(eigenvalues_)>DynareOptions.qz_criterium)
+ error('Your model has at least one unit root and you are using a nonlinear filter. Please set nonlinear_filter_initialization=3.')
+ end
+ else
disp('Error in computing likelihood for initial parameter values')
print_info(info, DynareOptions.noprint, DynareOptions)
+ end
end
if DynareOptions.prefilter==1
diff --git a/matlab/list_of_functions_to_be_cleared.m b/matlab/list_of_functions_to_be_cleared.m
index e482add52..a9d182dae 100644
--- a/matlab/list_of_functions_to_be_cleared.m
+++ b/matlab/list_of_functions_to_be_cleared.m
@@ -1 +1 @@
-list_of_functions = {'discretionary_policy_1', 'dsge_var_likelihood', 'dyn_first_order_solver', 'dyn_waitbar', 'ep_residuals', 'evaluate_likelihood', 'evaluate_smoother', 'prior_draw_gsa', 'identification_analysis', 'computeDLIK', 'univariate_computeDLIK', 'metropolis_draw', 'flag_implicit_skip_nan', 'moment_function', 'non_linear_dsge_likelihood', 'mr_hessian', 'masterParallel', 'auxiliary_initialization', 'auxiliary_particle_filter', 'conditional_filter_proposal', 'conditional_particle_filter', 'gaussian_filter', 'gaussian_filter_bank', 'gaussian_mixture_filter', 'gaussian_mixture_filter_bank', 'Kalman_filter', 'online_auxiliary_filter', 'sequential_importance_particle_filter', 'solve_model_for_online_filter', 'perfect_foresight_simulation', 'prior_draw', 'priordens', 'smm_objective'};
\ No newline at end of file
+list_of_functions = {'discretionary_policy_1', 'dsge_var_likelihood', 'dyn_first_order_solver', 'dyn_waitbar', 'ep_residuals', 'evaluate_likelihood', 'prior_draw_gsa', 'identification_analysis', 'computeDLIK', 'univariate_computeDLIK', 'metropolis_draw', 'flag_implicit_skip_nan', 'moment_function', 'non_linear_dsge_likelihood', 'mr_hessian', 'masterParallel', 'auxiliary_initialization', 'auxiliary_particle_filter', 'conditional_filter_proposal', 'conditional_particle_filter', 'gaussian_filter', 'gaussian_filter_bank', 'gaussian_mixture_filter', 'gaussian_mixture_filter_bank', 'Kalman_filter', 'online_auxiliary_filter', 'sequential_importance_particle_filter', 'solve_model_for_online_filter', 'perfect_foresight_simulation', 'prior_draw', 'priordens', 'smm_objective'};
\ No newline at end of file
diff --git a/matlab/mh_autocorrelation_function.m b/matlab/mh_autocorrelation_function.m
index 96b4c5875..b14178def 100644
--- a/matlab/mh_autocorrelation_function.m
+++ b/matlab/mh_autocorrelation_function.m
@@ -18,7 +18,7 @@ function mh_autocorrelation_function(options_,M_,estim_params_,type,blck,name1,n
%
% SPECIAL REQUIREMENTS
-% Copyright (C) 2003-2013 Dynare Team
+% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -91,7 +91,7 @@ if options_.mh_nblck>1
FigureName = [ FigureName , ' (block number' int2str(blck) ').'];
end
-hh=dyn_figure(options_,'Name',FigureName);
+hh=dyn_figure(options_.nodisplay,'Name',FigureName);
bar(0:options_.mh_autocorrelation_function_size,autocor,'k');
axis tight
@@ -104,4 +104,4 @@ if ~exist([M_.fname filesep 'graphs'])
end
plot_name=get_the_name(column,0,M_,estim_params_,options_);
-dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'MH_Autocorrelation_' plot_name],options_)
+dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'MH_Autocorrelation_' plot_name],options_.nodisplay,options_.graph_format)
diff --git a/matlab/missing/struct2array/struct2array.m b/matlab/missing/struct2array/struct2array.m
new file mode 100644
index 000000000..b1c1370dd
--- /dev/null
+++ b/matlab/missing/struct2array/struct2array.m
@@ -0,0 +1,29 @@
+function a = struct2array(s)
+
+% INPUTS
+% - s [struct] with N fields, field i contains a n_i*m_i array of doubles.
+%
+% OUPUTS
+% - a [double] column vector with sum(n_i*m_i, i=1,...,N) elements.
+
+% Copyright (C) 2017 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 .
+
+assert(isstruct(s), 'struct2array:: Argument has to be a structure!')
+
+c = cellfun(@vec, struct2cell(s), 'UniformOutput', false);
+a = vertcat(c{:});
\ No newline at end of file
diff --git a/matlab/missing_DiffuseKalmanSmootherH3_Z.m b/matlab/missing_DiffuseKalmanSmootherH3_Z.m
index c5beeedc7..b03b13ee0 100644
--- a/matlab/missing_DiffuseKalmanSmootherH3_Z.m
+++ b/matlab/missing_DiffuseKalmanSmootherH3_Z.m
@@ -122,7 +122,11 @@ end
t = 0;
icc=0;
-newRank = rank(Pinf(:,:,1),diffuse_kalman_tol);
+if ~isempty(Pinf(:,:,1))
+ newRank = rank(Z*Pinf(:,:,1)*Z',diffuse_kalman_tol);
+else
+ newRank = rank(Pinf(:,:,1),diffuse_kalman_tol);
+end
while newRank && t < smpl
t = t+1;
a(:,t) = a1(:,t);
@@ -156,7 +160,11 @@ while newRank && t < smpl
end
end
if newRank
- oldRank = rank(Pinf(:,:,t),diffuse_kalman_tol);
+ if ~isempty(Pinf(:,:,t))
+ oldRank = rank(Z*Pinf(:,:,t)*Z',diffuse_kalman_tol);
+ else
+ oldRank = rank(Pinf(:,:,t),diffuse_kalman_tol);
+ end
else
oldRank = 0;
end
@@ -168,7 +176,11 @@ while newRank && t < smpl
Pstar(:,:,t+1) = T*Pstar(:,:,t)*T'+ QQ;
Pinf(:,:,t+1) = T*Pinf(:,:,t)*T';
if newRank
- newRank = rank(Pinf(:,:,t+1),diffuse_kalman_tol);
+ if ~isempty(Pinf(:,:,t+1))
+ newRank = rank(Z*Pinf(:,:,t+1)*Z',diffuse_kalman_tol);
+ else
+ newRank = rank(Pinf(:,:,t+1),diffuse_kalman_tol);
+ end
end
if oldRank ~= newRank
disp('univariate_diffuse_kalman_filter:: T does influence the rank of Pinf!')
@@ -367,3 +379,9 @@ if decomp_flag
end
epsilonhat = Y - Z*alphahat;
+
+
+if (d==smpl)
+ warning(['missing_DiffuseKalmanSmootherH3_Z:: There isn''t enough information to estimate the initial conditions of the nonstationary variables']);
+ return
+end
diff --git a/matlab/mode_check.m b/matlab/mode_check.m
index 8d216bcbf..3217dbd12 100644
--- a/matlab/mode_check.m
+++ b/matlab/mode_check.m
@@ -40,7 +40,7 @@ function mode_check(fun,x,hessian_mat,DynareDataset,DatasetInfo,DynareOptions,Mo
%! @end deftypefn
%@eod:
-% Copyright (C) 2003-2016 Dynare Team
+% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -96,7 +96,7 @@ for plt = 1:nbplt,
NAMES = [];
TeXNAMES = [];
end
- hh = dyn_figure(DynareOptions,'Name','Mode check plots');
+ hh = dyn_figure(DynareOptions.nodisplay,'Name','Mode check plots');
for k=1:min(nstar,length(x)-(plt-1)*nstar)
subplot(nr,nc,k)
kk = (plt-1)*nstar+k;
@@ -187,7 +187,7 @@ for plt = 1:nbplt,
text(0.25,0.5,'log-post')
text(0.69,0.5,'log-lik kernel')
end
- dyn_saveas(hh,[ Model.fname '_CheckPlots' int2str(plt) ],DynareOptions);
+ dyn_saveas(hh,[ Model.fname '_CheckPlots' int2str(plt) ],DynareOptions.nodisplay,DynareOptions.graph_format);
if TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
% TeX eps loader file
fprintf(fidTeX,'\\begin{figure}[H]\n');
diff --git a/matlab/modules/reporting b/matlab/modules/reporting
index ac6a420a2..af39a2c97 160000
--- a/matlab/modules/reporting
+++ b/matlab/modules/reporting
@@ -1 +1 @@
-Subproject commit ac6a420a28feeb68b43a8fdb7a6ea9e0bec0b7ae
+Subproject commit af39a2c97ea01de6a1451071e58d4fce8f4b9d03
diff --git a/matlab/non_linear_dsge_likelihood.m b/matlab/non_linear_dsge_likelihood.m
index 3debf8b7f..57e02a0b7 100644
--- a/matlab/non_linear_dsge_likelihood.m
+++ b/matlab/non_linear_dsge_likelihood.m
@@ -316,7 +316,8 @@ switch DynareOptions.particle.initialization
StateVectorVariance = cov(y_');
DynareOptions.periods = old_DynareOptionsperiods;
clear('old_DynareOptionsperiods','y_');
- case 3% Initial state vector covariance is a diagonal matrix.
+ case 3% Initial state vector covariance is a diagonal matrix (to be used
+ % if model has stochastic trends).
StateVectorMean = ReducedForm.constant(mf0);
StateVectorVariance = DynareOptions.particle.initial_state_prior_std*eye(number_of_state_variables);
otherwise
diff --git a/matlab/particles b/matlab/particles
index 79b42ec94..823d94748 160000
--- a/matlab/particles
+++ b/matlab/particles
@@ -1 +1 @@
-Subproject commit 79b42ec947aa1dbe009778f3874f074f0d14eb7a
+Subproject commit 823d947484675c8d409a4eb2377a57dc59bdf713
diff --git a/matlab/perfect-foresight-models/sim1.m b/matlab/perfect-foresight-models/sim1.m
index 05ef5b186..1a173b211 100644
--- a/matlab/perfect-foresight-models/sim1.m
+++ b/matlab/perfect-foresight-models/sim1.m
@@ -17,7 +17,7 @@ function [endogenousvariables, info] = sim1(endogenousvariables, exogenousvariab
% SPECIAL REQUIREMENTS
% None.
-% Copyright (C) 1996-2016 Dynare Team
+% Copyright (C) 1996-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -165,6 +165,11 @@ for iter = 1:options.simul.maxit
dy = -lin_solve( A, res, verbose );
end
end
+ if any(~isreal(dy)) || any(isnan(dy)) || any(isinf(dy))
+ if verbose
+ display_critical_variables(reshape(dy,[ny periods])', M);
+ end
+ end
Y(i_upd) = Y(i_upd) + dy;
end
@@ -184,7 +189,12 @@ if stop
if verbose
skipline()
disp(sprintf('Total time of simulation: %s.', num2str(etime(clock,h1))))
- disp('Simulation terminated with NaN or Inf in the residuals or endogenous variables.')
+ if ~isreal(res) || ~isreal(Y)
+ disp('Simulation terminated with imaginary parts in the residuals or endogenous variables.')
+ else
+ disp('Simulation terminated with NaN or Inf in the residuals or endogenous variables.')
+ end
+ display_critical_variables(reshape(dy,[ny periods])', M);
disp('There is most likely something wrong with your model. Try model_diagnostics or another simulation method.')
printline(105)
end
@@ -296,4 +306,30 @@ function [ x, flag, relres ] = lin_solve_robust( A, b , verbose)
flag = relres > 1e-6;
if flag ~= 0 && verbose
fprintf( 'WARNING : Failed to find a solution to the linear system\n' );
- end
\ No newline at end of file
+ end
+
+function display_critical_variables(dyy, M)
+
+ if any(isnan(dyy))
+ indx = find(any(isnan(dyy)));
+ endo_names=cellstr(M.endo_names(indx,:));
+ disp('Last iteration provided NaN for the following variables:')
+ fprintf('%s, ',endo_names{:}),
+ fprintf('\n'),
+ end
+ if any(isinf(dyy))
+ indx = find(any(isinf(dyy)));
+ endo_names=cellstr(M.endo_names(indx,:));
+ disp('Last iteration diverged (Inf) for the following variables:')
+ fprintf('%s, ',endo_names{:}),
+ fprintf('\n'),
+ end
+ if any(~isreal(dyy))
+ indx = find(any(~isreal(dyy)));
+ endo_names=cellstr(M.endo_names(indx,:));
+ disp('Last iteration provided complex number for the following variables:')
+ fprintf('%s, ',endo_names{:}),
+ fprintf('\n'),
+ end
+
+
\ No newline at end of file
diff --git a/matlab/plot_icforecast.m b/matlab/plot_icforecast.m
index 62d788414..1d4b61eb7 100644
--- a/matlab/plot_icforecast.m
+++ b/matlab/plot_icforecast.m
@@ -10,7 +10,7 @@ function plot_icforecast(Variables,periods,options_)
% SPECIAL REQUIREMENTS
% This routine has to be called after imcforecast.m.
-% Copyright (C) 2006-2016 Dynare Team
+% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -57,7 +57,7 @@ for i=1:size(Variables,1)
end
function build_figure(name,cci1,cci2,mm1,mm2,options_,graphoptions)
-hh = dyn_figure(options_,'Name',['Conditional forecast (' graphoptions.title ,'): ' name '.']);
+hh = dyn_figure(options_.nodisplay,'Name',['Conditional forecast (' graphoptions.title ,'): ' name '.']);
H = length(mm1);
h1 = area(1:H,cci1(2,1:H),'BaseValue',min([min(cci1(1,:)),min(cci2(1,:))]),'FaceColor',[.9 .9 .9]);
hold on
@@ -68,4 +68,4 @@ plot(1:H,cci2(1,:),'--k','linewidth',1)
plot(1:H,cci2(2,:),'--k','linewidth',1)
axis tight
hold off
-dyn_saveas(hh,[graphoptions.OutputDirectoryName '/Conditional_forecast_',strrep(deblank(graphoptions.title),' ','_'),'_',deblank(name)],options_)
\ No newline at end of file
+dyn_saveas(hh,[graphoptions.OutputDirectoryName '/Conditional_forecast_',strrep(deblank(graphoptions.title),' ','_'),'_',deblank(name)],options_.nodisplay,options_.graph_format)
\ No newline at end of file
diff --git a/matlab/plot_identification.m b/matlab/plot_identification.m
index e24695025..f699d2e42 100644
--- a/matlab/plot_identification.m
+++ b/matlab/plot_identification.m
@@ -19,7 +19,7 @@ function plot_identification(params,idemoments,idehess,idemodel, idelre, advance
% SPECIAL REQUIREMENTS
% None
-% Copyright (C) 2008-2016 Dynare Team
+% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -60,7 +60,7 @@ tittxt1=regexprep(tittxt, ' ', '_');
tittxt1=strrep(tittxt1, '.', '');
if SampleSize == 1,
siJ = idemoments.siJ;
- hh = dyn_figure(options_,'Name',[tittxt, ' - Identification using info from observables']);
+ hh = dyn_figure(options_.nodisplay,'Name',[tittxt, ' - Identification using info from observables']);
subplot(211)
mmm = (idehess.ide_strength_J);
[ss, is] = sort(mmm);
@@ -122,7 +122,7 @@ if SampleSize == 1,
fprintf(fidTeX,'%% End Of TeX file. \n');
fclose(fidTeX);
end
- dyn_saveas(hh,[IdentifDirectoryName '/' M_.fname '_ident_strength_' tittxt1],options_);
+ dyn_saveas(hh,[IdentifDirectoryName '/' M_.fname '_ident_strength_' tittxt1],options_.nodisplay,options_.graph_format);
if advanced,
if ~options_.nodisplay,
@@ -132,7 +132,7 @@ if SampleSize == 1,
if all(isnan([siJnorm';siHnorm';siLREnorm']))
fprintf('\nIDENTIFICATION: Skipping sensitivity plot, because standard deviation of parameters is NaN, possibly due to the use of ML.\n')
else
- hh = dyn_figure(options_,'Name',[tittxt, ' - Sensitivity plot']);
+ hh = dyn_figure(options_.nodisplay,'Name',[tittxt, ' - Sensitivity plot']);
subplot(211)
mmm = (siJnorm)'./max(siJnorm);
mmm1 = (siHnorm)'./max(siHnorm);
@@ -151,7 +151,7 @@ if SampleSize == 1,
end
legend('Moments','Model','LRE model','Location','Best')
title('Sensitivity bars using derivatives (log-scale)')
- dyn_saveas(hh,[IdentifDirectoryName '/' M_.fname '_sensitivity_' tittxt1 ],options_);
+ dyn_saveas(hh,[IdentifDirectoryName '/' M_.fname '_sensitivity_' tittxt1 ],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([IdentifDirectoryName '/' M_.fname '_sensitivity_' tittxt1,'.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
@@ -185,7 +185,7 @@ if SampleSize == 1,
end
% fprintf('%-15s [%s] %10.3f\n',name{i},namx,idemoments.cosnJ(i,j))
end
- hh = dyn_figure(options_,'Name',[tittxt,' - Collinearity patterns with ', int2str(j) ,' parameter(s)']);
+ hh = dyn_figure(options_.nodisplay,'Name',[tittxt,' - Collinearity patterns with ', int2str(j) ,' parameter(s)']);
imagesc(pax,[0 1]);
set(gca,'xticklabel','')
set(gca,'yticklabel','')
@@ -205,7 +205,7 @@ if SampleSize == 1,
set(gca,'xgrid','on')
set(gca,'ygrid','on')
xlabel([tittxt,' - Collinearity patterns with ', int2str(j) ,' parameter(s)'],'interpreter','none')
- dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_ident_collinearity_' tittxt1 '_' int2str(j) ],options_);
+ dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_ident_collinearity_' tittxt1 '_' int2str(j) ],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([ IdentifDirectoryName '/' M_.fname '_ident_collinearity_' tittxt1 '_' int2str(j),'.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
@@ -225,24 +225,24 @@ if SampleSize == 1,
S=diag(S);
if idehess.flag_score,
if nparam<5,
- f1 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (Information matrix)']);
+ f1 = dyn_figure(options_.nodisplay,'Name',[tittxt,' - Identification patterns (Information matrix)']);
tex_tit_1=[tittxt,' - Identification patterns (Information matrix)'];
else
- f1 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (Information matrix): SMALLEST SV']);
+ f1 = dyn_figure(options_.nodisplay,'Name',[tittxt,' - Identification patterns (Information matrix): SMALLEST SV']);
tex_tit_1=[tittxt,' - Identification patterns (Information matrix): SMALLEST SV'];
- f2 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (Information matrix): HIGHEST SV']);
+ f2 = dyn_figure(options_.nodisplay,'Name',[tittxt,' - Identification patterns (Information matrix): HIGHEST SV']);
tex_tit_2=[tittxt,' - Identification patterns (Information matrix): HIGHEST SV'];
end
else
% S = idemoments.S;
% V = idemoments.V;
if nparam<5,
- f1 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (moments Information matrix)']);
+ f1 = dyn_figure(options_.nodisplay,'Name',[tittxt,' - Identification patterns (moments Information matrix)']);
tex_tit_1=[tittxt,' - Identification patterns (moments Information matrix)'];
else
- f1 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (moments Information matrix): SMALLEST SV']);
+ f1 = dyn_figure(options_.nodisplay,'Name',[tittxt,' - Identification patterns (moments Information matrix): SMALLEST SV']);
tex_tit_1=[tittxt,' - Identification patterns (moments Information matrix): SMALLEST SV'];
- f2 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (moments Information matrix): HIGHEST SV']);
+ f2 = dyn_figure(options_.nodisplay,'Name',[tittxt,' - Identification patterns (moments Information matrix): HIGHEST SV']);
tex_tit_2=[tittxt,' - Identification patterns (moments Information matrix): HIGHEST SV'];
end
end
@@ -270,7 +270,7 @@ if SampleSize == 1,
end
title(['Singular value ',num2str(Stit)])
end
- dyn_saveas(f1,[ IdentifDirectoryName '/' M_.fname '_ident_pattern_' tittxt1 '_1' ],options_);
+ dyn_saveas(f1,[ IdentifDirectoryName '/' M_.fname '_ident_pattern_' tittxt1 '_1' ],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([ IdentifDirectoryName '/' M_.fname '_ident_pattern_' tittxt1 '_1','.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
@@ -285,7 +285,7 @@ if SampleSize == 1,
fclose(fidTeX);
end
if nparam>4,
- dyn_saveas(f2,[ IdentifDirectoryName '/' M_.fname '_ident_pattern_' tittxt1 '_2' ],options_);
+ dyn_saveas(f2,[ IdentifDirectoryName '/' M_.fname '_ident_pattern_' tittxt1 '_2' ],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([ IdentifDirectoryName '/' M_.fname '_ident_pattern_' tittxt1 '_2.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
@@ -303,7 +303,7 @@ if SampleSize == 1,
end
else
- hh = dyn_figure(options_,'Name',['MC sensitivities']);
+ hh = dyn_figure(options_.nodisplay,'Name',['MC sensitivities']);
subplot(211)
mmm = (idehess.ide_strength_J);
[ss, is] = sort(mmm);
@@ -329,7 +329,7 @@ else
legend('Moments','Model','LRE model','Location','Best')
end
title('MC mean of sensitivity measures')
- dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_MC_sensitivity' ],options_);
+ dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_MC_sensitivity' ],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([ IdentifDirectoryName '/' M_.fname '_MC_sensitivity.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
@@ -350,7 +350,7 @@ else
disp('Press ENTER to display advanced diagnostics'), pause(5),
end
% options_.nograph=1;
- hh = dyn_figure(options_,'Name','MC Condition Number');
+ hh = dyn_figure(options_.nodisplay,'Name','MC Condition Number');
subplot(221)
hist(log10(idemodel.cond))
title('log10 of Condition number in the model')
@@ -360,7 +360,7 @@ else
subplot(223)
hist(log10(idelre.cond))
title('log10 of Condition number in the LRE model')
- dyn_saveas(hh,[IdentifDirectoryName '/' M_.fname '_ident_COND' ],options_);
+ dyn_saveas(hh,[IdentifDirectoryName '/' M_.fname '_ident_COND' ],options_.nodisplay,options_.graph_format);
options_mcf.pvalue_ks = 0.1;
options_mcf.pvalue_corr = 0.001;
options_mcf.alpha2 = 0;
@@ -398,12 +398,12 @@ else
% end
if nparam<5,
- f1 = dyn_figure(options_,'Name',[tittxt,' - MC Identification patterns (moments): HIGHEST SV']);
+ f1 = dyn_figure(options_.nodisplay,'Name',[tittxt,' - MC Identification patterns (moments): HIGHEST SV']);
tex_tit_1=[tittxt,' - MC Identification patterns (moments): HIGHEST SV'];
else
- f1 = dyn_figure(options_,'Name',[tittxt,' - MC Identification patterns (moments): SMALLEST SV']);
+ f1 = dyn_figure(options_.nodisplay,'Name',[tittxt,' - MC Identification patterns (moments): SMALLEST SV']);
tex_tit_1=[tittxt,' - MC Identification patterns (moments): SMALLEST SV'];
- f2 = dyn_figure(options_,'Name',[tittxt,' - MC Identification patterns (moments): HIGHEST SV']);
+ f2 = dyn_figure(options_.nodisplay,'Name',[tittxt,' - MC Identification patterns (moments): HIGHEST SV']);
tex_tit_2=[tittxt,' - MC Identification patterns (moments): HIGHEST SV'];
end
nplots=min(nparam,8);
@@ -440,7 +440,7 @@ else
end
title(['MEAN Singular value ',num2str(Stit)])
end
- dyn_saveas(f1,[IdentifDirectoryName '/' M_.fname '_MC_ident_pattern_1' ],options_);
+ dyn_saveas(f1,[IdentifDirectoryName '/' M_.fname '_MC_ident_pattern_1' ],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([IdentifDirectoryName '/' M_.fname '_MC_ident_pattern_1.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
@@ -455,7 +455,7 @@ else
fclose(fidTeX);
end
if nparam>4,
- dyn_saveas(f2,[ IdentifDirectoryName '/' M_.fname '_MC_ident_pattern_2' ],options_);
+ dyn_saveas(f2,[ IdentifDirectoryName '/' M_.fname '_MC_ident_pattern_2' ],options_.nodisplay,options_.graph_format);
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fidTeX = fopen([ IdentifDirectoryName '/' M_.fname '_MC_ident_pattern_2.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by plot_identification.m (Dynare).\n');
diff --git a/matlab/plot_priors.m b/matlab/plot_priors.m
index 15842b8e9..04f371566 100644
--- a/matlab/plot_priors.m
+++ b/matlab/plot_priors.m
@@ -13,7 +13,7 @@ function plot_priors(bayestopt_,M_,estim_params_,options_)
% SPECIAL REQUIREMENTS
% None
-% Copyright (C) 2004-2016 Dynare Team
+% Copyright (C) 2004-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -43,7 +43,7 @@ if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,' \n');
end
for plt = 1:nbplt,
- hplt = dyn_figure(options_,'Name',figurename);
+ hplt = dyn_figure(options_.nodisplay,'Name',figurename);
if TeX
TeXNAMES = [];
NAMES = [];
@@ -70,7 +70,7 @@ for plt = 1:nbplt,
title(nam,'Interpreter','none')
drawnow
end
- dyn_saveas(hplt,[M_.fname '_Priors' int2str(plt)],options_);
+ dyn_saveas(hplt,[M_.fname '_Priors' int2str(plt)],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:nstar0,
diff --git a/matlab/plot_shock_decomposition.m b/matlab/plot_shock_decomposition.m
index bc9534e21..15c97506a 100644
--- a/matlab/plot_shock_decomposition.m
+++ b/matlab/plot_shock_decomposition.m
@@ -28,6 +28,11 @@ function [z, steady_state] = plot_shock_decomposition(M_,oo_,options_,varlist)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
+options_.nodisplay = options_.plot_shock_decomp.nodisplay;
+options_.graph_format = options_.plot_shock_decomp.graph_format;
+options_.use_shock_groups = options_.plot_shock_decomp.use_shock_groups;
+options_.colormap = options_.plot_shock_decomp.colormap;
+
% indices of endogenous variables
if size(varlist,1) == 0
varlist = M_.endo_names(1:M_.orig_endo_nbr,:);
@@ -41,7 +46,7 @@ endo_nbr = M_.endo_nbr;
% number of shocks
nshocks = M_.exo_nbr;
% type = '';
-fig_names='';
+fig_name='';
% detail_plot=0;
% realtime_=0; % 0 is standard; 1 is realtime (pool/vintage); 2 is conditional (pool/vintage); 3 is forecast (pool/vintage)
% vintage_=0; % 0 pool realtime/conditional; int: forecast/conditional shock decompositions
@@ -49,27 +54,31 @@ fig_names='';
% steadystate=0;
% write_xls=0;
-if isfield(options_.shock_decomp,'expand'), % private trap for uimenu calls
- expand=options_.shock_decomp.expand;
+if isfield(options_.plot_shock_decomp,'expand'), % private trap for uimenu calls
+ expand=options_.plot_shock_decomp.expand;
else
expand=0;
end
-if ~isempty(options_.shock_decomp.fig_names)
- fig_names=[' ' options_.shock_decomp.fig_names];
+if ~isempty(options_.plot_shock_decomp.fig_name)
+ fig_name=[' ' options_.plot_shock_decomp.fig_name];
end
-type=options_.shock_decomp.type;
-detail_plot=options_.shock_decomp.detail_plot;
-realtime_= options_.shock_decomp.realtime;
-vintage_ = options_.shock_decomp.vintage;
+type=options_.plot_shock_decomp.type;
+detail_plot=options_.plot_shock_decomp.detail_plot;
+realtime_= options_.plot_shock_decomp.realtime;
+vintage_ = options_.plot_shock_decomp.vintage;
forecast_ = options_.shock_decomp.forecast;
-steadystate = options_.shock_decomp.steadystate;
-write_xls = options_.shock_decomp.write_xls;
+steadystate = options_.plot_shock_decomp.steadystate;
+write_xls = options_.plot_shock_decomp.write_xls;
+
+if vintage_,
+ forecast_ = min(forecast_,options_.nobs-vintage_);
+end
initial_date = options_.initial_date;
-if isfield(options_.shock_decomp,'q2a'), % private trap for aoa calls
- q2a=options_.shock_decomp.q2a;
+if isfield(options_.plot_shock_decomp,'q2a'), % private trap for aoa calls
+ q2a=options_.plot_shock_decomp.q2a;
if isstruct(q2a) && isempty(fieldnames(q2a)),
q2a=0;
end
@@ -81,35 +90,35 @@ switch realtime_
case 0
z = oo_.shock_decomposition;
- fig_names1=fig_names;
+ fig_name1=fig_name;
case 1 % realtime
if vintage_
z = oo_.realtime_shock_decomposition.(['time_' int2str(vintage_)]);
- fig_names1=[fig_names ' realtime (vintage ' char(initial_date+vintage_-1) ')'];
+ fig_name1=[fig_name ' realtime (vintage ' char(initial_date+vintage_-1) ')'];
else
z = oo_.realtime_shock_decomposition.pool;
- fig_names1=[fig_names ' realtime (rolling)'];
+ fig_name1=[fig_name ' realtime (rolling)'];
end
case 2 % conditional
if vintage_
z = oo_.realtime_conditional_shock_decomposition.(['time_' int2str(vintage_)]);
initial_date = options_.initial_date+vintage_-1;
- fig_names1=[fig_names ' ' int2str(forecast_) '-step ahead conditional forecast (given ' char(initial_date) ')'];
+ fig_name1=[fig_name ' ' int2str(forecast_) '-step ahead conditional forecast (given ' char(initial_date) ')'];
else
z = oo_.conditional_shock_decomposition.pool;
- fig_names1=[fig_names ' 1-step ahead conditional forecast (rolling)'];
+ fig_name1=[fig_name ' 1-step ahead conditional forecast (rolling)'];
end
case 3 % forecast
if vintage_
z = oo_.realtime_forecast_shock_decomposition.(['time_' int2str(vintage_)]);
initial_date = options_.initial_date+vintage_-1;
- fig_names1=[fig_names ' ' int2str(forecast_) '-step ahead forecast (given ' char(initial_date) ')'];
+ fig_name1=[fig_name ' ' int2str(forecast_) '-step ahead forecast (given ' char(initial_date) ')'];
else
z = oo_.realtime_forecast_shock_decomposition.pool;
- fig_names1=[fig_names ' 1-step ahead forecast (rolling)'];
+ fig_name1=[fig_name ' 1-step ahead forecast (rolling)'];
end
end
@@ -129,7 +138,7 @@ if isequal(type,'aoa') && isstruct(q2a) && realtime_
initial_date1=initial_date0+1;
end
end
- t0=min(options_.shock_decomp.save_realtime);
+ t0=min(options_.plot_shock_decomp.save_realtime);
ini1 = initial_date+t0-1;
t0=t0+(4-ini1.time(2));
if ~isfield(q2a,'var_type'), % private trap for aoa calls
@@ -153,7 +162,7 @@ if isequal(type,'aoa') && isstruct(q2a) && realtime_
% if isstruct(q2a.aux) && ischar(q2a.aux.y)
% opts=options_;
-% opts.shock_decomp.type='qoq';
+% opts.plot_shock_decomp.type='qoq';
% [y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,opts,q2a.aux.y);
% q2a.aux.y=y_aux;
% q2a.aux.yss=steady_state_aux;
@@ -170,14 +179,14 @@ end
if ~expand
- fig_names = fig_names1;
+ fig_name = fig_name1;
end
gend = size(z,3);
-if options_.use_shock_groups
- shock_groups = M_.shock_groups.(options_.use_shock_groups);
+if options_.plot_shock_decomp.use_shock_groups
+ shock_groups = M_.shock_groups.(options_.plot_shock_decomp.use_shock_groups);
shock_ind = fieldnames(shock_groups);
ngroups = length(shock_ind);
- fig_names=[fig_names ' group ' options_.use_shock_groups];
+ fig_name=[fig_name ' group ' options_.plot_shock_decomp.use_shock_groups];
shock_names = shock_ind;
for i=1:ngroups,
shock_names{i} = (shock_groups.(shock_ind{i}).label);
@@ -195,7 +204,7 @@ if options_.use_shock_groups
zothers = sum(z(:,1:nshocks,:),2);
shock_groups.(['group' int2str(ngroups+1)]).label = 'Others';
shock_groups.(['group' int2str(ngroups+1)]).shocks = cellstr(M_.exo_names(find(~ismember([1:M_.exo_nbr],kcum)),:))';
- M_.shock_groups.(options_.use_shock_groups)=shock_groups;
+ M_.shock_groups.(options_.plot_shock_decomp.use_shock_groups)=shock_groups;
if any(any(zothers)),
shock_names = [shock_names; {'Others + Initial Values'}];
end
@@ -212,8 +221,8 @@ end
MAP(end,:) = [0.7 0.7 0.7];
% MAP = [MAP; [0.7 0.7 0.7]; [0.3 0.3 0.3]];
-if isempty(options_.colormap),
- options_.colormap = MAP;
+if isempty(options_.plot_shock_decomp.colormap),
+ options_.plot_shock_decomp.colormap = MAP;
end
switch type
@@ -269,7 +278,7 @@ switch type
if isstruct(q2a.aux) && ischar(q2a.aux.y)
opts=options_;
- opts.shock_decomp.type='qoq';
+ opts.plot_shock_decomp.type='qoq';
[y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,opts,q2a.aux.y);
q2a.aux.y=y_aux;
q2a.aux.yss=steady_state_aux;
@@ -292,11 +301,11 @@ switch type
z=z(:,:,t0:4:end);
end
- if ~isempty(options_.shock_decomp.plot_init_date)
- options_.shock_decomp.plot_init_date = dates([int2str(options_.shock_decomp.plot_init_date.time(1)) 'Y']);
+ if ~isempty(options_.plot_shock_decomp.plot_init_date)
+ options_.plot_shock_decomp.plot_init_date = dates([int2str(options_.plot_shock_decomp.plot_init_date.time(1)) 'Y']);
end
- if ~isempty(options_.shock_decomp.plot_end_date)
- options_.shock_decomp.plot_end_date = dates([int2str(options_.shock_decomp.plot_end_date.time(1)) 'Y']);
+ if ~isempty(options_.plot_shock_decomp.plot_end_date)
+ options_.plot_shock_decomp.plot_end_date = dates([int2str(options_.plot_shock_decomp.plot_end_date.time(1)) 'Y']);
end
@@ -306,7 +315,7 @@ switch type
end
if steadystate
- options_.shock_decomp.steady_state=steady_state;
+ options_.plot_shock_decomp.steady_state=steady_state;
end
if nargout
@@ -319,17 +328,18 @@ end
my_initial_date = initial_date;
a = 1;
b = size(z,3);
-if ~isempty(options_.shock_decomp.plot_init_date)
- my_initial_date = max(initial_date,options_.shock_decomp.plot_init_date);
- a = find((initial_date:initial_date+b-1)==options_.shock_decomp.plot_init_date);
+if ~isempty(options_.plot_shock_decomp.plot_init_date)
+ my_initial_date = max(initial_date,options_.plot_shock_decomp.plot_init_date);
+ a = find((initial_date:initial_date+b-1)==options_.plot_shock_decomp.plot_init_date);
end
-if ~isempty(options_.shock_decomp.plot_end_date)
- b = find((initial_date:initial_date+b-1)==options_.shock_decomp.plot_end_date);
+if ~isempty(options_.plot_shock_decomp.plot_end_date)
+ b = find((initial_date:initial_date+b-1)==options_.plot_shock_decomp.plot_end_date);
end
z = z(:,:,a:b);
% end crop data
-options_.shock_decomp.fig_names=fig_names;
+options_.plot_shock_decomp.fig_name=fig_name;
+options_.plot_shock_decomp.orig_varlist = varlist;
if detail_plot,
graph_decomp_detail(z,shock_names,M_.endo_names,i_var,my_initial_date,M_,options_)
else
@@ -337,5 +347,5 @@ else
end
if write_xls
- WriteShockDecomp2Excel(z,shock_names,M_.endo_names,i_var,initial_date,M_,options_,options_.shock_decomp);
-end
\ No newline at end of file
+ WriteShockDecomp2Excel(z,shock_names,M_.endo_names,i_var,initial_date,M_,options_,options_.plot_shock_decomp);
+end
diff --git a/matlab/pm3_core.m b/matlab/pm3_core.m
index c2d248f76..32052f83c 100644
--- a/matlab/pm3_core.m
+++ b/matlab/pm3_core.m
@@ -13,7 +13,7 @@ function myoutput=pm3_core(myinputs,fpar,nvar,whoiam, ThisMatlab)
% SPECIAL REQUIREMENTS.
% None.
-% Copyright (C) 2007-2016 Dynare Team
+% Copyright (C) 2007-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -64,7 +64,7 @@ end
figunumber = 0;
subplotnum = 0;
-hh = dyn_figure(options_,'Name',[tit1 ' ' int2str(figunumber+1)]);
+hh = dyn_figure(options_.nodisplay,'Name',[tit1 ' ' int2str(figunumber+1)]);
RemoteFlag = 0;
if whoiam,
if Parallel(ThisMatlab).Local ==0
@@ -108,14 +108,14 @@ for i=fpar:nvar
end
if subplotnum == MaxNumberOfPlotsPerFigure || i == nvar
- dyn_saveas(hh,[M_.dname '/Output/' M_.fname '_' name3 '_' deblank(tit3(i,:))],options_);
+ dyn_saveas(hh,[M_.dname '/Output/' M_.fname '_' name3 '_' deblank(tit3(i,:))],options_.nodisplay,options_.graph_format);
if RemoteFlag==1,
OutputFileName = [OutputFileName; {[M_.dname, filesep, 'Output',filesep], [M_.fname '_' name3 '_' deblank(tit3(i,:)) '.*']}];
end
subplotnum = 0;
figunumber = figunumber+1;
if (i ~= nvar)
- hh = dyn_figure(options_,'Name',[name3 ' ' int2str(figunumber+1)]);
+ hh = dyn_figure(options_.nodisplay,'Name',[name3 ' ' int2str(figunumber+1)]);
end
end
diff --git a/matlab/realtime_shock_decomposition.m b/matlab/realtime_shock_decomposition.m
index 96d72bf18..2e47066e1 100644
--- a/matlab/realtime_shock_decomposition.m
+++ b/matlab/realtime_shock_decomposition.m
@@ -105,8 +105,7 @@ end
for j=presample+1:nobs,
% evalin('base',['options_.nobs=' int2str(j) ';'])
options_.nobs=j;
- clear('evaluate_smoother');
- [oo, junk1, junk2, junk3, Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_);
+ [oo, M_, junk2, junk3, Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_);
% reduced form
dr = oo.dr;
@@ -139,11 +138,10 @@ for j=presample+1:nobs,
epsilon=[epsilon zeros(nshocks,forecast_)];
z = zeros(endo_nbr,nshocks+2,gend+forecast_);
- Smoothed_Variables_deviation_from_mean
+
z(:,end,1:gend) = Smoothed_Variables_deviation_from_mean;
maximum_lag = M_.maximum_lag;
- lead_lag_incidence = M_.lead_lag_incidence;
k2 = dr.kstate(find(dr.kstate(:,2) <= maximum_lag+1),[1 2]);
i_state = order_var(k2(:,1))+(min(i,maximum_lag)+1-k2(:,2))*M_.endo_nbr;
@@ -229,6 +227,18 @@ for j=presample+1:nobs,
oo_.realtime_conditional_shock_decomposition.(['time_' int2str(j-forecast_)])(:,end,:) = ...
zreal(:,end,j-forecast_:j);
+ if j==nobs
+ for my_forecast_=(forecast_-1):-1:1,
+ oo_.realtime_conditional_shock_decomposition.(['time_' int2str(j-my_forecast_)]) = ...
+ zreal(:,:,j-my_forecast_:j) - ...
+ oo_.realtime_forecast_shock_decomposition.(['time_' int2str(j-my_forecast_)])(:,:,1:my_forecast_+1);
+ oo_.realtime_conditional_shock_decomposition.(['time_' int2str(j-my_forecast_)])(:,end-1,:) = ...
+ oo_.realtime_forecast_shock_decomposition.(['time_' int2str(j-my_forecast_)])(:,end,1:my_forecast_+1);
+ oo_.realtime_conditional_shock_decomposition.(['time_' int2str(j-my_forecast_)])(:,end,:) = ...
+ zreal(:,end,j-my_forecast_:j);
+ end
+ end
+
end
end
@@ -248,5 +258,4 @@ if forecast_
oo_.realtime_forecast_shock_decomposition.pool = zfrcst;
end
-clear('evaluate_smoother');
skipline()
diff --git a/matlab/rplot.m b/matlab/rplot.m
index 5705abdc1..5f1901894 100644
--- a/matlab/rplot.m
+++ b/matlab/rplot.m
@@ -14,7 +14,7 @@ function rplot(s1)
% SPECIAL REQUIREMENTS
% none
-% Copyright (C) 2001-2016 Dynare Team
+% Copyright (C) 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -81,7 +81,7 @@ if rplottype == 0
for j = 1:size(y,1)
t = [t s1(j,:) ' '] ;
end
- hh=dyn_figure(options_,'Name',['Simulated Trajectory']);
+ hh=dyn_figure(options_.nodisplay,'Name',['Simulated Trajectory']);
plot(ix(i),y(:,i)) ;
title (t,'Interpreter','none') ;
xlabel('Periods') ;
@@ -94,24 +94,24 @@ if rplottype == 0
set(h, 'Interpreter', 'none');
end
end
- dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' deblank(s1(1,:))],options_)
+ dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' deblank(s1(1,:))],options_.nodisplay,options_.graph_format)
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
create_TeX_loader(fidTeX,options_,[M_.fname, '/graphs/', 'SimulatedTrajectory_' deblank(s1(1,:))],'Simulated trajectories','SimulatedTrajectory_',deblank(s1(1,:)),1)
end
elseif rplottype == 1
for j = 1:size(y,1)
- hh=dyn_figure(options_,'Name',['Simulated Trajectory']);
+ hh=dyn_figure(options_.nodisplay,'Name',['Simulated Trajectory']);
plot(ix(i),y(j,i)) ;
xlim([min(ix(i)) max(ix(i))])
title(['Plot of ' s1(j,:)],'Interpreter','none') ;
xlabel('Periods') ;
- dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' deblank(s1(j,:))],options_)
+ dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' deblank(s1(j,:))],options_.nodisplay,options_.graph_format)
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
create_TeX_loader(fidTeX,options_,[M_.fname, '/graphs/', 'SimulatedTrajectory_' deblank(s1(j,:))],'Simulated trajectories','SimulatedTrajectory_',deblank(s1(j,:)),1);
end
end
elseif rplottype == 2
- hh=dyn_figure(options_,'Name',['Simulated Trajectory']);
+ hh=dyn_figure(options_.nodisplay,'Name',['Simulated Trajectory']);
nl = max(1,fix(size(y,1)/4)) ;
nc = ceil(size(y,1)/nl) ;
for j = 1:size(y,1)
@@ -128,7 +128,7 @@ elseif rplottype == 2
title(['Plot of ' s1(j,:)],'Interpreter','none') ;
axis tight;
end
- dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' deblank(s1(1,:))],options_)
+ dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' deblank(s1(1,:))],options_.nodisplay,options_.graph_format)
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
create_TeX_loader(fidTeX,options_,[M_.fname, '/graphs/', 'SimulatedTrajectory_' deblank(s1(1,:))],'Simulated trajectories','SimulatedTrajectory_',deblank(s1(1,:)),min(j/nc,1));
end
diff --git a/matlab/selec_posterior_draws.m b/matlab/selec_posterior_draws.m
index d89baf6cf..b0a7cac4c 100644
--- a/matlab/selec_posterior_draws.m
+++ b/matlab/selec_posterior_draws.m
@@ -100,6 +100,8 @@ SampleAddress = sortrows(SampleAddress,[3 2]);
% Selected draws in the posterior distribution, and if drsize>0
% reduced form solutions, are saved on disk.
if info
+ %delete old stale files before creating new ones
+ delete_stale_file([BaseName '_posterior_draws*.mat'])
if SampleSize*drawsize <= MAX_mega_bytes% The posterior draws are saved in one file.
pdraws = cell(SampleSize,info);
old_mhfile = 0;
diff --git a/matlab/select_qz_criterium_value.m b/matlab/select_qz_criterium_value.m
index 09282747e..26fc47572 100644
--- a/matlab/select_qz_criterium_value.m
+++ b/matlab/select_qz_criterium_value.m
@@ -36,21 +36,40 @@ function options_=select_qz_criterium_value(options_)
% set by default options_.qz_criterium to 1+1e-6
stack = dbstack;
-if isequal(options_.lik_init,1)
- if isempty(options_.qz_criterium)
- options_.qz_criterium = 1-1e-6;
- elseif options_.qz_criterium > 1-eps
- error([stack(2).file ': option qz_criterium is too large for estimating/smoothing ' ...
- 'a stationary model. If your model contains unit roots, use ' ...
- 'option diffuse_filter'])
- end
-else
- if isempty(options_.qz_criterium)
- options_.qz_criterium = 1+1e-6;
- else
- if options_.qz_criterium <= 1
- fprintf('\n%s:: diffuse filter is incompatible with a qz_criterium<=1. Resetting it to 1+1e-6.\n',stack(2).file)
+if options_.particle.status
+ % Non linear filter
+ if isequal(options_.particle.initialization, 3)
+ if isempty(options_.qz_criterium)
options_.qz_criterium = 1+1e-6;
+ else
+ if options_.qz_criterium <= 1
+ fprintf('\n%s:: You set nonlinear_filter_initialization equal to 3, it is assumed that you try to estimate a non stationary model. Resetting it to 1+1e-6.\n', stack(2).file)
+ options_.qz_criterium = 1+1e-6;
+ end
+ end
+ else
+ if isempty(options_.qz_criterium)
+ options_.qz_criterium = 1-1e-6;
end
end
-end
+else
+ % Linear filter
+ if isequal(options_.lik_init,1)
+ if isempty(options_.qz_criterium)
+ options_.qz_criterium = 1-1e-6;
+ elseif options_.qz_criterium > 1-eps
+ error([stack(2).file ': option qz_criterium is too large for estimating/smoothing ' ...
+ 'a stationary model. If your model contains unit roots, use ' ...
+ 'option diffuse_filter'])
+ end
+ else
+ if isempty(options_.qz_criterium)
+ options_.qz_criterium = 1+1e-6;
+ else
+ if options_.qz_criterium <= 1
+ fprintf('\n%s:: diffuse filter is incompatible with a qz_criterium<=1. Resetting it to 1+1e-6.\n',stack(2).file)
+ options_.qz_criterium = 1+1e-6;
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/matlab/set_default_initial_condition_decomposition_options.m b/matlab/set_default_initial_condition_decomposition_options.m
new file mode 100644
index 000000000..07c84d3e6
--- /dev/null
+++ b/matlab/set_default_initial_condition_decomposition_options.m
@@ -0,0 +1,37 @@
+function options = set_default_initial_condition_decomposition_options(options)
+%function options = set_default_initial_condition_decomposition_options(options)
+% sets the default options for prior_shock_decomposition
+%
+% INPUTS
+% options
+%
+% OUTPUTS
+% options
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2017 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 .
+
+options.initial_condition_decomp.detail_plot = 0;
+options.initial_condition_decomp.steadystate = 0;
+options.initial_condition_decomp.write_xls = 0;
+options.initial_condition_decomp.type = '';
+options.initial_condition_decomp.plot_init_date = [];
+options.initial_condition_decomp.plot_end_date = [];
+end
diff --git a/matlab/set_default_plot_shock_decomposition_options.m b/matlab/set_default_plot_shock_decomposition_options.m
new file mode 100644
index 000000000..327c047cb
--- /dev/null
+++ b/matlab/set_default_plot_shock_decomposition_options.m
@@ -0,0 +1,51 @@
+function options = set_default_plot_shock_decomposition_options(options)
+%function options = set_default_plot_shock_decomposition_options(options)
+% sets the default options for prior_shock_decomposition
+%
+% INPUTS
+% options
+%
+% OUTPUTS
+% options
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2017 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 .
+
+options.plot_shock_decomp.use_shock_groups = '';
+options.plot_shock_decomp.colormap = '';
+options.plot_shock_decomp.nodisplay = 0;
+options.plot_shock_decomp.graph_format = 'eps';
+options.plot_shock_decomp.detail_plot = 0;
+options.plot_shock_decomp.interactive = 0;
+options.plot_shock_decomp.screen_shocks = 0;
+options.plot_shock_decomp.steadystate = 0;
+options.plot_shock_decomp.type = '';
+options.plot_shock_decomp.fig_name = '';
+options.plot_shock_decomp.write_xls = 0;
+options.plot_shock_decomp.realtime = 0; % 0 is standard; 1 is realtime
+ % (pool/vintage); 2 is conditional
+ % (pool/vintage); 3 is forecast
+ % (pool/vintage)
+options.plot_shock_decomp.vintage = 0; % 0 pool realtime/conditional; int:
+ % forecast/conditional shock
+ % decompositions
+options.plot_shock_decomp.plot_init_date = [];
+options.plot_shock_decomp.plot_end_date = [];
+end
diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m
index 1314c3a63..d187a45a5 100644
--- a/matlab/stoch_simul.m
+++ b/matlab/stoch_simul.m
@@ -1,6 +1,6 @@
function info=stoch_simul(var_list)
-% Copyright (C) 2001-2016 Dynare Team
+% Copyright (C) 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -253,10 +253,10 @@ if options_.irf
if nbplt == 0
elseif nbplt == 1
if options_.relative_irf
- hh = dyn_figure(options_,'Name',['Relative response to' ...
+ hh = dyn_figure(options_.nodisplay,'Name',['Relative response to' ...
' orthogonalized shock to ' tit(i,:)]);
else
- hh = dyn_figure(options_,'Name',['Orthogonalized shock to' ...
+ hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to' ...
' ' tit(i,:)]);
end
for j = 1:number_of_plots_to_draw
@@ -269,7 +269,7 @@ if options_.irf
remove_fractional_xticks;
title(deblank(mylist(j,:)),'Interpreter','none');
end
- dyn_saveas(hh,[M_.fname '_IRF_' deblank(tit(i,:))],options_);
+ dyn_saveas(hh,[M_.fname '_IRF_' deblank(tit(i,:))],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for j = 1:number_of_plots_to_draw
@@ -285,10 +285,10 @@ if options_.irf
else
for fig = 1:nbplt-1
if options_.relative_irf
- hh = dyn_figure(options_,'Name',['Relative response to orthogonalized shock' ...
+ hh = dyn_figure(options_.nodisplay,'Name',['Relative response to orthogonalized shock' ...
' to ' tit(i,:) ' figure ' int2str(fig)]);
else
- hh = dyn_figure(options_,'Name',['Orthogonalized shock to ' tit(i,:) ...
+ hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit(i,:) ...
' figure ' int2str(fig)]);
end
for plt = 1:nstar
@@ -301,7 +301,7 @@ if options_.irf
remove_fractional_xticks
title(deblank(mylist((fig-1)*nstar+plt,:)),'Interpreter','none');
end
- dyn_saveas(hh,[ M_.fname '_IRF_' deblank(tit(i,:)) int2str(fig)],options_);
+ dyn_saveas(hh,[ M_.fname '_IRF_' deblank(tit(i,:)) int2str(fig)],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for j = 1:nstar
@@ -321,7 +321,7 @@ if options_.irf
fprintf(fidTeX,' \n');
end
end
- hh = dyn_figure(options_,'Name',['Orthogonalized shock to ' tit(i,:) ' figure ' int2str(nbplt) '.']);
+ hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit(i,:) ' figure ' int2str(nbplt) '.']);
m = 0;
for plt = 1:number_of_plots_to_draw-(nbplt-1)*nstar;
m = m+1;
@@ -334,7 +334,7 @@ if options_.irf
remove_fractional_xticks
title(deblank(mylist((nbplt-1)*nstar+plt,:)),'Interpreter','none');
end
- dyn_saveas(hh,[ M_.fname '_IRF_' deblank(tit(i,:)) int2str(nbplt) ],options_);
+ dyn_saveas(hh,[ M_.fname '_IRF_' deblank(tit(i,:)) int2str(nbplt) ],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for j = 1:m
diff --git a/matlab/trace_plot.m b/matlab/trace_plot.m
index 1073480d6..c07e4707b 100644
--- a/matlab/trace_plot.m
+++ b/matlab/trace_plot.m
@@ -18,7 +18,7 @@ function trace_plot(options_,M_,estim_params_,type,blck,name1,name2)
%
% SPECIAL REQUIREMENTS
-% Copyright (C) 2003-2016 Dynare Team
+% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%
@@ -95,7 +95,7 @@ if options_.mh_nblck>1
FigureName = [ FigureName , ' (block number ' int2str(blck) ').'];
end
-hh=dyn_figure(options_,'Name',FigureName);
+hh=dyn_figure(options_.nodisplay,'Name',FigureName);
plot(1:TotalNumberOfMhDraws,PosteriorDraws,'Color',[.7 .7 .7]);
@@ -131,7 +131,7 @@ else
end
plot_name=[plot_name,'_blck_',num2str(blck)];
-dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'TracePlot_' plot_name],options_)
+dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'TracePlot_' plot_name],options_.nodisplay,options_.graph_format)
if options_.TeX
fid=fopen([M_.fname,'/graphs/',M_.fname,'_TracePlot_' plot_name,'.tex'],'w+');
diff --git a/mex/sources/bytecode/ErrorHandling.hh b/mex/sources/bytecode/ErrorHandling.hh
index 760d0ec7c..39fc01ec3 100644
--- a/mex/sources/bytecode/ErrorHandling.hh
+++ b/mex/sources/bytecode/ErrorHandling.hh
@@ -24,8 +24,20 @@
#include
#include
#include