diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst index f1b2312d49e8380d026e8d98e9cd4daef2cb7ee3..fa0e2c0661c1cefa6b3bac4b767c1cb9827963ca 100644 --- a/doc/manual/source/the-model-file.rst +++ b/doc/manual/source/the-model-file.rst @@ -4956,7 +4956,8 @@ block decomposition of the model (see :opt:`block`). computed on the variables listed after the ``estimation`` command. Alternatively, one can choose to compute these quantities on all endogenous or on all observed variables (see - ``consider_all_endogenous`` and ``consider_only_observed`` options + ``consider_all_endogenous``, ``consider_all_endogenous_and_auxiliary``, + and ``consider_only_observed`` options below). If no variable is listed after the estimation command, then Dynare will interactively ask which variable set to use. @@ -6756,6 +6757,14 @@ block decomposition of the model (see :opt:`block`). endogenous variables. This is equivalent to manually listing all the endogenous variables after the ``estimation`` command. + .. option:: consider_all_endogenous_and_auxiliary + + Compute the posterior moments, smoothed variables, k-step ahead + filtered variables and forecasts (when requested) on all the + endogenous variables and the auxiliary variables introduced by the + preprocessor. This option is useful when e.g. running ``smoother2histval`` + on the results of the Kalman smoother. + .. option:: consider_only_observed Compute the posterior moments, smoothed variables, k-step ahead diff --git a/matlab/check_list_of_variables.m b/matlab/check_list_of_variables.m index d5f4b449b205e5c05aaf005f66368d3c942dd3a5..e2b1009c4015d328e11381217e005e81e900be35 100644 --- a/matlab/check_list_of_variables.m +++ b/matlab/check_list_of_variables.m @@ -59,10 +59,12 @@ if options_.dsge_var && options_.bayesian_irf end if ~isempty(varlist) && ~isempty(options_.endo_vars_for_moment_computations_in_estimation) - error('You cannot use the consider_all_endogenous or consider_all_observed options when listing variables after the estimation command') + error('You cannot use the consider_all_endogenous, consider_all_endogenous_and_auxiliary or consider_all_observed options when listing variables after the estimation command') elseif isempty(varlist) && ~isempty(options_.endo_vars_for_moment_computations_in_estimation) if strcmp(options_.endo_vars_for_moment_computations_in_estimation,'all_endogenous_variables') varlist = M_.endo_names(1:M_.orig_endo_nbr); + elseif strcmp(options_.endo_vars_for_moment_computations_in_estimation,'all_endogenous_and_auxiliary_variables') + varlist = M_.endo_names; elseif strcmp(options_.endo_vars_for_moment_computations_in_estimation,'only_observed_variables') varlist = options_.varobs; else @@ -119,6 +121,7 @@ elseif isempty(varlist) && isempty(options_.endo_vars_for_moment_computations_in disp(' [1] Consider all the endogenous variables.') disp(' [2] Consider all the observed endogenous variables.') disp(' [3] Stop Dynare and change the mod file.') + disp(' [4] Consider all the endogenous and auxiliary variables.') skipline() choice = input('options [default is 1] = '); if isempty(choice) @@ -130,9 +133,11 @@ elseif isempty(varlist) && isempty(options_.endo_vars_for_moment_computations_in varlist = options_.varobs; elseif choice==3 varlist = cell(0); + elseif choice==4 + varlist = M_.endo_names; else skipline() - disp('YOU HAVE TO ANSWER 1, 2 or 3!') + disp('YOU HAVE TO ANSWER 1, 2, 3 or 4!') skipline() end end diff --git a/matlab/smoother2histval.m b/matlab/smoother2histval.m index 84865a1ac8ae53ab5947777aaf861400bae845c8..7e90e41ef316e5b9cbb168aa4c97347a5b857bb4 100644 --- a/matlab/smoother2histval.m +++ b/matlab/smoother2histval.m @@ -78,6 +78,11 @@ end if post_metropolis tmp = fieldnames(smoothedvars.Mean); + if length(tmp)~=M_.endo_nbr + warning(['You are using smoother2histval although smoothed values have not'... + 'been computed for all endogenous and auxiliary variables.'... + 'The value of these variables will be set to 0.']) + end tmpexo = fieldnames(smoothedshocks.Mean); else tmp = fieldnames(smoothedvars); diff --git a/preprocessor b/preprocessor index e1f7d8c73556398a774ab55c8dc578c79ebb6c3b..5da01faa743f8ca27055bc8389c54ec4ba9f5c41 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit e1f7d8c73556398a774ab55c8dc578c79ebb6c3b +Subproject commit 5da01faa743f8ca27055bc8389c54ec4ba9f5c41 diff --git a/tests/smoother2histval/fs2000_smooth.mod b/tests/smoother2histval/fs2000_smooth.mod index 65bb15b68bcd07d5e6f96aafa18657958a09a13d..ca333158876b8b5efe26f08aa831ed60cd9344fe 100644 --- a/tests/smoother2histval/fs2000_smooth.mod +++ b/tests/smoother2histval/fs2000_smooth.mod @@ -82,6 +82,6 @@ varobs gp_obs gy_obs; options_.solve_tolf = 1e-12; -estimation(order=1,datafile=fsdat_simul,mh_replic=1500,mh_nblocks=1,mh_jscale=0.8,smoother,consider_all_endogenous); +estimation(order=1,datafile=fsdat_simul,mh_replic=1500,mh_nblocks=1,mh_jscale=0.8,smoother,consider_all_endogenous_and_auxiliary); smoother2histval(period = 5, outfile = 'fs2000_histval.mat');