From bc8f546cbb1e91d872fa46c0e894e838cce9cab3 Mon Sep 17 00:00:00 2001 From: Marco Ratto Date: Tue, 13 Oct 2015 10:44:13 +0200 Subject: [PATCH] Provisions to to show in plots the parameter value around which the sensitivity analysis with the option neighborhood_width is done. --- matlab/gsa/mcf_analysis.m | 8 +++++++- matlab/gsa/scatter_mcf.m | 2 +- matlab/gsa/stab_map_.m | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/matlab/gsa/mcf_analysis.m b/matlab/gsa/mcf_analysis.m index cb7e92a10..cf7bcdae6 100644 --- a/matlab/gsa/mcf_analysis.m +++ b/matlab/gsa/mcf_analysis.m @@ -32,6 +32,10 @@ beha_title = options_mcf.beha_title; nobeha_title = options_mcf.nobeha_title; title = options_mcf.title; fname_ = options_mcf.fname_; +xparam1=[]; +if isfield(options_mcf,'xparam1'), + xparam1=options_mcf.xparam1; +end OutputDirectoryName = options_mcf.OutputDirectoryName; [proba, dproba] = stab_map_1(lpmat, ibeha, inobeha, [],0); @@ -55,7 +59,9 @@ if length(ibeha)>10 && length(inobeha)>10, end if ~isempty(indmcf) && ~DynareOptions.nograph, skipline() + xx=[]; + if ~ isempty(xparam1), xx=xparam1(indmcf); end scatter_mcf(lpmat(ibeha,indmcf),lpmat(inobeha,indmcf), param_names(indmcf,:), ... - '.', [fname_,'_',amcf_name], OutputDirectoryName, amcf_title,[], DynareOptions, ... + '.', [fname_,'_',amcf_name], OutputDirectoryName, amcf_title,xx, DynareOptions, ... beha_title, nobeha_title) end diff --git a/matlab/gsa/scatter_mcf.m b/matlab/gsa/scatter_mcf.m index 226549890..8f8bdd82c 100644 --- a/matlab/gsa/scatter_mcf.m +++ b/matlab/gsa/scatter_mcf.m @@ -122,7 +122,7 @@ for i = 1:p plot(X(:,i),X(:,j),[plotsymbol,'b']) end if ~isempty(xparam1) - hold on, plot(xparam1(i),xparam1(j),'k*') + hold on, plot(xparam1(i),xparam1(j),'s','MarkerFaceColor',[0 0.75 0],'MarkerEdgeColor',[0 0.75 0]) end hold off; % axis([-0.1 1.1 -0.1 1.1]) diff --git a/matlab/gsa/stab_map_.m b/matlab/gsa/stab_map_.m index 85ef36761..c52b381e4 100644 --- a/matlab/gsa/stab_map_.m +++ b/matlab/gsa/stab_map_.m @@ -123,6 +123,7 @@ options_mcf.alpha2 = alpha2; options_mcf.param_names = char(bayestopt_.name(nshock+1:end)); options_mcf.fname_ = fname_; options_mcf.OutputDirectoryName = OutputDirectoryName; +options_mcf.xparam1 = []; opt=options_; options_.periods=0; @@ -573,6 +574,9 @@ if length(iunstable)>0 || length(iwrong)>0, if length(iunstable)1 itot = [1:Nsam]; % Blanchard Kahn + if neighborhood_width, + options_mcf.xparam1 = xparam1(nshock+1:end); + end itmp = itot(find(~ismember(itot,istable))); options_mcf.amcf_name = asname; options_mcf.amcf_title = atitle; @@ -614,6 +618,9 @@ if length(iunstable)>0 || length(iwrong)>0, end if ~isempty(irestriction), + if neighborhood_width, + options_mcf.xparam1 = xparam1; + end options_mcf.param_names = char(bayestopt_.name); options_mcf.amcf_name = acalibname; options_mcf.amcf_title = acalibtitle;