Skip to content
Snippets Groups Projects
Commit da26dbc4 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Merge branch 'OccBin_posterior' into 'master'

:bug: OccBin: disable incompatible options

See merge request Dynare/dynare!2352
parents 2a8abf49 10383f45
No related branches found
No related tags found
No related merge requests found
...@@ -7718,7 +7718,7 @@ observed variables. ...@@ -7718,7 +7718,7 @@ observed variables.
Triggers the computation of the posterior distribution of Triggers the computation of the posterior distribution of
IRFs. The length of the IRFs are controlled by the ``irf`` IRFs. The length of the IRFs are controlled by the ``irf``
option. Results are stored in ``oo_.PosteriorIRF.dsge`` (see option. Results are stored in ``oo_.PosteriorIRF.dsge`` (see
below for a description of this variable). below for a description of this variable). Not compatible with OccBin.
   
.. option:: relative_irf .. option:: relative_irf
   
...@@ -8066,7 +8066,7 @@ observed variables. ...@@ -8066,7 +8066,7 @@ observed variables.
stored in ``oo_.PosteriorTheoreticalMoments`` (see stored in ``oo_.PosteriorTheoreticalMoments`` (see
:mvar:`oo_.PosteriorTheoreticalMoments`). The number of lags in :mvar:`oo_.PosteriorTheoreticalMoments`). The number of lags in
the autocorrelation function is controlled by the ``ar`` the autocorrelation function is controlled by the ``ar``
option. option. Not compatible with OccBin.
   
.. option:: contemporaneous_correlation .. option:: contemporaneous_correlation
   
...@@ -8151,7 +8151,7 @@ observed variables. ...@@ -8151,7 +8151,7 @@ observed variables.
the posterior mode. If a Metropolis-Hastings is computed, the the posterior mode. If a Metropolis-Hastings is computed, the
distribution of forecasts is stored in variables distribution of forecasts is stored in variables
``oo_.PointForecast`` and ``oo_.MeanForecast``. See ``oo_.PointForecast`` and ``oo_.MeanForecast``. See
:ref:`fore`, for a description of these variables. :ref:`fore`, for a description of these variables. Not compatible with OccBin.
   
.. option:: tex .. option:: tex
   
......
...@@ -520,8 +520,12 @@ if issmc(options_) || (any(bayestopt_.pshape>0) && options_.mh_replic) || (any( ...@@ -520,8 +520,12 @@ if issmc(options_) || (any(bayestopt_.pshape>0) && options_.mh_replic) || (any(
if error_flag if error_flag
error('%s: I cannot compute the posterior IRFs!',dispString) error('%s: I cannot compute the posterior IRFs!',dispString)
end end
if options_.occbin.likelihood.status
fprintf('%s: the bayesian_irf option is not compatible with the use of OccBin.',dispString)
else
oo_=PosteriorIRF('posterior',options_,estim_params_,oo_,M_,bayestopt_,dataset_,dataset_info,dispString); oo_=PosteriorIRF('posterior',options_,estim_params_,oo_,M_,bayestopt_,dataset_,dataset_info,dispString);
end end
end
if options_.moments_varendo if options_.moments_varendo
if error_flag if error_flag
error('%s: I cannot compute the posterior moments for the endogenous variables!',dispString) error('%s: I cannot compute the posterior moments for the endogenous variables!',dispString)
...@@ -549,8 +553,12 @@ if issmc(options_) || (any(bayestopt_.pshape>0) && options_.mh_replic) || (any( ...@@ -549,8 +553,12 @@ if issmc(options_) || (any(bayestopt_.pshape>0) && options_.mh_replic) || (any(
end end
end end
end end
if options_.occbin.likelihood.status
fprintf('%s: the moments_varendo option is not compatible with the use of OccBin.',dispString)
else
oo_ = compute_moments_varendo('posterior',options_,M_,oo_,estim_params_,var_list_); oo_ = compute_moments_varendo('posterior',options_,M_,oo_,estim_params_,var_list_);
end end
end
if options_.smoother || ~isempty(options_.filter_step_ahead) || options_.forecast if options_.smoother || ~isempty(options_.filter_step_ahead) || options_.forecast
if error_flag if error_flag
error('%s: I cannot compute the posterior statistics!',dispString) error('%s: I cannot compute the posterior statistics!',dispString)
......
...@@ -86,6 +86,15 @@ if options_.occbin.likelihood.status || options_.occbin.smoother.status ...@@ -86,6 +86,15 @@ if options_.occbin.likelihood.status || options_.occbin.smoother.status
if options_.fast_kalman_filter if options_.fast_kalman_filter
error('initial_estimation_checks:: Occbin is incompatible with the fast Kalman filter.') error('initial_estimation_checks:: Occbin is incompatible with the fast Kalman filter.')
end end
if options_.bayesian_irf
error('initial_estimation_checks:: Occbin is incompatible with the bayesian_irf option.')
end
if options_.moments_varendo
error('initial_estimation_checks:: Occbin is incompatible with the moments_varendo option.')
end
if options_.forecast
error('initial_estimation_checks:: Occbin is incompatible with the forecast option.')
end
end end
if (options_.occbin.likelihood.status && options_.occbin.likelihood.inversion_filter) || (options_.occbin.smoother.status && options_.occbin.smoother.inversion_filter) if (options_.occbin.likelihood.status && options_.occbin.likelihood.inversion_filter) || (options_.occbin.smoother.status && options_.occbin.smoother.inversion_filter)
......
...@@ -76,7 +76,7 @@ naK=myinputs.naK; ...@@ -76,7 +76,7 @@ naK=myinputs.naK;
horizon=myinputs.horizon; horizon=myinputs.horizon;
iendo=myinputs.iendo; iendo=myinputs.iendo;
IdObs=myinputs.IdObs; %index of observables IdObs=myinputs.IdObs; %index of observables
if horizon if horizon && ~options_.occbin.smoother.status
i_last_obs=myinputs.i_last_obs; i_last_obs=myinputs.i_last_obs;
MAX_nforc1=myinputs.MAX_nforc1; MAX_nforc1=myinputs.MAX_nforc1;
MAX_nforc2=myinputs.MAX_nforc2; MAX_nforc2=myinputs.MAX_nforc2;
...@@ -168,7 +168,7 @@ if run_smoother ...@@ -168,7 +168,7 @@ if run_smoother
stock_smoothed_constant=NaN(endo_nbr,gend,MAX_n_smoothed_constant); stock_smoothed_constant=NaN(endo_nbr,gend,MAX_n_smoothed_constant);
stock_smoothed_trend=NaN(endo_nbr,gend,MAX_n_smoothed_trend); stock_smoothed_trend=NaN(endo_nbr,gend,MAX_n_smoothed_trend);
stock_trend_coeff = zeros(endo_nbr,MAX_n_trend_coeff); stock_trend_coeff = zeros(endo_nbr,MAX_n_trend_coeff);
if horizon if horizon && ~options_.occbin.smoother.status
stock_forcst_mean= NaN(endo_nbr,horizon,MAX_nforc1); stock_forcst_mean= NaN(endo_nbr,horizon,MAX_nforc1);
stock_forcst_point = NaN(endo_nbr,horizon,MAX_nforc2); stock_forcst_point = NaN(endo_nbr,horizon,MAX_nforc2);
if ~isequal(M_.H,0) if ~isequal(M_.H,0)
...@@ -328,7 +328,7 @@ for b=fpar:B ...@@ -328,7 +328,7 @@ for b=fpar:B
end end
end end
end end
if horizon if horizon && ~options_.occbin.smoother.status
yyyy = alphahat(iendo,i_last_obs); yyyy = alphahat(iendo,i_last_obs);
yf = simulate_posterior_forecasts(yyyy,dr,horizon,false,M_.Sigma_e,1); yf = simulate_posterior_forecasts(yyyy,dr,horizon,false,M_.Sigma_e,1);
if options_.prefilter if options_.prefilter
...@@ -563,7 +563,7 @@ dyn_waitbar_close(h); ...@@ -563,7 +563,7 @@ dyn_waitbar_close(h);
function yf=simulate_posterior_forecasts(y0,dr,horizon,stochastic_indicator,Sigma_e,n) function yf=simulate_posterior_forecasts(y0,dr,horizon,stochastic_indicator,Sigma_e,n)
% function yf=forcst2(y0,horizon,dr,n) % function yf=simulate_posterior_forecasts(y0,horizon,dr,n)
% %
% computes forecasts based on first order model solution, given shocks % computes forecasts based on first order model solution, given shocks
% drawn from the shock distribution, but not including measurement error % drawn from the shock distribution, but not including measurement error
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment