2007-04-04 10:19:51 +02:00
|
|
|
function [rmse_MC, ixx] = filt_mc_(OutDir)
|
|
|
|
% function [rmse_MC, ixx] = filt_mc_(OutDir)
|
2006-03-24 17:27:56 +01:00
|
|
|
% copyright Marco Ratto 2006
|
2007-04-04 10:19:51 +02:00
|
|
|
% inputs (from opt_gsa structure)
|
|
|
|
% vvarvecm = options_gsa_.var_rmse;
|
|
|
|
% loadSA = options_gsa_.load_rmse;
|
|
|
|
% pfilt = options_gsa_.pfilt_rmse;
|
|
|
|
% alpha = options_gsa_.alpha_rmse;
|
|
|
|
% alpha2 = options_gsa_.alpha2_rmse;
|
|
|
|
% istart = options_gsa_.istart_rmse;
|
|
|
|
% alphaPC = 0.5;
|
|
|
|
%
|
|
|
|
% Part of the Sensitivity Analysis Toolbox for DYNARE
|
|
|
|
%
|
|
|
|
% Written by Marco Ratto, 2006
|
|
|
|
% Joint Research Centre, The European Commission,
|
|
|
|
% (http://eemc.jrc.ec.europa.eu/),
|
|
|
|
% marco.ratto@jrc.it
|
|
|
|
%
|
|
|
|
% Disclaimer: This software is not subject to copyright protection and is in the public domain.
|
|
|
|
% It is an experimental system. The Joint Research Centre of European Commission
|
|
|
|
% assumes no responsibility whatsoever for its use by other parties
|
|
|
|
% and makes no guarantees, expressed or implied, about its quality, reliability, or any other
|
|
|
|
% characteristic. We would appreciate acknowledgement if the software is used.
|
|
|
|
% Reference:
|
|
|
|
% M. Ratto, Global Sensitivity Analysis for Macroeconomic models, MIMEO, 2006.
|
|
|
|
%
|
2006-03-24 17:27:56 +01:00
|
|
|
|
2007-04-04 10:19:51 +02:00
|
|
|
global bayestopt_ estim_params_ M_ options_ oo_
|
2006-03-24 17:27:56 +01:00
|
|
|
|
2007-04-04 10:19:51 +02:00
|
|
|
options_gsa_=options_.opt_gsa;
|
|
|
|
vvarvecm = options_gsa_.var_rmse;
|
|
|
|
loadSA = options_gsa_.load_rmse;
|
|
|
|
pfilt = options_gsa_.pfilt_rmse;
|
|
|
|
alpha = options_gsa_.alpha_rmse;
|
|
|
|
alpha2 = options_gsa_.alpha2_rmse;
|
|
|
|
istart = options_gsa_.istart_rmse;
|
|
|
|
alphaPC = 0.5;
|
|
|
|
|
2006-03-24 17:27:56 +01:00
|
|
|
fname_ = M_.fname;
|
|
|
|
lgy_ = M_.endo_names;
|
|
|
|
dr_ = oo_.dr;
|
|
|
|
|
|
|
|
disp(' ')
|
|
|
|
disp(' ')
|
|
|
|
disp('Starting sensitivity analysis')
|
|
|
|
disp('for the fit of EACH observed series ...')
|
|
|
|
disp(' ')
|
|
|
|
disp('Deleting old SA figures...')
|
2006-05-04 11:06:57 +02:00
|
|
|
a=dir([OutDir,'\*.*']);
|
2007-04-04 10:19:51 +02:00
|
|
|
tmp1='0';
|
2006-04-11 17:32:22 +02:00
|
|
|
if options_.opt_gsa.ppost,
|
2007-04-04 10:19:51 +02:00
|
|
|
tmp=['_rmse_post'];
|
2006-04-11 17:32:22 +02:00
|
|
|
else
|
|
|
|
if options_.opt_gsa.pprior
|
2007-04-04 10:19:51 +02:00
|
|
|
tmp=['_rmse_prior'];
|
2006-05-04 11:06:57 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
tmp=['_rmse_mc'];
|
|
|
|
end
|
|
|
|
if options_gsa_.lik_only,
|
|
|
|
tmp1 = [tmp,'_post_SA'];
|
|
|
|
tmp = [tmp,'_lik_SA'];
|
2006-05-04 11:06:57 +02:00
|
|
|
end
|
2006-04-11 17:32:22 +02:00
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
for j=1:length(a),
|
|
|
|
if strmatch([fname_,tmp],a(j).name),
|
|
|
|
disp(a(j).name)
|
2006-05-04 11:06:57 +02:00
|
|
|
delete([OutDir,'\',a(j).name])
|
2006-03-24 17:27:56 +01:00
|
|
|
end,
|
2007-04-04 10:19:51 +02:00
|
|
|
if strmatch([fname_,tmp1],a(j).name),
|
|
|
|
disp(a(j).name)
|
|
|
|
delete([OutDir,'\',a(j).name])
|
|
|
|
end,
|
2006-03-24 17:27:56 +01:00
|
|
|
end
|
|
|
|
disp('done !')
|
|
|
|
|
|
|
|
|
|
|
|
nshock=estim_params_.nvx + estim_params_.nvn + estim_params_.ncx + estim_params_.ncn;
|
|
|
|
npar=estim_params_.np;
|
2007-04-04 10:19:51 +02:00
|
|
|
load(options_.mode_file,'xparam1')
|
|
|
|
if options_.opt_gsa.ppost,
|
|
|
|
c=load([fname_,'_mean'],'xparam1');
|
|
|
|
xparam1_mean=c.xparam1;
|
|
|
|
clear c
|
|
|
|
elseif ~isempty(ls([fname_,'_mean.mat']))
|
|
|
|
c=load([fname_,'_mean'],'xparam1');
|
|
|
|
xparam1_mean=c.xparam1;
|
|
|
|
clear c
|
2006-03-24 17:27:56 +01:00
|
|
|
end
|
|
|
|
|
2006-04-11 17:32:22 +02:00
|
|
|
if options_.opt_gsa.ppost,
|
|
|
|
fnamtmp=[fname_,'_post'];
|
|
|
|
DirectoryName = CheckPath('metropolis');
|
2006-03-24 17:27:56 +01:00
|
|
|
else
|
2006-04-11 17:32:22 +02:00
|
|
|
if options_.opt_gsa.pprior
|
|
|
|
fnamtmp=[fname_,'_prior'];
|
|
|
|
else
|
|
|
|
fnamtmp=[fname_,'_mc'];
|
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
end
|
|
|
|
if ~loadSA,
|
2006-05-04 11:06:57 +02:00
|
|
|
if exist('xparam1','var')
|
|
|
|
set_all_parameters(xparam1);
|
|
|
|
steady_;
|
|
|
|
ys_mode=oo_.steady_state;
|
|
|
|
end
|
|
|
|
if exist('xparam1_mean','var')
|
|
|
|
set_all_parameters(xparam1_mean);
|
|
|
|
steady_;
|
|
|
|
ys_mean=oo_.steady_state;
|
|
|
|
end
|
2007-04-04 10:19:51 +02:00
|
|
|
% eval(options_.datafile)
|
|
|
|
obs = dat_fil_(options_.datafile);
|
2006-04-11 17:32:22 +02:00
|
|
|
if ~options_.opt_gsa.ppost
|
2007-04-04 10:19:51 +02:00
|
|
|
load([OutDir,'\',fnamtmp],'x','logpo2','stock_gend','stock_data');
|
|
|
|
logpo2=-logpo2;
|
2006-04-11 17:32:22 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
%load([DirectoryName '/' M_.fname '_data.mat']);
|
|
|
|
[stock_gend, stock_data] = read_data;
|
2006-04-11 17:32:22 +02:00
|
|
|
filfilt = dir([DirectoryName '/' M_.fname '_filter*.mat']);
|
|
|
|
filparam = dir([DirectoryName '/' M_.fname '_param*.mat']);
|
|
|
|
x=[];
|
2006-05-04 11:06:57 +02:00
|
|
|
logpo2=[];
|
|
|
|
sto_ys=[];
|
2006-04-11 17:32:22 +02:00
|
|
|
for j=1:length(filparam),
|
2006-05-04 11:06:57 +02:00
|
|
|
%load([DirectoryName '/' M_.fname '_param',int2str(j),'.mat']);
|
|
|
|
if isempty(strmatch([M_.fname '_param_irf'],filparam(j).name))
|
|
|
|
load([DirectoryName '/' filparam(j).name]);
|
|
|
|
x=[x; stock];
|
|
|
|
logpo2=[logpo2; stock_logpo];
|
|
|
|
sto_ys=[sto_ys; stock_ys];
|
|
|
|
clear stock stock_logpo stock_ys;
|
|
|
|
end
|
2006-04-11 17:32:22 +02:00
|
|
|
end
|
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
nruns=size(x,1);
|
|
|
|
nfilt=floor(pfilt*nruns);
|
2006-09-28 14:30:58 +02:00
|
|
|
if options_.opt_gsa.ppost | (options_.opt_gsa.ppost==0 & options_.opt_gsa.lik_only==0)
|
2006-03-24 17:27:56 +01:00
|
|
|
disp(' ')
|
|
|
|
disp('Computing RMSE''s...')
|
|
|
|
fobs = options_.first_obs;
|
|
|
|
nobs=options_.nobs;
|
|
|
|
for i=1:size(vvarvecm,1),
|
|
|
|
vj=deblank(vvarvecm(i,:));
|
2007-04-04 10:19:51 +02:00
|
|
|
eval(['vobs =obs.',vj,'(fobs:fobs-1+nobs);'])
|
2006-03-24 17:27:56 +01:00
|
|
|
if options_.prefilter == 1
|
2006-06-20 16:58:43 +02:00
|
|
|
%eval([vj,'=',vj,'-bayestopt_.mean_varobs(i);'])
|
2007-04-04 10:19:51 +02:00
|
|
|
%eval([vj,'=',vj,'-mean(',vj,',1);'])
|
|
|
|
vobs = vobs-mean(vobs,1);
|
2006-03-24 17:27:56 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
jxj = strmatch(vj,lgy_(dr_.order_var,:),'exact');
|
|
|
|
js = strmatch(vj,lgy_,'exact');
|
2006-05-04 11:06:57 +02:00
|
|
|
if exist('xparam1','var')
|
2007-04-04 10:19:51 +02:00
|
|
|
eval(['rmse_mode(i) = sqrt(mean((vobs(istart:end)-oo_.steady_state(js)-oo_.FilteredVariables.',vj,'(istart:end-1)).^2));'])
|
2006-05-04 11:06:57 +02:00
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
y0=zeros(nobs+1,nruns);
|
2006-04-11 17:32:22 +02:00
|
|
|
if options_.opt_gsa.ppost
|
2006-06-20 16:58:43 +02:00
|
|
|
%y0=zeros(nobs+max(options_.filter_step_ahead),nruns);
|
2006-04-11 17:32:22 +02:00
|
|
|
nbb=0;
|
|
|
|
for j=1:length(filfilt),
|
|
|
|
load([DirectoryName '/' M_.fname '_filter',num2str(j),'.mat']);
|
|
|
|
nb = size(stock,4);
|
2006-06-20 16:58:43 +02:00
|
|
|
% y0(:,nbb+1:nbb+nb)=squeeze(stock(1,jxj,:,:)) + ...
|
|
|
|
% kron(sto_ys(nbb+1:nbb+nb,js)',ones(size(stock,3),1));
|
|
|
|
y0(:,nbb+1:nbb+nb)=squeeze(stock(1,jxj,1:nobs+1,:)) + ...
|
|
|
|
kron(sto_ys(nbb+1:nbb+nb,js)',ones(nobs+1,1));
|
2006-05-04 11:06:57 +02:00
|
|
|
%y0(:,:,size(y0,3):size(y0,3)+size(stock,3))=stock;
|
2006-04-11 17:32:22 +02:00
|
|
|
nbb=nbb+nb;
|
2006-05-04 11:06:57 +02:00
|
|
|
clear stock;
|
2006-04-11 17:32:22 +02:00
|
|
|
end
|
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
filfilt=ls([OutDir,'\',fnamtmp,'_*.mat']);
|
|
|
|
nbb=0;
|
|
|
|
for j=1:size(filfilt,1),
|
|
|
|
load([OutDir,'\',fnamtmp,'_',num2str(j),'.mat'],'stock_filter','stock_ys');
|
|
|
|
nb = size(stock_filter,3);
|
|
|
|
y0(:,nbb+1:nbb+nb) = squeeze(stock_filter(jxj,:,:)) + ...
|
|
|
|
kron(stock_ys(:,js)',ones(nobs+1,1));
|
|
|
|
%y0(:,:,size(y0,3):size(y0,3)+size(stock,3))=stock;
|
|
|
|
nbb=nbb+nb;
|
|
|
|
clear stock_filter;
|
|
|
|
end
|
|
|
|
|
|
|
|
% y0 = squeeze(stock_filter(:,jxj,:)) + ...
|
|
|
|
% kron(stock_ys(js,:),ones(size(stock_filter,1),1));
|
2006-04-11 17:32:22 +02:00
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
y0M=mean(y0,2);
|
|
|
|
for j=1:nruns,
|
2007-04-04 10:19:51 +02:00
|
|
|
rmse_MC(j,i) = sqrt(mean((vobs(istart:end)-y0(istart:end-1,j)).^2));
|
2006-03-24 17:27:56 +01:00
|
|
|
end
|
2006-05-04 11:06:57 +02:00
|
|
|
if exist('xparam1_mean','var')
|
|
|
|
%eval(['rmse_pmean(i) = sqrt(mean((',vj,'(fobs-1+istart:fobs-1+nobs)-y0M(istart:end-1)).^2));'])
|
|
|
|
[alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK] = DsgeSmoother(xparam1_mean,stock_gend,stock_data);
|
|
|
|
y0 = ahat(jxj,:)' + ...
|
|
|
|
kron(ys_mean(js,:),ones(size(ahat,2),1));
|
2007-04-04 10:19:51 +02:00
|
|
|
rmse_pmean(i) = sqrt(mean((vobs(istart:end)-y0(istart:end-1)).^2));
|
2006-05-04 11:06:57 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
clear stock_filter;
|
2006-09-28 14:30:58 +02:00
|
|
|
end
|
2006-05-04 11:06:57 +02:00
|
|
|
for j=1:nruns,
|
|
|
|
lnprior(j,1) = priordens(x(j,:),bayestopt_.pshape,bayestopt_.p1,bayestopt_.p2,bayestopt_.p3,bayestopt_.p4);
|
2006-03-24 17:27:56 +01:00
|
|
|
end
|
2007-04-04 10:19:51 +02:00
|
|
|
likelihood=logpo2(:)-lnprior(:);
|
2006-03-24 17:27:56 +01:00
|
|
|
disp('... done!')
|
|
|
|
|
2006-04-11 17:32:22 +02:00
|
|
|
if options_.opt_gsa.ppost
|
2006-05-04 11:06:57 +02:00
|
|
|
save([OutDir,'\',fnamtmp], 'x', 'logpo2', 'likelihood', 'rmse_MC', 'rmse_mode','rmse_pmean')
|
2006-04-11 17:32:22 +02:00
|
|
|
else
|
2006-09-28 14:30:58 +02:00
|
|
|
if options_.opt_gsa.lik_only
|
|
|
|
save([OutDir,'\',fnamtmp], 'likelihood', '-append')
|
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
if exist('xparam1_mean','var')
|
|
|
|
save([OutDir,'\',fnamtmp], 'likelihood', 'rmse_MC', 'rmse_mode','rmse_pmean','-append')
|
|
|
|
else
|
|
|
|
save([OutDir,'\',fnamtmp], 'likelihood', 'rmse_MC', 'rmse_mode','-append')
|
|
|
|
end
|
2006-09-28 14:30:58 +02:00
|
|
|
end
|
2006-04-11 17:32:22 +02:00
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
else
|
2006-09-28 14:30:58 +02:00
|
|
|
if options_.opt_gsa.lik_only & options_.opt_gsa.ppost==0
|
|
|
|
load([OutDir,'\',fnamtmp],'x','logpo2','likelihood');
|
|
|
|
else
|
|
|
|
load([OutDir,'\',fnamtmp],'x','logpo2','likelihood','rmse_MC','rmse_mode','rmse_pmean');
|
|
|
|
end
|
2007-04-04 10:19:51 +02:00
|
|
|
lnprior=logpo2(:)-likelihood(:);
|
2006-03-24 17:27:56 +01:00
|
|
|
nruns=size(x,1);
|
|
|
|
nfilt=floor(pfilt*nruns);
|
|
|
|
end
|
|
|
|
% smirnov tests
|
2006-05-04 11:06:57 +02:00
|
|
|
nfilt0=nfilt*ones(size(vvarvecm,1),1);
|
|
|
|
logpo2=logpo2(:);
|
2006-04-11 17:32:22 +02:00
|
|
|
if ~options_.opt_gsa.ppost
|
2007-04-04 10:19:51 +02:00
|
|
|
[dum, ipost]=sort(-logpo2);
|
|
|
|
[dum, ilik]=sort(-likelihood);
|
2006-04-11 17:32:22 +02:00
|
|
|
end
|
2006-09-28 14:30:58 +02:00
|
|
|
if ~options_.opt_gsa.ppost & options_.opt_gsa.lik_only
|
|
|
|
if options_.opt_gsa.pprior
|
2007-04-04 10:19:51 +02:00
|
|
|
anam='rmse_prior_post';
|
2006-09-28 14:30:58 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
anam='rmse_mc_post';
|
2006-09-28 14:30:58 +02:00
|
|
|
end
|
|
|
|
stab_map_1(x, ipost(1:nfilt), ipost(nfilt+1:end), anam, 1,[],OutDir);
|
|
|
|
stab_map_2(x(ipost(1:nfilt),:),alpha2,anam, OutDir);
|
|
|
|
if options_.opt_gsa.pprior
|
2007-04-04 10:19:51 +02:00
|
|
|
anam='rmse_prior_lik';
|
2006-09-28 14:30:58 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
anam='rmse_mc_lik';
|
2006-09-28 14:30:58 +02:00
|
|
|
end
|
|
|
|
stab_map_1(x, ilik(1:nfilt), ilik(nfilt+1:end), anam, 1,[],OutDir);
|
|
|
|
stab_map_2(x(ilik(1:nfilt),:),alpha2,anam, OutDir);
|
|
|
|
else
|
|
|
|
for i=1:size(vvarvecm,1),
|
2006-03-24 17:27:56 +01:00
|
|
|
[dum, ixx(:,i)]=sort(rmse_MC(:,i));
|
2006-05-04 11:06:57 +02:00
|
|
|
if options_.opt_gsa.ppost,
|
|
|
|
%nfilt0(i)=length(find(rmse_MC(:,i)<rmse_pmean(i)));
|
|
|
|
rmse_txt=rmse_pmean;
|
|
|
|
else
|
|
|
|
if options_.opt_gsa.pprior,
|
|
|
|
rmse_txt=rmse_mode;
|
|
|
|
else
|
|
|
|
%nfilt0(i)=length(find(rmse_MC(:,i)<rmse_pmean(i)));
|
|
|
|
rmse_txt=rmse_pmean;
|
|
|
|
end
|
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
for j=1:npar+nshock,
|
2006-05-04 11:06:57 +02:00
|
|
|
[H,P,KSSTAT] = smirnov(x(ixx(nfilt0(i)+1:end,i),j),x(ixx(1:nfilt0(i),i),j), alpha);
|
|
|
|
[H1,P1,KSSTAT1] = smirnov(x(ixx(nfilt0(i)+1:end,i),j),x(ixx(1:nfilt0(i),i),j),alpha,1);
|
|
|
|
[H2,P2,KSSTAT2] = smirnov(x(ixx(nfilt0(i)+1:end,i),j),x(ixx(1:nfilt0(i),i),j),alpha,-1);
|
2006-03-24 17:27:56 +01:00
|
|
|
if H1 & H2==0,
|
|
|
|
SS(j,i)=1;
|
|
|
|
elseif H1==0,
|
|
|
|
SS(j,i)=-1;
|
|
|
|
else
|
|
|
|
SS(j,i)=0;
|
|
|
|
end
|
|
|
|
PP(j,i)=P;
|
|
|
|
end
|
|
|
|
end
|
2006-06-20 16:58:43 +02:00
|
|
|
ifig=0;
|
2006-05-04 11:06:57 +02:00
|
|
|
for i=1:size(vvarvecm,1),
|
2006-06-20 16:58:43 +02:00
|
|
|
if mod(i,9)==1,
|
|
|
|
ifig=ifig+1;
|
|
|
|
figure('name',['Prior ',int2str(ifig)])
|
|
|
|
end
|
|
|
|
subplot(3,3,i-9*(ifig-1))
|
2006-05-04 11:06:57 +02:00
|
|
|
h=cumplot(lnprior(ixx(1:nfilt0(i),i)));
|
|
|
|
set(h,'color','red')
|
|
|
|
hold on, cumplot(lnprior)
|
|
|
|
h=cumplot(lnprior(ixx(nfilt0(i)+1:end,i)));
|
|
|
|
set(h,'color','green')
|
|
|
|
title(vvarvecm(i,:))
|
2006-06-20 16:58:43 +02:00
|
|
|
if mod(i,9)==0 | i==size(vvarvecm,1)
|
|
|
|
if options_.opt_gsa.ppost
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_post_lnprior',int2str(ifig)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_post_lnprior',int2str(ifig)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_post_lnprior',int2str(ifig)]);
|
2006-06-20 16:58:43 +02:00
|
|
|
else
|
|
|
|
if options_.opt_gsa.pprior
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_prior_lnprior',int2str(ifig)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_prior_lnprior',int2str(ifig)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_prior_lnprior',int2str(ifig)]);
|
2006-06-20 16:58:43 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_mc_lnprior',int2str(ifig)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_mc_lnprior',int2str(ifig)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_mc_lnprior',int2str(ifig)]);
|
2006-06-20 16:58:43 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
close(gcf)
|
2006-05-04 11:06:57 +02:00
|
|
|
end
|
|
|
|
end
|
2006-06-20 16:58:43 +02:00
|
|
|
ifig=0;
|
2006-05-04 11:06:57 +02:00
|
|
|
for i=1:size(vvarvecm,1),
|
2006-06-20 16:58:43 +02:00
|
|
|
if mod(i,9)==1,
|
|
|
|
ifig=ifig+1;
|
|
|
|
figure('name',['Likelihood ',int2str(ifig)])
|
|
|
|
end
|
|
|
|
subplot(3,3,i-9*(ifig-1))
|
2006-05-04 11:06:57 +02:00
|
|
|
h=cumplot(likelihood(ixx(1:nfilt0(i),i)));
|
|
|
|
set(h,'color','red')
|
|
|
|
hold on, h=cumplot(likelihood);
|
|
|
|
h=cumplot(likelihood(ixx(nfilt0(i)+1:end,i)));
|
|
|
|
set(h,'color','green')
|
|
|
|
title(vvarvecm(i,:))
|
2007-04-04 10:19:51 +02:00
|
|
|
if options_.opt_gsa.ppost==0,
|
|
|
|
set(gca,'xlim',[min( likelihood(ixx(1:nfilt0(i),i)) ) max( likelihood(ixx(1:nfilt0(i),i)) )])
|
|
|
|
end
|
2006-06-20 16:58:43 +02:00
|
|
|
if mod(i,9)==0 | i==size(vvarvecm,1)
|
|
|
|
if options_.opt_gsa.ppost
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_post_lnlik',int2str(ifig)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_post_lnlik',int2str(ifig)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_post_lnlik',int2str(ifig)]);
|
2006-06-20 16:58:43 +02:00
|
|
|
else
|
|
|
|
if options_.opt_gsa.pprior
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_prior_lnlik',int2str(ifig)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_prior_lnlik',int2str(ifig)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_prior_lnlik',int2str(ifig)]);
|
2006-06-20 16:58:43 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_mc_lnlik',int2str(ifig)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_mc_lnlik',int2str(ifig)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_mc_lnlik',int2str(ifig)]);
|
2006-06-20 16:58:43 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
close(gcf)
|
2006-05-04 11:06:57 +02:00
|
|
|
end
|
|
|
|
end
|
2006-06-20 16:58:43 +02:00
|
|
|
ifig=0;
|
2006-05-04 11:06:57 +02:00
|
|
|
for i=1:size(vvarvecm,1),
|
2006-06-20 16:58:43 +02:00
|
|
|
if mod(i,9)==1,
|
|
|
|
ifig=ifig+1;
|
|
|
|
figure('name',['Posterior ',int2str(ifig)])
|
|
|
|
end
|
|
|
|
subplot(3,3,i-9*(ifig-1))
|
2006-05-04 11:06:57 +02:00
|
|
|
h=cumplot(logpo2(ixx(1:nfilt0(i),i)));
|
|
|
|
set(h,'color','red')
|
|
|
|
hold on, h=cumplot(logpo2);
|
|
|
|
h=cumplot(logpo2(ixx(nfilt0(i)+1:end,i)));
|
2006-06-20 16:58:43 +02:00
|
|
|
set(h,'color','green')
|
2006-05-04 11:06:57 +02:00
|
|
|
title(vvarvecm(i,:))
|
2007-04-04 10:19:51 +02:00
|
|
|
if options_.opt_gsa.ppost==0,
|
|
|
|
set(gca,'xlim',[min( logpo2(ixx(1:nfilt0(i),i)) ) max( logpo2(ixx(1:nfilt0(i),i)) )])
|
|
|
|
end
|
2006-06-20 16:58:43 +02:00
|
|
|
if mod(i,9)==0 | i==size(vvarvecm,1)
|
|
|
|
if options_.opt_gsa.ppost
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_post_lnpost',int2str(ifig)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_post_lnpost',int2str(ifig)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_post_lnpost',int2str(ifig)]);
|
2006-06-20 16:58:43 +02:00
|
|
|
else
|
|
|
|
if options_.opt_gsa.pprior
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_prior_lnpost',int2str(ifig)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_prior_lnpost',int2str(ifig)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_prior_lnpost',int2str(ifig)]);
|
2006-06-20 16:58:43 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_mc_lnpost',int2str(ifig)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_mc_lnpost',int2str(ifig)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_mc_lnpost',int2str(ifig)]);
|
2006-06-20 16:58:43 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
close(gcf)
|
2006-05-04 11:06:57 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2006-03-24 17:27:56 +01:00
|
|
|
param_names='';
|
|
|
|
for j=1:npar+nshock,
|
|
|
|
param_names=str2mat(param_names, bayestopt_.name{j});
|
|
|
|
end
|
|
|
|
param_names=param_names(2:end,:);
|
|
|
|
|
|
|
|
disp(' ')
|
|
|
|
disp('RMSE over the MC sample:')
|
|
|
|
disp(' min yr RMSE max yr RMSE')
|
|
|
|
for j=1:size(vvarvecm,1),
|
|
|
|
disp([vvarvecm(j,:), sprintf('%15.5g',[(min(rmse_MC(:,j))) [(max(rmse_MC(:,j)))]])])
|
|
|
|
end
|
|
|
|
invar = find( std(rmse_MC)./mean(rmse_MC)<=0.0001 );
|
|
|
|
if ~isempty(invar)
|
|
|
|
disp(' ')
|
|
|
|
disp(' ')
|
|
|
|
disp('RMSE is not varying significantly over the MC sample for the following variables:')
|
|
|
|
disp(vvarvecm(invar,:))
|
|
|
|
disp('These variables are excluded from SA')
|
|
|
|
disp('[Unless you treat these series as exogenous, there is something wrong in your estimation !]')
|
|
|
|
end
|
|
|
|
ivar = find( std(rmse_MC)./mean(rmse_MC)>0.0001 );
|
|
|
|
vvarvecm=vvarvecm(ivar,:);
|
|
|
|
rmse_MC=rmse_MC(:,ivar);
|
|
|
|
|
|
|
|
disp(' ')
|
2007-04-04 10:19:51 +02:00
|
|
|
% if options_.opt_gsa.ppost==0 & options_.opt_gsa.pprior,
|
2006-05-04 11:06:57 +02:00
|
|
|
disp(['Sample filtered the ',num2str(pfilt*100),'% best RMSE''s for each observed series ...' ])
|
2007-04-04 10:19:51 +02:00
|
|
|
% else
|
|
|
|
% disp(['Sample filtered the best RMSE''s smaller than RMSE at the posterior mean ...' ])
|
|
|
|
% end
|
2006-03-24 17:27:56 +01:00
|
|
|
% figure, boxplot(rmse_MC)
|
|
|
|
% set(gca,'xticklabel',vvarvecm)
|
|
|
|
% saveas(gcf,[fname_,'_SA_RMSE'])
|
|
|
|
|
|
|
|
disp(' ')
|
|
|
|
disp(' ')
|
|
|
|
disp('RMSE ranges after filtering:')
|
2006-05-04 11:06:57 +02:00
|
|
|
if options_.opt_gsa.ppost==0 & options_.opt_gsa.pprior,
|
|
|
|
disp([' best ',num2str(pfilt*100),'% filtered remaining 90%'])
|
|
|
|
disp([' min max min max posterior mode'])
|
|
|
|
else
|
|
|
|
disp([' best filtered remaining '])
|
|
|
|
disp([' min max min max posterior mean'])
|
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
for j=1:size(vvarvecm,1),
|
2006-05-04 11:06:57 +02:00
|
|
|
disp([vvarvecm(j,:), sprintf('%15.5g',[min(rmse_MC(ixx(1:nfilt0(j),j),j)) ...
|
|
|
|
max(rmse_MC(ixx(1:nfilt0(j),j),j)) ...
|
|
|
|
min(rmse_MC(ixx(nfilt0(j)+1:end,j),j)) ...
|
|
|
|
max(rmse_MC(ixx(nfilt0(j)+1:end,j),j)) ...
|
|
|
|
rmse_txt(j)])])
|
|
|
|
% disp([vvarvecm(j,:), sprintf('%15.5g',[min(logpo2(ixx(1:nfilt,j))) ...
|
|
|
|
% max(logpo2(ixx(1:nfilt,j))) ...
|
|
|
|
% min(logpo2(ixx(nfilt+1:end,j))) ...
|
|
|
|
% max(logpo2(ixx(nfilt+1:end,j)))])])
|
2006-03-24 17:27:56 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
SP=zeros(npar+nshock,size(vvarvecm,1));
|
|
|
|
for j=1:size(vvarvecm,1),
|
|
|
|
ns=find(PP(:,j)<alpha);
|
|
|
|
SP(ns,j)=ones(size(ns));
|
|
|
|
SS(:,j)=SS(:,j).*SP(:,j);
|
|
|
|
end
|
|
|
|
|
|
|
|
for j=1:npar+nshock, %estim_params_.np,
|
|
|
|
nsp(j)=length(find(SP(j,:)));
|
|
|
|
end
|
|
|
|
snam0=param_names(find(nsp==0),:);
|
|
|
|
snam1=param_names(find(nsp==1),:);
|
|
|
|
snam2=param_names(find(nsp>1),:);
|
|
|
|
snam=param_names(find(nsp>0),:);
|
|
|
|
% snam0=bayestopt_.name(find(nsp==0));
|
|
|
|
% snam1=bayestopt_.name(find(nsp==1));
|
|
|
|
% snam2=bayestopt_.name(find(nsp>1));
|
|
|
|
% snam=bayestopt_.name(find(nsp>0));
|
|
|
|
nsnam=(find(nsp>1));
|
|
|
|
|
|
|
|
disp(' ')
|
|
|
|
disp(' ')
|
|
|
|
disp('These parameters do not affect significantly the fit of ANY observed series:')
|
|
|
|
disp(snam0)
|
|
|
|
disp(' ')
|
|
|
|
disp('These parameters affect ONE single observed series:')
|
|
|
|
disp(snam1)
|
|
|
|
disp(' ')
|
|
|
|
disp('These parameters affect MORE THAN ONE observed series: trade off exists!')
|
|
|
|
disp(snam2)
|
|
|
|
|
|
|
|
|
|
|
|
%pnam=bayestopt_.name(end-estim_params_.np+1:end);
|
|
|
|
pnam=bayestopt_.name;
|
|
|
|
|
|
|
|
% plot trade-offs
|
|
|
|
a00=jet(size(vvarvecm,1));
|
2007-04-10 13:51:33 +02:00
|
|
|
for ix=1:ceil(length(nsnam)/5),
|
2006-03-24 17:27:56 +01:00
|
|
|
figure,
|
2007-04-10 13:51:33 +02:00
|
|
|
for j=1+5*(ix-1):min(size(snam2,1),5*ix),
|
|
|
|
subplot(2,3,j-5*(ix-1))
|
2006-03-24 17:27:56 +01:00
|
|
|
%h0=cumplot(x(:,nsnam(j)+nshock));
|
|
|
|
h0=cumplot(x(:,nsnam(j)));
|
2006-06-20 16:58:43 +02:00
|
|
|
set(h0,'color',[0 0 0])
|
2006-03-24 17:27:56 +01:00
|
|
|
hold on,
|
|
|
|
np=find(SP(nsnam(j),:));
|
|
|
|
%a0=jet(nsp(nsnam(j)));
|
|
|
|
a0=a00(np,:);
|
|
|
|
for i=1:nsp(nsnam(j)), %size(vvarvecm,1),
|
|
|
|
%h0=cumplot(x(ixx(1:nfilt,np(i)),nsnam(j)+nshock));
|
2006-05-04 11:06:57 +02:00
|
|
|
h0=cumplot(x(ixx(1:nfilt0(np(i)),np(i)),nsnam(j)));
|
2006-03-24 17:27:56 +01:00
|
|
|
set(h0,'color',a0(i,:))
|
|
|
|
end
|
|
|
|
ydum=get(gca,'ylim');
|
|
|
|
%xdum=xparam1(nshock+nsnam(j));
|
|
|
|
xdum=xparam1(nsnam(j));
|
|
|
|
h1=plot([xdum xdum],ydum);
|
|
|
|
set(h1,'color',[0.85 0.85 0.85],'linewidth',2)
|
2007-04-10 13:51:33 +02:00
|
|
|
xlabel('')
|
|
|
|
title([pnam{nsnam(j)}],'interpreter','none')
|
|
|
|
end
|
|
|
|
%subplot(3,2,6)
|
2006-03-24 17:27:56 +01:00
|
|
|
h0=legend(str2mat('base',vvarvecm(np,:)),0);
|
2007-04-10 13:51:33 +02:00
|
|
|
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3])
|
2006-03-24 17:27:56 +01:00
|
|
|
%h0=legend({'base',vnam{np}}',0);
|
|
|
|
set(findobj(get(h0,'children'),'type','text'),'interpreter','none')
|
2006-04-11 17:32:22 +02:00
|
|
|
if options_.opt_gsa.ppost
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_post_',num2str(ix)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_post_' int2str(ix)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_post_' int2str(ix)]);
|
2006-03-24 17:27:56 +01:00
|
|
|
else
|
2006-04-11 17:32:22 +02:00
|
|
|
if options_.opt_gsa.pprior
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_prior_',num2str(ix)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_prior_' int2str(ix)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_prior_' int2str(ix)]);
|
2006-04-11 17:32:22 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_mc_',num2str(ix)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_mc_' int2str(ix)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_mc_' int2str(ix)]);
|
2006-04-11 17:32:22 +02:00
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
close all
|
|
|
|
|
|
|
|
for j=1:size(SP,2),
|
|
|
|
nsx(j)=length(find(SP(:,j)));
|
|
|
|
end
|
|
|
|
|
|
|
|
number_of_grid_points = 2^9; % 2^9 = 512 !... Must be a power of two.
|
|
|
|
bandwidth = 0; % Rule of thumb optimal bandwidth parameter.
|
|
|
|
kernel_function = 'gaussian'; % Gaussian kernel for Fast Fourrier Transform approximaton.
|
|
|
|
%kernel_function = 'uniform'; % Gaussian kernel for Fast Fourrier Transform approximaton.
|
|
|
|
|
2007-04-10 13:51:33 +02:00
|
|
|
for ix=1:ceil(length(nsnam)/5),
|
2006-05-04 11:06:57 +02:00
|
|
|
figure,
|
2007-04-10 13:51:33 +02:00
|
|
|
for j=1+5*(ix-1):min(size(snam2,1),5*ix),
|
|
|
|
subplot(2,3,j-5*(ix-1))
|
2006-05-04 11:06:57 +02:00
|
|
|
optimal_bandwidth = mh_optimal_bandwidth(x(:,nsnam(j)),size(x,1),bandwidth,kernel_function);
|
|
|
|
[x1,f1] = kernel_density_estimate(x(:,nsnam(j)),number_of_grid_points,...
|
|
|
|
optimal_bandwidth,kernel_function);
|
2006-06-20 16:58:43 +02:00
|
|
|
h0 = plot(x1, f1,'k');
|
2006-05-04 11:06:57 +02:00
|
|
|
hold on,
|
|
|
|
np=find(SP(nsnam(j),:));
|
|
|
|
%a0=jet(nsp(nsnam(j)));
|
|
|
|
a0=a00(np,:);
|
|
|
|
for i=1:nsp(nsnam(j)), %size(vvarvecm,1),
|
|
|
|
optimal_bandwidth = mh_optimal_bandwidth(x(ixx(1:nfilt0(np(i)),np(i)),nsnam(j)),nfilt,bandwidth,kernel_function);
|
|
|
|
[x1,f1] = kernel_density_estimate(x(ixx(1:nfilt0(np(i)),np(i)),nsnam(j)),number_of_grid_points,...
|
|
|
|
optimal_bandwidth,kernel_function);
|
|
|
|
h0 = plot(x1, f1);
|
|
|
|
set(h0,'color',a0(i,:))
|
|
|
|
end
|
|
|
|
ydum=get(gca,'ylim');
|
|
|
|
set(gca,'ylim',[0 ydum(2)]);
|
|
|
|
%xdum=xparam1(nshock+nsnam(j));
|
|
|
|
xdum=xparam1(nsnam(j));
|
|
|
|
h1=plot([xdum xdum],[0 ydum(2)]);
|
|
|
|
set(h1,'color',[0.85 0.85 0.85],'linewidth',2)
|
2007-04-10 13:51:33 +02:00
|
|
|
xlabel('')
|
|
|
|
title([pnam{nsnam(j)}],'interpreter','none')
|
|
|
|
end
|
2006-05-04 11:06:57 +02:00
|
|
|
h0=legend(str2mat('base',vvarvecm(np,:)),0);
|
2007-04-10 13:51:33 +02:00
|
|
|
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3])
|
2006-05-04 11:06:57 +02:00
|
|
|
%h0=legend({'base',vnam{np}}',0);
|
|
|
|
set(findobj(get(h0,'children'),'type','text'),'interpreter','none')
|
|
|
|
if options_.opt_gsa.ppost
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_post_dens_',num2str(ix)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_post_dens_' int2str(ix)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_post_dens_' int2str(ix)]);
|
2006-05-04 11:06:57 +02:00
|
|
|
else
|
|
|
|
if options_.opt_gsa.pprior
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_prior_dens_',num2str(ix)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_prior_dens_' int2str(ix)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_prior_dens_' int2str(ix)]);
|
2006-05-04 11:06:57 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
saveas(gcf,[OutDir,'\',fname_,'_rmse_mc_dens_',num2str(ix)])
|
|
|
|
eval(['print -depsc2 ' OutDir '\' fname_ '_rmse_mc_dens_' int2str(ix)]);
|
|
|
|
eval(['print -dpdf ' OutDir '\' fname_ '_rmse_mc_dens_' int2str(ix)]);
|
2006-05-04 11:06:57 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
close all
|
|
|
|
|
2006-03-24 17:27:56 +01:00
|
|
|
% for j=1:size(SP,2),
|
|
|
|
% nfig=0;
|
|
|
|
% np=find(SP(:,j));
|
|
|
|
% for i=1:nsx(j), %size(vvarvecm,1),
|
|
|
|
% if mod(i,12)==1,
|
|
|
|
% nfig=nfig+1;
|
|
|
|
% %figure('name',['Sensitivity of fit of ',vnam{j}]),
|
|
|
|
% figure('name',['Sensitivity of fit of ',deblank(vvarvecm(j,:)),' ',num2str(nfig)]),
|
|
|
|
% end
|
|
|
|
%
|
|
|
|
% subplot(3,4,i-12*(nfig-1))
|
|
|
|
% optimal_bandwidth = mh_optimal_bandwidth(x(ixx(1:nfilt,j),np(i)),nfilt,bandwidth,kernel_function);
|
|
|
|
% [x1,f1] = kernel_density_estimate(x(ixx(1:nfilt,j),np(i)),number_of_grid_points,...
|
|
|
|
% optimal_bandwidth,kernel_function);
|
|
|
|
% plot(x1, f1,':k','linewidth',2)
|
|
|
|
% optimal_bandwidth = mh_optimal_bandwidth(x(ixx(nfilt+1:end,j),np(i)),nruns-nfilt,bandwidth,kernel_function);
|
|
|
|
% [x1,f1] = kernel_density_estimate(x(ixx(nfilt+1:end,j),np(i)),number_of_grid_points,...
|
|
|
|
% optimal_bandwidth,kernel_function);
|
|
|
|
% hold on, plot(x1, f1,'k','linewidth',2)
|
|
|
|
% ydum=get(gca,'ylim');
|
|
|
|
% %xdum=xparam1(nshock+np(i));
|
|
|
|
% xdum=xparam1(np(i));
|
|
|
|
% h1=plot([xdum xdum],ydum);
|
|
|
|
% set(h1,'color',[0.85 0.85 0.85],'linewidth',2)
|
|
|
|
% %xdum1=mean(x(ixx(1:nfilt,j),np(i)+nshock));
|
|
|
|
% xdum1=mean(x(ixx(1:nfilt,j),np(i)));
|
|
|
|
% h2=plot([xdum1 xdum1],ydum);
|
|
|
|
% set(h2,'color',[0 1 0],'linewidth',2)
|
|
|
|
% % h0=cumplot(x(nfilt+1:end,np(i)+nshock));
|
|
|
|
% % set(h0,'color',[1 1 1])
|
|
|
|
% % hold on,
|
|
|
|
% % h0=cumplot(x(ixx(1:nfilt,j),np(i)+nshock));
|
|
|
|
% % set(h0,'linestyle',':','color',[1 1 1])
|
|
|
|
% %title([pnam{np(i)}])
|
|
|
|
% title([pnam{np(i)},'. K-S prob ', num2str(PP(np(i),j))],'interpreter','none')
|
|
|
|
% xlabel('')
|
|
|
|
% if mod(i,12)==0 | i==nsx(j),
|
2007-04-04 10:19:51 +02:00
|
|
|
% saveas(gcf,[fname_,'_rmse_',deblank(vvarvecm(j,:)),'_',int2str(nfig)])
|
2006-03-24 17:27:56 +01:00
|
|
|
% close(gcf)
|
|
|
|
% end
|
|
|
|
% end
|
|
|
|
% end
|
|
|
|
|
|
|
|
|
|
|
|
disp(' ')
|
|
|
|
disp(' ')
|
|
|
|
disp('Sensitivity table (significance and direction):')
|
|
|
|
vav=char(zeros(1, size(param_names,2)+3 ));
|
|
|
|
ibl = 12-size(vvarvecm,2);
|
|
|
|
for j=1:size(vvarvecm,1),
|
|
|
|
vav = [vav, char(zeros(1,ibl)),vvarvecm(j,:)];
|
|
|
|
end
|
|
|
|
disp(vav)
|
|
|
|
for j=1:npar+nshock, %estim_params_.np,
|
|
|
|
%disp([param_names(j,:), sprintf('%8.5g',SP(j,:))])
|
|
|
|
disp([param_names(j,:),' ', sprintf('%12.3g',PP(j,:))])
|
|
|
|
disp([char(zeros(1, size(param_names,2)+3 )),sprintf(' (%6g)',SS(j,:))])
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
disp(' ')
|
|
|
|
disp(' ')
|
|
|
|
disp('Starting bivariate analysis:')
|
|
|
|
|
|
|
|
for i=1:size(vvarvecm,1)
|
2006-04-11 17:32:22 +02:00
|
|
|
if options_.opt_gsa.ppost
|
2007-04-04 10:19:51 +02:00
|
|
|
fnam = ['rmse_post_',deblank(vvarvecm(i,:))];
|
2006-04-11 17:32:22 +02:00
|
|
|
else
|
2006-05-04 11:06:57 +02:00
|
|
|
if options_.opt_gsa.pprior
|
2007-04-04 10:19:51 +02:00
|
|
|
fnam = ['rmse_prior_',deblank(vvarvecm(i,:))];
|
2006-05-04 11:06:57 +02:00
|
|
|
else
|
2007-04-04 10:19:51 +02:00
|
|
|
fnam = ['rmse_mc_',deblank(vvarvecm(i,:))];
|
2006-05-04 11:06:57 +02:00
|
|
|
end
|
2006-03-24 17:27:56 +01:00
|
|
|
end
|
2006-05-04 11:06:57 +02:00
|
|
|
stab_map_2(x(ixx(1:nfilt0(i),i),:),alpha2,fnam, OutDir);
|
2006-03-24 17:27:56 +01:00
|
|
|
|
|
|
|
% [pc,latent,explained] = pcacov(c0);
|
|
|
|
% %figure, bar([explained cumsum(explained)])
|
|
|
|
% ifig=0;
|
|
|
|
% j2=0;
|
|
|
|
% for j=1:npar+nshock,
|
|
|
|
% i2=find(abs(pc(:,j))>alphaPC);
|
|
|
|
% if ~isempty(i2),
|
|
|
|
% j2=j2+1;
|
|
|
|
% if mod(j2,12)==1,
|
|
|
|
% ifig=ifig+1;
|
|
|
|
% figure('name',['PCA of the filtered sample ',deblank(vvarvecm(i,:)),' ',num2str(ifig)]),
|
|
|
|
% end
|
|
|
|
% subplot(3,4,j2-(ifig-1)*12)
|
|
|
|
% bar(pc(i2,j)),
|
|
|
|
% set(gca,'xticklabel',bayestopt_.name(i2)),
|
|
|
|
% set(gca,'xtick',[1:length(i2)])
|
|
|
|
% title(['PC ',num2str(j),'. Explained ',num2str(explained(j)),'%'])
|
|
|
|
% end
|
|
|
|
% if (mod(j2,12)==0 | j==(npar+nshock)) & j2,
|
|
|
|
% saveas(gcf,[fname_,'_SA_PCA_',deblank(vvarvecm(i,:)),'_',int2str(ifig)])
|
|
|
|
% end
|
|
|
|
% end
|
|
|
|
% close all
|
|
|
|
end
|
|
|
|
|
2006-09-28 14:30:58 +02:00
|
|
|
end
|