diff --git a/matlab/+occbin/solver.m b/matlab/+occbin/solver.m index ec053af49dd643b1f05c8ee91177f0214a088062..d29976f0e2e35a741abfce508d50964a8e0c5587 100644 --- a/matlab/+occbin/solver.m +++ b/matlab/+occbin/solver.m @@ -1,10 +1,10 @@ function [oo_, out, ss] = solver(M_,oo_,options_) -% function [oo_, out, ss] = solver(M_,oo_,options_,opts_simul) +% function [oo_, out, ss] = solver(M_,oo_,options_) % Solves the model with an OBC and produces simulations/IRFs % % INPUT: -% - opts_simul [structure] Occbin simulation options % - M_ [structure] Matlab's structure describing the model +% - oo_ [structure] Matlab's structure containing the results % - options_ [structure] Matlab's structure containing the options % % OUTPUT: diff --git a/matlab/DsgeSmoother.m b/matlab/DsgeSmoother.m index e6942561c35c3cfdeb44709ec652ea4848449f40..722b80959da728b4fb517f0d53f9058e53d7a7ba 100644 --- a/matlab/DsgeSmoother.m +++ b/matlab/DsgeSmoother.m @@ -423,13 +423,14 @@ else tmp(oo_.dr.restrict_var_list,1)=aahat(:,k-1); opts_simul.endo_init = tmp(oo_.dr.inv_order_var,1); opts_simul.init_regime = []; %regimes_(k); + opts_simul.waitbar=0; options_.occbin.simul=opts_simul; [~, out] = occbin.solver(M_,oo_,options_); % regime in out should be identical to regimes_(k-2) moved one % period ahead (so if regimestart was [1 5] it should be [1 4] % in out % end - bbb(oo_.dr.inv_order_var,k) = out.zpiece(1,:); + bbb(oo_.dr.inv_order_var,k) = out.piecewise(1,:); end end % do not overwrite accurate computations using reduced st. space @@ -466,6 +467,7 @@ else tmp(oo_.dr.restrict_var_list,1)=ahat0(:,k-1); opts_simul.endo_init = tmp(oo_.dr.inv_order_var,1); opts_simul.init_regime = []; %regimes_(k); + opts_simul.waitbar=0; options_.occbin.simul=opts_simul; [~, out] = occbin.solver(M_,oo_,options_); % regime in out should be identical to regimes_(k-2) moved one @@ -473,7 +475,7 @@ else % in out % end for jnk=1:options_.nk - aaa(jnk,oo_.dr.inv_order_var,k+jnk-1) = out.zpiece(jnk,:); + aaa(jnk,oo_.dr.inv_order_var,k+jnk-1) = out.piecewise(jnk,:); end end aK=aaa; @@ -525,6 +527,9 @@ else end ahat1=aaa; % reconstruct aK + if isempty(options_.nk) + options_.nk=1; + end aaa = zeros(options_.nk,M_.endo_nbr,gend+options_.nk); aaa(:,oo_.dr.restrict_var_list,:)=aK; for k=1:gend diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m index 3cdd4c097ea47997ebba010eca4e26f00c55139e..5f0af2dbdfdc5e2ccb834144031ccb64b9b05e63 100644 --- a/matlab/dynare_estimation_init.m +++ b/matlab/dynare_estimation_init.m @@ -671,12 +671,14 @@ if options_.heteroskedastic_filter for k=1:length(M_.heteroskedastic_shocks.Qvalue_orig) v = M_.heteroskedastic_shocks.Qvalue_orig(k); - temp_periods=v.periods(v.periods<=options_.nobs+options_.first_obs); + temp_periods=v.periods(v.periods<options_.nobs+options_.first_obs); + temp_periods=temp_periods(temp_periods>=options_.first_obs); M_.heteroskedastic_shocks.Qvalue(v.exo_id, temp_periods-(options_.first_obs-1)) = v.value^2; end for k=1:length(M_.heteroskedastic_shocks.Qscale_orig) v = M_.heteroskedastic_shocks.Qscale_orig(k); - temp_periods=v.periods(v.periods<=options_.nobs+options_.first_obs); + temp_periods=v.periods(v.periods<options_.nobs+options_.first_obs); + temp_periods=temp_periods(temp_periods>=options_.first_obs); M_.heteroskedastic_shocks.Qscale(v.exo_id, temp_periods-(options_.first_obs-1)) = v.scale^2; end diff --git a/matlab/missing_DiffuseKalmanSmootherH3_Z.m b/matlab/missing_DiffuseKalmanSmootherH3_Z.m index 3f9850297a728bbd9703bc4c51ec9b379e6bc04d..a4d8e7e971cdab18337e7d401bb632710b954e9b 100644 --- a/matlab/missing_DiffuseKalmanSmootherH3_Z.m +++ b/matlab/missing_DiffuseKalmanSmootherH3_Z.m @@ -444,6 +444,7 @@ while notsteady && t<smpl opts_simul.endo_init = a(oo_.dr.inv_order_var,t); end opts_simul.init_regime = []; %regimes_(t); + opts_simul.waitbar=0; options_.occbin.simul=opts_simul; [~, out, ss] = occbin.solver(M_,oo_,options_); end @@ -456,9 +457,9 @@ while notsteady && t<smpl end if isoccbin if smoother_redux - aK(jnk,:,t+jnk) = out.zpiece(jnk,oo_.dr.order_var(oo_.dr.restrict_var_list)); + aK(jnk,:,t+jnk) = out.piecewise(jnk,oo_.dr.order_var(oo_.dr.restrict_var_list)); else - aK(jnk,oo_.dr.inv_order_var,t+jnk) = out.zpiece(jnk,:); + aK(jnk,oo_.dr.inv_order_var,t+jnk) = out.piecewise(jnk,:); end elseif jnk>1 aK(jnk,:,t+jnk) = T*dynare_squeeze(aK(jnk-1,:,t+jnk-1)); diff --git a/matlab/prior_posterior_statistics_core.m b/matlab/prior_posterior_statistics_core.m index 38862e06c7f5a25988b0a68b2f1f3123c3d1f819..c6264ed4b0438be7c9c7edcdc1d6c35a4b186b92 100644 --- a/matlab/prior_posterior_statistics_core.m +++ b/matlab/prior_posterior_statistics_core.m @@ -224,6 +224,8 @@ for b=fpar:B fprintf('prior_posterior_statistics: This should not happen. Please contact the developers.\n',message) end if options_.occbin.smoother.status + opts_local.occbin.simul.waitbar=0; + opts_local.occbin.smoother.waitbar = 0; [alphahat,etahat,epsilonhat,alphatilde,SteadyState,trend_coeff,aK,~,~,P,~,~,trend_addition,state_uncertainty,M_,oo_,bayestopt_] = ... occbin.DSGE_smoother(deep,gend,Y,data_index,missing_value,M_,oo_,opts_local,bayestopt_,estim_params_); else diff --git a/matlab/varlist_indices.m b/matlab/varlist_indices.m index c28c00fc6288d07bf2f1c139a7434b547c0a7d3e..0e67afb51416561bd42e063d7824e91731bb8fab 100644 --- a/matlab/varlist_indices.m +++ b/matlab/varlist_indices.m @@ -65,7 +65,7 @@ if length(i_var_unique_present)~=nvar_present k = find(~ismember((1:length(i_var))',index_unique_present) & i_var~=0); str = 'The following symbols are specified twice in the variable list and are considered only once:'; for ii = 1:length(k) - str = sprintf('%s %s', str, sublist{i_var(k(ii))}); + str = sprintf('%s %s', str, sublist{k(ii)}); end warning('%s\n', str) end