diff --git a/matlab/PosteriorIRF.m b/matlab/PosteriorIRF.m index 0aa1908cdb324da7a6b489ba373042985d9da877..5f02c486734b3b571328a427754d07c0c969163c 100644 --- a/matlab/PosteriorIRF.m +++ b/matlab/PosteriorIRF.m @@ -58,7 +58,7 @@ for i=1:nvar end % Get index of shocks for requested IRFs -irf_shocks_indx = getIrfShocksIndx(); +irf_shocks_indx = getIrfShocksIndx(M_, options_); % Set various parameters & Check or create directories nvx = estim_params_.nvx; diff --git a/matlab/PosteriorIRF_core1.m b/matlab/PosteriorIRF_core1.m index db2425f82e7e3aea85fe5a69cfa32457ef30dd06..2118704707ca69edfa29d4fd0fd4025effc07b4e 100644 --- a/matlab/PosteriorIRF_core1.m +++ b/matlab/PosteriorIRF_core1.m @@ -144,7 +144,7 @@ while fpar<B deep = x(fpar,:); end stock_param(irun2,:) = deep; - set_parameters(deep); + M_ = set_parameters_locally(M_, deep); [dr,info,M_,oo_] =compute_decision_rules(M_,options_,oo_); oo_.dr = dr; if info(1) @@ -174,7 +174,7 @@ while fpar<B end SS(M_.exo_names_orig_ord,M_.exo_names_orig_ord) = M_.Sigma_e+1e-14*eye(M_.exo_nbr); SS = transpose(chol(SS)); - irf_shocks_indx = getIrfShocksIndx(); + irf_shocks_indx = getIrfShocksIndx(M_, options_); for i=irf_shocks_indx if SS(i,i) > 1e-13 if options_.order>1 && options_.relative_irf % normalize shock to 0.01 before IRF generation for GIRFs; multiply with 100 later diff --git a/matlab/getIrfShocksIndx.m b/matlab/getIrfShocksIndx.m index 91dbe059dc6bdd8884c1e6d2b8f705ce360d235b..5686b228c2c74b432e6c64092eaa191cdf1ecd48 100644 --- a/matlab/getIrfShocksIndx.m +++ b/matlab/getIrfShocksIndx.m @@ -1,14 +1,15 @@ -function irf_shocks_indx=getIrfShocksIndx() -% irf_shocks_indx=getIrfShocksIndx() +function irf_shocks_indx=getIrfShocksIndx(M_, options_) +% irf_shocks_indx=getIrfShocksIndx(M_, options_) % returns the unique indices of the exogenous shocks specified for IRF % generation using the irf_shocks-command % % Inputs: -% none +% - M_ [structure] Matlab's structure describing the model (M_). +% - options_ [structure] Matlab's structure describing the current options (options_). % Outputs: -% irf_shocks_indx: [1 by n_irf_shocks] vector storing the indices +% - irf_shocks_indx: [1 by n_irf_shocks] vector storing the indices % -% Copyright © 2011-2018 Dynare Team +% Copyright © 2011-2022 Dynare Team % % This file is part of Dynare. % @@ -25,8 +26,6 @@ function irf_shocks_indx=getIrfShocksIndx() % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -global M_ options_ - if (isfield(options_,'irf_shocks')==0) irf_shocks_indx = M_.exo_names_orig_ord; else diff --git a/matlab/irf.m b/matlab/irf.m index 07ec81745325916c20789fa807d13ae216e13c60..e4268292ec80b7067a9407ff515261a6b6ddefcf 100644 --- a/matlab/irf.m +++ b/matlab/irf.m @@ -35,6 +35,11 @@ function y = irf(M_, options_, dr, e1, long, drop, replic, iorder) % 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_.loglinear && ~options_.logged_steady_state + dr.ys = log_variable(1:M_.endo_nbr,dr.ys,M_); + options_.logged_steady_state=1; +end + if M_.maximum_lag >= 1 temps = repmat(dr.ys,1,M_.maximum_lag); else diff --git a/matlab/resol.m b/matlab/resol.m index edab18d1c6a60e5039f9a7bf6eddff8bc8b4eaac..805ac3d46c4ea349dde4c3557e214eecd2ac8e1e 100644 --- a/matlab/resol.m +++ b/matlab/resol.m @@ -86,7 +86,7 @@ if options.loglinear % Find variables with non positive steady state. Skip auxiliary % variables for lagges/leaded exogenous variables idx = find(dr.ys(get_all_variables_but_lagged_leaded_exogenous(M))<threshold); - if length(idx) + if ~isempty(idx) if options.debug variables_with_non_positive_steady_state = M.endo_names{idx}; skipline() diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m index e3860b56ee38f42f62e8a90531a897aa8e06ebdb..ad26585d884d028576533475ff6803ca1c8c871f 100644 --- a/matlab/stoch_simul.m +++ b/matlab/stoch_simul.m @@ -237,7 +237,7 @@ if options_.irf if TeX titTeX(M_.exo_names_orig_ord) = M_.exo_names_tex; end - irf_shocks_indx = getIrfShocksIndx(); + irf_shocks_indx = getIrfShocksIndx(M_, options_); for i=irf_shocks_indx if SS(i,i) > 1e-13 if PI_PCL_solver