From 65a16fd293a8b91f0a6e0e38e07513b857023a39 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Sat, 12 Oct 2013 09:40:04 +0200 Subject: [PATCH] Allow users to determine the threshold below which IRFs are suppressed. - Prepares moving future IRF options to a substructure - Adds new option for determining threshold - Harmonizes threshold values across estimation and stoch_simul - Fixes some header typos --- doc/dynare.texi | 7 +++++++ matlab/PosteriorIRF.m | 2 +- matlab/PosteriorIRF_core1.m | 3 ++- matlab/PosteriorIRF_core2.m | 8 +++++--- matlab/global_initialization.m | 1 + matlab/stoch_simul.m | 2 +- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/doc/dynare.texi b/doc/dynare.texi index 0382dcf78..d43c85f70 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -3312,6 +3312,10 @@ The exogenous variables for which to compute IRFs. Default: all. Requests the computation of normalized IRFs in percentage of the standard error of each shock. +@item irf_plot_threshold = @var{DOUBLE} +@anchor{irf_plot_threshold} +Threshold size for plotting IRFs. All IRFs for a particular variable with a maximum absolute deviation from the steady state smaller than this value are not displayed. Default: @code{1e-10}. + @item nocorr Don't print the correlation matrix (printing them is the default). @@ -4829,6 +4833,9 @@ using a standard Kalman filter. @xref{irf_shocks}. Only used if @ref{bayesian_irf} is passed. Cannot be used with @ref{dsge_var}. +@item irf_plot_threshold = @var{DOUBLE} +@xref{irf_plot_threshold}. Only used if @ref{bayesian_irf} is passed. + @item aim_solver @xref{aim_solver}. diff --git a/matlab/PosteriorIRF.m b/matlab/PosteriorIRF.m index 42e11640a..ffba1152d 100644 --- a/matlab/PosteriorIRF.m +++ b/matlab/PosteriorIRF.m @@ -404,7 +404,7 @@ if options_.TeX TEXNAMES = []; for j=1:nvar - if max(abs(MeanIRF(:,j,i))) > 10^(-6) + if max(abs(MeanIRF(:,j,i))) > options_.impulse_responses.plot_threshold name = deblank(varlist(j,:)); texname = deblank(varlist_TeX(j,:)); diff --git a/matlab/PosteriorIRF_core1.m b/matlab/PosteriorIRF_core1.m index 20294afa2..bd0c19a91 100644 --- a/matlab/PosteriorIRF_core1.m +++ b/matlab/PosteriorIRF_core1.m @@ -1,6 +1,7 @@ function myoutput=PosteriorIRF_core1(myinputs,fpar,B,whoiam, ThisMatlab) +% Generates and stores Posterior IRFs % PARALLEL CONTEXT -% This function perfom in parallel a portion of PosteriorIRF.m code. +% This function perfoms in parallel execution a portion of the PosteriorIRF.m code. % This is a special kind of parallel function. Unlike of other parallel functions, % that running in parallel a 'for' cycle, this function run in parallel a % 'while' loop! The parallelization of 'while' loop (when possible) is a more diff --git a/matlab/PosteriorIRF_core2.m b/matlab/PosteriorIRF_core2.m index 6a693a4a3..badef0e40 100644 --- a/matlab/PosteriorIRF_core2.m +++ b/matlab/PosteriorIRF_core2.m @@ -1,6 +1,8 @@ function myoutput=PosteriorIRF_core2(myinputs,fpar,npar,whoiam, ThisMatlab) +% Generates the Posterior IRFs plot from the IRFs generated in +% PosteriorIRF_core1 % PARALLEL CONTEXT -% Perfome in parallel a portion of PosteriorIRF.m code. +% Perform in parallel execution a portion of the PosteriorIRF.m code. % See also the comment in random_walk_metropolis_hastings_core.m funtion. % % INPUTS @@ -17,7 +19,7 @@ function myoutput=PosteriorIRF_core2(myinputs,fpar,npar,whoiam, ThisMatlab) % SPECIAL REQUIREMENTS. % None. % -% Copyright (C) 2006-2012 Dynare Team +% Copyright (C) 2006-2013 Dynare Team % % This file is part of Dynare. % @@ -87,7 +89,7 @@ for i=fpar:npar, figunumber = 0; for j=1:nvar - if max(abs(MeanIRF(:,j,i))) > 10^(-6) + if max(abs(MeanIRF(:,j,i))) > options_.impulse_responses.plot_threshold subplotnum = subplotnum+1; if subplotnum == 1 && options_.relative_irf hh = dyn_figure(options_,'Name',['Relative response to orthogonalized shock to ' tit(i,:)]); diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index 36c86ef28..66e521712 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -140,6 +140,7 @@ end % IRFs & other stoch_simul output options_.irf = 40; +options_.impulse_responses.plot_threshold=1e-10; options_.relative_irf = 0; options_.ar = 5; options_.hp_filter = 0; diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m index 5c6a1e06f..5ba12516b 100644 --- a/matlab/stoch_simul.m +++ b/matlab/stoch_simul.m @@ -195,7 +195,7 @@ if options_.irf y(i_var(j),:)'); eval(['oo_.irfs.' deblank(M_.endo_names(i_var(j),:)) '_' ... deblank(M_.exo_names(i,:)) ' = y(i_var(j),:);']); - if max(y(i_var(j),:)) - min(y(i_var(j),:)) > 1e-10 + if max(y(i_var(j),:)) - min(y(i_var(j),:)) > options_.impulse_responses.plot_threshold irfs = cat(1,irfs,y(i_var(j),:)); if isempty(mylist) mylist = deblank(var_list(j,:));