IRF: add an option to limit the exogenous shocked in the computations (ticket 114)
parent
ade0545625
commit
865dcb57f8
|
@ -2782,6 +2782,10 @@ increase it for highly autocorrelated processes. Default: @code{512}.
|
|||
Number of periods on which to compute the IRFs. Setting @code{irf=0},
|
||||
suppresses the plotting of IRF's. Default: @code{40}.
|
||||
|
||||
@item irf_shocks = ( @var{VARIABLE_NAME} [@var{VARIABLE_NAME} @dots{}] )
|
||||
@anchor{irf_shocks}
|
||||
The exogenous variables for which to compute IRFs. Default: all.
|
||||
|
||||
@item relative_irf
|
||||
Requests the computation of normalized IRFs in percentage of the
|
||||
standard error of each shock.
|
||||
|
|
|
@ -161,7 +161,8 @@ while fpar<npar
|
|||
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));
|
||||
for i = 1:M_.exo_nbr
|
||||
irf_shocks_indx = getIrfShocksIndx();
|
||||
for i=irf_shocks_indx
|
||||
if SS(i,i) > 1e-13
|
||||
y=irf(dr,SS(M_.exo_names_orig_ord,i), options_.irf, options_.drop,options_.replic,options_.order);
|
||||
if options_.relative_irf
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
function irf_shocks_indx=getIrfShocksIndx()
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
global M_ options_
|
||||
|
||||
if (isfield(options_,'irf_shocks')==0)
|
||||
irf_shocks_indx = M_.exo_names_orig_ord;
|
||||
else
|
||||
irf_shocks_indx = zeros(1,size(options_.irf_shocks,1));
|
||||
for i=1:size(options_.irf_shocks,1)
|
||||
irf_shocks_indx(i) = find(M_.exo_names==options_.irf_shocks(i));
|
||||
end
|
||||
end
|
|
@ -159,7 +159,8 @@ if options_.irf
|
|||
if TeX
|
||||
titTeX(M_.exo_names_orig_ord,:) = M_.exo_names_tex;
|
||||
end
|
||||
for i=1:M_.exo_nbr
|
||||
irf_shocks_indx = getIrfShocksIndx();
|
||||
for i=irf_shocks_indx
|
||||
if SS(i,i) > 1e-13
|
||||
if PI_PCL_solver
|
||||
y=PCL_Part_info_irf (0, PCL_varobs, i_var, M_, oo_.dr, options_.irf, i);
|
||||
|
|
|
@ -132,7 +132,8 @@ if options_.irf
|
|||
if TeX
|
||||
titTeX(M_.exo_names_orig_ord,:) = M_.exo_names_tex;
|
||||
end
|
||||
for i=1:M_.exo_nbr
|
||||
irf_shocks_indx = getIrfShocksIndx();
|
||||
for i=irf_shocks_indx
|
||||
if SS(i,i) > 1e-13
|
||||
y=irf(oo_.dr,cs(M_.exo_names_orig_ord,i), options_.irf, options_.drop, ...
|
||||
options_.replic, options_.order);
|
||||
|
|
|
@ -103,7 +103,7 @@ class ParsingDriver;
|
|||
%token HISTVAL HOMOTOPY_SETUP HOMOTOPY_MODE HOMOTOPY_STEPS HP_FILTER HP_NGRID
|
||||
%token IDENTIFICATION INF_CONSTANT INITVAL INITVAL_FILE
|
||||
%token <string_val> INT_NUMBER
|
||||
%token INV_GAMMA_PDF INV_GAMMA1_PDF INV_GAMMA2_PDF IRF
|
||||
%token INV_GAMMA_PDF INV_GAMMA1_PDF INV_GAMMA2_PDF IRF IRF_SHOCKS
|
||||
%token KALMAN_ALGO KALMAN_TOL
|
||||
%token LABELS LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_IDENT_FILES LOAD_MH_FILE LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR
|
||||
%token MARKOWITZ MARGINAL_DENSITY MAX
|
||||
|
@ -858,6 +858,7 @@ stoch_simul_options : o_dr_algo
|
|||
| o_nomoments
|
||||
| o_nograph
|
||||
| o_irf
|
||||
| o_irf_shocks
|
||||
| o_relative_irf
|
||||
| o_hp_filter
|
||||
| o_hp_ngrid
|
||||
|
@ -1689,6 +1690,7 @@ o_nocorr : NOCORR { driver.option_num("nocorr", "1"); };
|
|||
o_nofunctions : NOFUNCTIONS { driver.option_num("nofunctions", "1"); };
|
||||
o_nomoments : NOMOMENTS { driver.option_num("nomoments", "1"); };
|
||||
o_irf : IRF EQUAL INT_NUMBER { driver.option_num("irf", $3); };
|
||||
o_irf_shocks : IRF_SHOCKS EQUAL '(' symbol_list ')' { driver.option_symbol_list("irf_shocks"); };
|
||||
o_hp_filter : HP_FILTER EQUAL INT_NUMBER { driver.option_num("hp_filter", $3); };
|
||||
o_hp_ngrid : HP_NGRID EQUAL INT_NUMBER { driver.option_num("hp_ngrid", $3); };
|
||||
o_periods : PERIODS EQUAL INT_NUMBER { driver.option_num("periods", $3); };
|
||||
|
|
|
@ -404,6 +404,7 @@ string eofbuff;
|
|||
<DYNARE_STATEMENT>ar {return token::AR;}
|
||||
<DYNARE_STATEMENT>nofunctions {return token::NOFUNCTIONS;}
|
||||
<DYNARE_STATEMENT>irf {return token::IRF;}
|
||||
<DYNARE_STATEMENT>irf_shocks {return token::IRF_SHOCKS;}
|
||||
<DYNARE_STATEMENT>hp_filter {return token::HP_FILTER;}
|
||||
<DYNARE_STATEMENT>hp_ngrid {return token::HP_NGRID;}
|
||||
<DYNARE_STATEMENT>simul_seed {return token::SIMUL_SEED;}
|
||||
|
|
|
@ -925,6 +925,15 @@ ParsingDriver::option_symbol_list(const string &name_option)
|
|||
!= options_list.symbol_list_options.end())
|
||||
error("option " + name_option + " declared twice");
|
||||
|
||||
if (name_option.compare("irf_shocks")==0)
|
||||
{
|
||||
vector<string> shocks = symbol_list.get_symbols();
|
||||
for (vector<string>::const_iterator it = shocks.begin();
|
||||
it != shocks.end(); it++)
|
||||
if (mod_file->symbol_table.getType(*it) != eExogenous)
|
||||
error("Variables passed to irf_for must be exogenous. Caused by: " + *it);
|
||||
}
|
||||
|
||||
options_list.symbol_list_options[name_option] = symbol_list;
|
||||
symbol_list.clear();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue