Skip to content
Snippets Groups Projects
Commit db286c1a authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

:bug: forecast and smoothing: disallow unsupported options

parent 1bd5eb6c
Branches
No related tags found
No related merge requests found
......@@ -54,6 +54,16 @@ elseif nargin==6
mean_varobs=dataset_info.descriptive.mean';
end
if options_.order>1 && M_.exo_det_nbr == 0
error('forecasting without varexo_det does not support order>1.')
end
if options_.order>2 && M_.exo_det_nbr > 0
error('forecasting with varexo_det does not support order>2.')
end
if options_.order==2 && options_.pruning
error('forecasting with varexo_det does not support pruning.')
end
oo_=make_ex_(M_,options_,oo_);
maximum_lag = M_.maximum_lag;
......
......@@ -12,7 +12,7 @@ function dynare_estimation_1(var_list_,dname)
% SPECIAL REQUIREMENTS
% none
% Copyright © 2003-2023 Dynare Team
% Copyright © 2003-2024 Dynare Team
%
% This file is part of Dynare.
%
......@@ -582,12 +582,25 @@ if options_.particle.status
end
%Run and store classical smoother if needed
if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.pshape> 0) && options_.load_mh_file)) ...
|| ~options_.smoother ) && ~options_.partial_information % to be fixed
if options_.smoother && ... %Bayesian smoother requested before
(any(bayestopt_.pshape > 0) && options_.mh_replic || ... % Bayesian with MCMC run
any(bayestopt_.pshape > 0) && options_.load_mh_file) % Bayesian with loaded MCMC
% nothing to do
elseif options_.partial_information ||...
options_.order>1 %no particle smoother
% smoothing not yet supported
else
%% ML estimation, or posterior mode without Metropolis-Hastings or Metropolis without Bayesian smoothed variables
oo_=save_display_classical_smoother_results(xparam1,M_,oo_,options_,bayestopt_,dataset_,dataset_info,estim_params_);
end
if options_.forecast > 0 && options_.mh_replic == 0 && ~options_.load_mh_file
if options_.forecast == 0 || options_.mh_replic > 0 || options_.load_mh_file
% nothing to do
elseif options_.order>1 && M_.exo_det_nbr == 0 || ...
options_.order>2 && M_.exo_det_nbr > 0 || ...
options_.order==2 && options_.pruning
%forecasting not yet supported
else
oo_.forecast = dyn_forecast(var_list_,M_,options_,oo_,'smoother',dataset_info);
end
......
......@@ -22,7 +22,7 @@ function [yf,int_width,int_width_ME]=forcst(dr,y0,horizon,var_list,M_,oo_,option
% SPECIAL REQUIREMENTS
% none
% Copyright © 2003-2019 Dynare Team
% Copyright © 2003-2024 Dynare Team
%
% This file is part of Dynare.
%
......@@ -39,6 +39,10 @@ function [yf,int_width,int_width_ME]=forcst(dr,y0,horizon,var_list,M_,oo_,option
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
if options_.order>1
error('forcst.m: Only order=1 is supported. Skipping computuations.')
end
yf = simult_(M_,options_,y0,dr,zeros(horizon,M_.exo_nbr),1);
nstatic = M_.nstatic;
nspred = M_.nspred;
......
function [y_,int_width,int_width_ME]=simultxdet(y0,ex,ex_det, iorder,var_list,M_,oo_,options_)
%function [y_,int_width]=simultxdet(y0,ex,ex_det, iorder,var_list,M_,oo_,options_)
%function [y_,int_width,int_width_ME]=simultxdet(y0,ex,ex_det, iorder,var_list,M_,oo_,options_)
%
% Simulates a stochastic model in the presence of deterministic exogenous shocks
%
......@@ -39,6 +39,11 @@ function [y_,int_width,int_width_ME]=simultxdet(y0,ex,ex_det, iorder,var_list,M_
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
if options_.order>2
error('simultxdet.m: Forecasting with varexo_det does not support order>2.')
elseif options_.order==2 && options_.pruning
error('simultxdet.m: Forecasting with varexo_det does not support pruning.')
end
dr = oo_.dr;
ykmin = M_.maximum_lag;
endo_nbr = M_.endo_nbr;
......@@ -50,7 +55,6 @@ iter = size(ex,1);
if size(ex_det, 1) ~= iter+ykmin
error('Size mismatch: number of forecasting periods for stochastic exogenous and deterministic exogenous don''t match')
end
nx = size(dr.ghu,2);
y_ = zeros(size(y0,1),iter+ykmin);
y_(:,1:ykmin) = y0;
k1 = ykmin:-1:1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment