getIrfShocksIndx.m: replace global variables by inputs

bgp-dev
Johannes Pfeifer 2022-09-21 09:27:43 +02:00
parent 945379a318
commit be2dd4456d
4 changed files with 9 additions and 10 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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