Use cells of strings instead of char arrays.
parent
2be12bd50d
commit
7be8f10e0e
|
@ -17,7 +17,7 @@ global M_
|
|||
% read out parameters to access them with their name
|
||||
NumberOfParameters = M_.param_nbr;
|
||||
for ii = 1:NumberOfParameters
|
||||
paramname = deblank(M_.param_names(ii,:));
|
||||
paramname = M_.param_names{ii};
|
||||
eval([ paramname ' = M_.params(' int2str(ii) ');']);
|
||||
end
|
||||
% initialize indicator
|
||||
|
@ -96,11 +96,11 @@ g2=epsilon/(epsilon-1)*g1;
|
|||
%% end own model equations
|
||||
|
||||
for iter = 1:length(M_.params) %update parameters set in the file
|
||||
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
|
||||
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
||||
end
|
||||
|
||||
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
||||
for ii = 1:NumberOfEndogenousVariables
|
||||
varname = deblank(M_.endo_names(ii,:));
|
||||
varname = M_.endo_names{ii};
|
||||
eval(['ys(' int2str(ii) ') = ' varname ';']);
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ function oo_ = GetPosteriorParametersStatistics(estim_params_, M_, options_, bay
|
|||
% options_ [structure]
|
||||
% bayestopt_ [structure]
|
||||
% oo_ [structure]
|
||||
% pnames [char] Array of char, names of the prior shapes available
|
||||
% pnames [cell] cell of strings, names of the prior shapes available
|
||||
%
|
||||
% OUTPUTS
|
||||
% oo_ [structure]
|
||||
|
@ -16,7 +16,7 @@ function oo_ = GetPosteriorParametersStatistics(estim_params_, M_, options_, bay
|
|||
% SPECIAL REQUIREMENTS
|
||||
% None.
|
||||
|
||||
% Copyright (C) 2006-2017 Dynare Team
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -60,7 +60,7 @@ FirstMhFile = record.KeepedDraws.FirstMhFile;
|
|||
NumberOfDraws = TotalNumberOfMhDraws-floor(options_.mh_drop*TotalNumberOfMhDraws);
|
||||
clear record;
|
||||
|
||||
header_width = row_header_width(M_,estim_params_,bayestopt_);
|
||||
header_width = row_header_width(M_, estim_params_, bayestopt_);
|
||||
hpd_interval=[num2str(options_.mh_conf_sig*100), '% HPD interval'];
|
||||
tit2 = sprintf('%-*s %12s %12s %23s %8s %12s\n',header_width,' ','prior mean','post. mean',hpd_interval,'prior','pstdev');
|
||||
pformat = '%-*s %12.3f % 12.4f %11.4f %11.4f %7s %12.4f';
|
||||
|
@ -70,23 +70,26 @@ disp('ESTIMATION RESULTS')
|
|||
skipline()
|
||||
|
||||
try
|
||||
disp(sprintf('Log data density is %f.',oo_.MarginalDensity.ModifiedHarmonicMean))
|
||||
disp(sprintf('Log data density is %f.', oo_.MarginalDensity.ModifiedHarmonicMean))
|
||||
catch
|
||||
[marginal,oo_] = marginal_density(M_, options_, estim_params_, oo_, bayestopt_);
|
||||
disp(sprintf('Log data density is %f.',oo_.MarginalDensity.ModifiedHarmonicMean))
|
||||
disp(sprintf('Log data density is %f.', oo_.MarginalDensity.ModifiedHarmonicMean))
|
||||
end
|
||||
|
||||
num_draws=NumberOfDraws*options_.mh_nblck;
|
||||
hpd_draws = round((1-options_.mh_conf_sig)*num_draws);
|
||||
|
||||
if hpd_draws<2
|
||||
fprintf('posterior_moments: There are not enough draws computes to compute HPD Intervals. Skipping their computation.\n')
|
||||
end
|
||||
if num_draws<9
|
||||
fprintf('posterior_moments: There are not enough draws computes to compute deciles. Skipping their computation.\n')
|
||||
end
|
||||
|
||||
if np
|
||||
type = 'parameters';
|
||||
if TeX
|
||||
fid = TeXBegin(OutputFolder,M_.fname,1,type);
|
||||
fid = TeXBegin(OutputFolder, M_.fname, 1, type);
|
||||
end
|
||||
skipline()
|
||||
disp(type)
|
||||
|
@ -94,44 +97,42 @@ if np
|
|||
ip = nvx+nvn+ncx+ncn+1;
|
||||
for i=1:np
|
||||
if options_.mh_replic
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, ...
|
||||
density] = posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
Draws = GetAllPosteriorDraws(ip, FirstMhFile, FirstLine, TotalNumberOfMhFiles, NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = posterior_moments(Draws, 1, options_.mh_conf_sig);
|
||||
name = bayestopt_.name{ip};
|
||||
oo_ = Filloo(oo_,name,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
oo_ = Filloo(oo_, name, type, post_mean, hpd_interval, post_median, post_var, post_deciles, density);
|
||||
else
|
||||
try
|
||||
name = bayestopt_.name{ip};
|
||||
[post_mean,hpd_interval,post_var] = Extractoo(oo_,name,type);
|
||||
[post_mean, hpd_interval, post_var] = Extractoo(oo_, name, type);
|
||||
catch
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, ...
|
||||
density] = posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
Draws = GetAllPosteriorDraws(ip, FirstMhFile, FirstLine, TotalNumberOfMhFiles, NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = posterior_moments(Draws, 1, options_.mh_conf_sig);
|
||||
name = bayestopt_.name{ip};
|
||||
oo_ = Filloo(oo_,name,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
oo_ = Filloo(oo_, name, type, post_mean, hpd_interval, post_median, post_var, post_deciles, density);
|
||||
end
|
||||
end
|
||||
disp(sprintf(pformat,header_width,name,bayestopt_.p1(ip),...
|
||||
disp(sprintf(pformat, header_width, name, bayestopt_.p1(ip),...
|
||||
post_mean, ...
|
||||
hpd_interval, ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:), ...
|
||||
pnames{bayestopt_.pshape(ip)+1}, ...
|
||||
bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
k = estim_params_.param_vals(i,1);
|
||||
name = deblank(M_.param_names_tex(k,:));
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
name = M_.param_names_tex{k};
|
||||
TeXCore(fid, name, pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p1(ip), bayestopt_.p2(ip), post_mean, sqrt(post_var), hpd_interval);
|
||||
end
|
||||
ip = ip+1;
|
||||
end
|
||||
if TeX
|
||||
TeXEnd(fid,1,type);
|
||||
TeXEnd(fid, 1, type);
|
||||
end
|
||||
end
|
||||
|
||||
if nvx
|
||||
type = 'shocks_std';
|
||||
if TeX
|
||||
fid = TeXBegin(OutputFolder,FileName,2,'standard deviation of structural shocks');
|
||||
fid = TeXBegin(OutputFolder, FileName,2, 'standard deviation of structural shocks');
|
||||
end
|
||||
ip = 1;
|
||||
skipline()
|
||||
|
@ -139,45 +140,43 @@ if nvx
|
|||
disp(tit2)
|
||||
for i=1:nvx
|
||||
if options_.mh_replic
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
Draws = GetAllPosteriorDraws(ip, FirstMhFile, FirstLine, TotalNumberOfMhFiles, NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = posterior_moments(Draws, 1, options_.mh_conf_sig);
|
||||
k = estim_params_.var_exo(i,1);
|
||||
name = deblank(M_.exo_names(k,:));
|
||||
oo_ = Filloo(oo_,name,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
name = M_.exo_names{k};
|
||||
oo_ = Filloo(oo_, name, type, post_mean, hpd_interval, post_median, post_var, post_deciles, density);
|
||||
M_.Sigma_e(k,k) = post_mean*post_mean;
|
||||
else
|
||||
try
|
||||
k = estim_params_.var_exo(i,1);
|
||||
name = deblank(M_.exo_names(k,:));
|
||||
[post_mean,hpd_interval,post_var] = Extractoo(oo_,name,type);
|
||||
name = M_.exo_names{k};
|
||||
[post_mean, hpd_interval, post_var] = Extractoo(oo_, name, type);
|
||||
catch
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
Draws = GetAllPosteriorDraws(ip, FirstMhFile, FirstLine, TotalNumberOfMhFiles, NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
posterior_moments(Draws, 1, options_.mh_conf_sig);
|
||||
k = estim_params_.var_exo(i,1);
|
||||
name = deblank(M_.exo_names(k,:));
|
||||
oo_ = Filloo(oo_,name,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
name = M_.exo_names{k};
|
||||
oo_ = Filloo(oo_, name, type, post_mean, hpd_interval, post_median, post_var, post_deciles, density);
|
||||
M_.Sigma_e(k,k) = post_mean*post_mean;
|
||||
end
|
||||
end
|
||||
disp(sprintf(pformat,header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval,...
|
||||
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
|
||||
disp(sprintf(pformat,header_width,name, bayestopt_.p1(ip), post_mean, hpd_interval, pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
name = deblank(M_.exo_names_tex(k,:));
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
name = M_.exo_names_tex{k};
|
||||
TeXCore(fid,name, pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p1(ip), bayestopt_.p2(ip), post_mean, sqrt(post_var), hpd_interval);
|
||||
end
|
||||
ip = ip+1;
|
||||
end
|
||||
if TeX
|
||||
TeXEnd(fid,2,'standard deviation of structural shocks');
|
||||
TeXEnd(fid, 2, 'standard deviation of structural shocks');
|
||||
end
|
||||
end
|
||||
|
||||
if nvn
|
||||
type = 'measurement_errors_std';
|
||||
if TeX
|
||||
fid = TeXBegin(OutputFolder,FileName,3,'standard deviation of measurement errors');
|
||||
fid = TeXBegin(OutputFolder, FileName, 3, 'standard deviation of measurement errors');
|
||||
end
|
||||
skipline()
|
||||
disp('standard deviation of measurement errors')
|
||||
|
@ -185,37 +184,34 @@ if nvn
|
|||
ip = nvx+1;
|
||||
for i=1:nvn
|
||||
if options_.mh_replic
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
Draws = GetAllPosteriorDraws(ip, FirstMhFile, FirstLine, TotalNumberOfMhFiles, NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = posterior_moments(Draws, 1, options_.mh_conf_sig);
|
||||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i,1)};
|
||||
oo_ = Filloo(oo_,name,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
oo_ = Filloo(oo_, name, type, post_mean, hpd_interval, post_median, post_var, post_deciles, density);
|
||||
else
|
||||
try
|
||||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i,1)};
|
||||
[post_mean,hpd_interval,post_var] = Extractoo(oo_,name,type);
|
||||
catch
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i,1)};
|
||||
oo_ = Filloo(oo_,name,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
end
|
||||
end
|
||||
disp(sprintf(pformat,header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval, ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
|
||||
disp(sprintf(pformat, header_width, name,bayestopt_.p1(ip), post_mean, hpd_interval, pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
k = estim_params_.var_endo(i,1);
|
||||
name = deblank(M_.endo_names_tex(k,:));
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
name = M_.endo_names_tex{k};
|
||||
TeXCore(fid, name, pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p1(ip), bayestopt_.p2(ip), post_mean, sqrt(post_var), hpd_interval);
|
||||
end
|
||||
ip = ip+1;
|
||||
end
|
||||
if TeX
|
||||
TeXEnd(fid,3,'standard deviation of measurement errors');
|
||||
TeXEnd(fid, 3, 'standard deviation of measurement errors');
|
||||
end
|
||||
end
|
||||
|
||||
if ncx
|
||||
type = 'shocks_corr';
|
||||
if TeX
|
||||
|
@ -227,53 +223,49 @@ if ncx
|
|||
ip = nvx+nvn+1;
|
||||
for i=1:ncx
|
||||
if options_.mh_replic
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
Draws = GetAllPosteriorDraws(ip, FirstMhFile, FirstLine, TotalNumberOfMhFiles, NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
k1 = estim_params_.corrx(i,1);
|
||||
k2 = estim_params_.corrx(i,2);
|
||||
name = [deblank(M_.exo_names(k1,:)) ',' deblank(M_.exo_names(k2,:))];
|
||||
NAME = [deblank(M_.exo_names(k1,:)) '_' deblank(M_.exo_names(k2,:))];
|
||||
oo_ = Filloo(oo_,NAME,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
name = sprintf('%s,%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
NAME = sprintf('%s_%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
oo_ = Filloo(oo_, NAME, type, post_mean, hpd_interval, post_median, post_var, post_deciles, density);
|
||||
M_.Sigma_e(k1,k2) = post_mean*sqrt(M_.Sigma_e(k1,k1)*M_.Sigma_e(k2,k2));
|
||||
M_.Sigma_e(k2,k1) = M_.Sigma_e(k1,k2);
|
||||
else
|
||||
try
|
||||
k1 = estim_params_.corrx(i,1);
|
||||
k2 = estim_params_.corrx(i,2);
|
||||
name = [deblank(M_.exo_names(k1,:)) ',' deblank(M_.exo_names(k2,:))];
|
||||
NAME = [deblank(M_.exo_names(k1,:)) '_' deblank(M_.exo_names(k2,:))];
|
||||
[post_mean,hpd_interval,post_var] = Extractoo(oo_,NAME,type);
|
||||
name = sprintf('%s,%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
NAME = sprintf('%s_%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
[post_mean,hpd_interval,post_var] = Extractoo(oo_, NAME, type);
|
||||
catch
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
Draws = GetAllPosteriorDraws(ip, FirstMhFile, FirstLine, TotalNumberOfMhFiles, NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = posterior_moments(Draws, 1, options_.mh_conf_sig);
|
||||
k1 = estim_params_.corrx(i,1);
|
||||
k2 = estim_params_.corrx(i,2);
|
||||
name = [deblank(M_.exo_names(k1,:)) ',' deblank(M_.exo_names(k2,:))];
|
||||
NAME = [deblank(M_.exo_names(k1,:)) '_' deblank(M_.exo_names(k2,:))];
|
||||
oo_ = Filloo(oo_,NAME,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
name = sprintf('%s,%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
NAME = sprintf('%s_%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
oo_ = Filloo(oo_, NAME, type, post_mean, hpd_interval, post_median, post_var, post_deciles, density);
|
||||
M_.Sigma_e(k1,k2) = post_mean*sqrt(M_.Sigma_e(k1,k1)*M_.Sigma_e(k2,k2));
|
||||
M_.Sigma_e(k2,k1) = M_.Sigma_e(k1,k2);
|
||||
end
|
||||
end
|
||||
disp(sprintf(pformat, header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval, ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
|
||||
disp(sprintf(pformat, header_width,name, bayestopt_.p1(ip), post_mean, hpd_interval, pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
name = ['(',deblank(M_.exo_names_tex(k1,:)) ',' deblank(M_.exo_names_tex(k2,:)),')'];
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
name = sprintf('(%s,%s)', M_.exo_names_tex{k1}, M_.exo_names_tex{k2});
|
||||
TeXCore(fid, name, pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p1(ip), bayestopt_.p2(ip), post_mean, sqrt(post_var), hpd_interval);
|
||||
end
|
||||
ip = ip+1;
|
||||
end
|
||||
if TeX
|
||||
TeXEnd(fid,4,'correlation of structural shocks');
|
||||
TeXEnd(fid, 4, 'correlation of structural shocks');
|
||||
end
|
||||
end
|
||||
if ncn
|
||||
type = 'measurement_errors_corr';
|
||||
if TeX
|
||||
fid = TeXBegin(OutputFolder,FileName,5,'correlation of measurement errors');
|
||||
fid = TeXBegin(OutputFolder, FileName, 5, 'correlation of measurement errors');
|
||||
end
|
||||
skipline()
|
||||
disp('correlation of measurement errors')
|
||||
|
@ -282,44 +274,38 @@ if ncn
|
|||
for i=1:ncn
|
||||
if options_.mh_replic
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = posterior_moments(Draws, 1, options_.mh_conf_sig);
|
||||
k1 = estim_params_.corrn(i,1);
|
||||
k2 = estim_params_.corrn(i,2);
|
||||
name = [deblank(M_.endo_names(k1,:)) ',' deblank(M_.endo_names(k2,:))];
|
||||
NAME = [deblank(M_.endo_names(k1,:)) '_' deblank(M_.endo_names(k2,:))];
|
||||
oo_ = Filloo(oo_,NAME,type,post_mean,hpd_interval,...
|
||||
post_median,post_var,post_deciles,density);
|
||||
name = sprintf('%s,%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
NAME = sprintf('%s_%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
oo_ = Filloo(oo_, NAME, type, post_mean, hpd_interval, post_median, post_var, post_deciles,density);
|
||||
else
|
||||
try
|
||||
k1 = estim_params_.corrn(i,1);
|
||||
k2 = estim_params_.corrn(i,2);
|
||||
name = [deblank(M_.endo_names(k1,:)) ',' deblank(M_.endo_names(k2,:))];
|
||||
NAME = [deblank(M_.endo_names(k1,:)) '_' deblank(M_.endo_names(k2,:))];
|
||||
[post_mean,hpd_interval,post_var] = Extractoo(oo_,NAME,type);
|
||||
name = sprintf('%s,%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
NAME = sprintf('%s_%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
[post_mean,hpd_interval,post_var] = Extractoo(oo_, NAME, type);
|
||||
catch
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
Draws = GetAllPosteriorDraws(ip, FirstMhFile, FirstLine, TotalNumberOfMhFiles, NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = posterior_moments(Draws, 1, options_.mh_conf_sig);
|
||||
k1 = estim_params_.corrn(i,1);
|
||||
k2 = estim_params_.corrn(i,2);
|
||||
name = [deblank(M_.endo_names(k1,:)) ',' deblank(M_.endo_names(k2,:))];
|
||||
NAME = [deblank(M_.endo_names(k1,:)) '_' deblank(M_.endo_names(k2,:))];
|
||||
oo_ = Filloo(oo_,NAME,type,post_mean,hpd_interval,...
|
||||
post_median,post_var,post_deciles,density);
|
||||
name = sprintf('%s,%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
NAME = sprintf('%s_%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
oo_ = Filloo(oo_, NAME, type, post_mean, hpd_interval, post_median, post_var, post_deciles, density);
|
||||
end
|
||||
end
|
||||
disp(sprintf(pformat, header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval, ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
|
||||
disp(sprintf(pformat, header_width, name, bayestopt_.p1(ip), post_mean, hpd_interval, pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
name = ['(',deblank(M_.endo_names_tex(k1,:)) ',' deblank(M_.endo_names_tex(k2,:)),')'];
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
name = sprintf('(%s,%s)', M_.endo_names_tex{k1}, M_.endo_names_tex{k2});
|
||||
TeXCore(fid, name, pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p1(ip), bayestopt_.p2(ip), post_mean, sqrt(post_var), hpd_interval);
|
||||
end
|
||||
ip = ip+1;
|
||||
end
|
||||
if TeX
|
||||
TeXEnd(fid,5,'correlation of measurement errors');
|
||||
TeXEnd(fid, 5, 'correlation of measurement errors');
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -327,57 +313,57 @@ end
|
|||
%
|
||||
%% subfunctions:
|
||||
%
|
||||
function fid = TeXBegin(directory,fname,fnum,title)
|
||||
function fid = TeXBegin(directory, fname, fnum, title)
|
||||
TeXfile = [directory '/' fname '_Posterior_Mean_' int2str(fnum) '.tex'];
|
||||
fidTeX = fopen(TeXfile,'w');
|
||||
fprintf(fidTeX,'%% TeX-table generated by Dynare.\n');
|
||||
fprintf(fidTeX,['%% RESULTS FROM METROPOLIS HASTINGS (' title ')\n']);
|
||||
fprintf(fidTeX,['%% ' datestr(now,0)]);
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,'\\begin{center}\n');
|
||||
fprintf(fidTeX,'\\begin{longtable}{llcccccc} \n');
|
||||
fprintf(fidTeX,['\\caption{Results from Metropolis-Hastings (' title ')}\n ']);
|
||||
fprintf(fidTeX,['\\label{Table:MHPosterior:' int2str(fnum) '}\\\\\n']);
|
||||
fprintf(fidTeX,'\\toprule \n');
|
||||
fprintf(fidTeX,' & \\multicolumn{3}{c}{Prior} & \\multicolumn{4}{c}{Posterior} \\\\\n');
|
||||
fprintf(fidTeX,' \\cmidrule(r{.75em}){2-4} \\cmidrule(r{.75em}){5-8}\n');
|
||||
fprintf(fidTeX,' & Dist. & Mean & Stdev. & Mean & Stdev. & HPD inf & HPD sup\\\\\n');
|
||||
fprintf(fidTeX,'\\midrule \\endfirsthead \n');
|
||||
fprintf(fidTeX,['\\caption{(continued)}\\\\']);
|
||||
fprintf(fidTeX,'\\toprule \n');
|
||||
fprintf(fidTeX,' & \\multicolumn{3}{c}{Prior} & \\multicolumn{4}{c}{Posterior} \\\\\n');
|
||||
fprintf(fidTeX,' \\cmidrule(r{.75em}){2-4} \\cmidrule(r{.75em}){5-8}\n');
|
||||
fprintf(fidTeX,' & Dist. & Mean & Stdev. & Mean & Stdev. & HPD inf & HPD sup\\\\\n');
|
||||
fprintf(fidTeX,'\\midrule \\endhead \n');
|
||||
fprintf(fidTeX, '%% TeX-table generated by Dynare.\n');
|
||||
fprintf(fidTeX, ['%% RESULTS FROM METROPOLIS HASTINGS (' title ')\n']);
|
||||
fprintf(fidTeX, ['%% ' datestr(now, 0)]);
|
||||
fprintf(fidTeX, ' \n');
|
||||
fprintf(fidTeX, ' \n');
|
||||
fprintf(fidTeX, '\\begin{center}\n');
|
||||
fprintf(fidTeX, '\\begin{longtable}{llcccccc} \n');
|
||||
fprintf(fidTeX, ['\\caption{Results from Metropolis-Hastings (' title ')}\n ']);
|
||||
fprintf(fidTeX, ['\\label{Table:MHPosterior:' int2str(fnum) '}\\\\\n']);
|
||||
fprintf(fidTeX, '\\toprule \n');
|
||||
fprintf(fidTeX, ' & \\multicolumn{3}{c}{Prior} & \\multicolumn{4}{c}{Posterior} \\\\\n');
|
||||
fprintf(fidTeX, ' \\cmidrule(r{.75em}){2-4} \\cmidrule(r{.75em}){5-8}\n');
|
||||
fprintf(fidTeX, ' & Dist. & Mean & Stdev. & Mean & Stdev. & HPD inf & HPD sup\\\\\n');
|
||||
fprintf(fidTeX, '\\midrule \\endfirsthead \n');
|
||||
fprintf(fidTeX, ['\\caption{(continued)}\\\\']);
|
||||
fprintf(fidTeX, '\\toprule \n');
|
||||
fprintf(fidTeX, ' & \\multicolumn{3}{c}{Prior} & \\multicolumn{4}{c}{Posterior} \\\\\n');
|
||||
fprintf(fidTeX, ' \\cmidrule(r{.75em}){2-4} \\cmidrule(r{.75em}){5-8}\n');
|
||||
fprintf(fidTeX, ' & Dist. & Mean & Stdev. & Mean & Stdev. & HPD inf & HPD sup\\\\\n');
|
||||
fprintf(fidTeX, '\\midrule \\endhead \n');
|
||||
|
||||
fprintf(fidTeX,'\\bottomrule \\multicolumn{8}{r}{(Continued on next page)} \\endfoot \n');
|
||||
fprintf(fidTeX,'\\bottomrule \\endlastfoot \n');
|
||||
fprintf(fidTeX, '\\bottomrule \\multicolumn{8}{r}{(Continued on next page)} \\endfoot \n');
|
||||
fprintf(fidTeX, '\\bottomrule \\endlastfoot \n');
|
||||
|
||||
|
||||
fid = fidTeX;
|
||||
|
||||
|
||||
function TeXCore(fid,name,shape,priormean,priorstd,postmean,poststd,hpd)
|
||||
function TeXCore(fid, name, shape, priormean, priorstd, postmean, poststd, hpd)
|
||||
fprintf(fid,['$%s$ & %s & %7.3f & %6.4f & %7.3f& %6.4f & %7.4f & %7.4f \\\\ \n'],...
|
||||
name,...
|
||||
shape,...
|
||||
priormean,...
|
||||
priorstd,...
|
||||
postmean,...
|
||||
poststd,...
|
||||
hpd(1),...
|
||||
name, ...
|
||||
shape, ...
|
||||
priormean, ...
|
||||
priorstd, ...
|
||||
postmean, ...
|
||||
poststd, ...
|
||||
hpd(1), ...
|
||||
hpd(2));
|
||||
|
||||
|
||||
function TeXEnd(fid,fnum,title)
|
||||
fprintf(fid,'\\end{longtable}\n ');
|
||||
fprintf(fid,'\\end{center}\n');
|
||||
fprintf(fid,'%% End of TeX file.\n');
|
||||
function TeXEnd(fid, fnum, title)
|
||||
fprintf(fid, '\\end{longtable}\n ');
|
||||
fprintf(fid, '\\end{center}\n');
|
||||
fprintf(fid, '%% End of TeX file.\n');
|
||||
fclose(fid);
|
||||
|
||||
|
||||
function oo = Filloo(oo,name,type,postmean,hpdinterval,postmedian,postvar,postdecile,density)
|
||||
function oo = Filloo(oo, name, type, postmean, hpdinterval, postmedian, postvar, postdecile, density)
|
||||
oo.posterior_mean.(type).(name) = postmean;
|
||||
oo.posterior_hpdinf.(type).(name) = hpdinterval(1);
|
||||
oo.posterior_hpdsup.(type).(name) = hpdinterval(2);
|
||||
|
@ -387,7 +373,7 @@ oo.posterior_std.(type).(name) = sqrt(postvar);
|
|||
oo.posterior_deciles.(type).(name) = postdecile;
|
||||
oo.posterior_density.(type).(name) = density;
|
||||
|
||||
function [post_mean,hpd_interval,post_var] = Extractoo(oo,name,type)
|
||||
function [post_mean,hpd_interval,post_var] = Extractoo(oo, name, type)
|
||||
hpd_interval = zeros(2,1);
|
||||
post_mean = oo.posterior_mean.(type).(name);
|
||||
hpd_interval(1) = oo.posterior_hpdinf.(type).(name);
|
||||
|
|
|
@ -16,7 +16,7 @@ function oo_ = PlotPosteriorDistributions(estim_params_, M_, options_, bayestopt
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2005-2017 Dynare Team
|
||||
% Copyright (C) 2005-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -63,24 +63,24 @@ for i=1:npar
|
|||
subplotnum = subplotnum+1;
|
||||
if subplotnum == 1
|
||||
figunumber = figunumber+1;
|
||||
hfig=dyn_figure(options_.nodisplay,'Name',figurename);
|
||||
hfig=dyn_figure(options_.nodisplay, 'Name', figurename);
|
||||
end
|
||||
[nam,texnam] = get_the_name(i,TeX,M_,estim_params_,options_);
|
||||
[nam,texnam] = get_the_name(i, TeX, M_, estim_params_, options_);
|
||||
if subplotnum == 1
|
||||
NAMES = nam;
|
||||
NAMES = {nam};
|
||||
if TeX
|
||||
TeXNAMES = texnam;
|
||||
TeXNAMES = {texnam};
|
||||
end
|
||||
else
|
||||
NAMES = char(NAMES,nam);
|
||||
NAMES = [NAMES; {nam}];
|
||||
if TeX
|
||||
TeXNAMES = char(TeXNAMES,texnam);
|
||||
TeXNAMES = [TeXNAMES; {texnam}];
|
||||
end
|
||||
end
|
||||
[x2,f2,abscissa,dens,binf2,bsup2] = draw_prior_density(i,bayestopt_);
|
||||
[x2, f2, abscissa, dens, binf2, bsup2] = draw_prior_density(i, bayestopt_);
|
||||
top2 = max(f2);
|
||||
if i <= nvx
|
||||
name = deblank(M_.exo_names(estim_params_.var_exo(i,1),:));
|
||||
name = M_.exo_names{estim_params_.var_exo(i,1)};
|
||||
x1 = oo_.posterior_density.shocks_std.(name)(:,1);
|
||||
f1 = oo_.posterior_density.shocks_std.(name)(:,2);
|
||||
oo_.prior_density.shocks_std.(name)(:,1) = x2;
|
||||
|
@ -101,7 +101,7 @@ for i=1:npar
|
|||
j = i - (nvx+nvn);
|
||||
k1 = estim_params_.corrx(j,1);
|
||||
k2 = estim_params_.corrx(j,2);
|
||||
name = [deblank(M_.exo_names(k1,:)) '_' deblank(M_.exo_names(k2,:))];
|
||||
name = sprintf('%s_%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
x1 = oo_.posterior_density.shocks_corr.(name)(:,1);
|
||||
f1 = oo_.posterior_density.shocks_corr.(name)(:,2);
|
||||
oo_.prior_density.shocks_corr.(name)(:,1) = x2;
|
||||
|
@ -113,7 +113,7 @@ for i=1:npar
|
|||
j = i - (nvx+nvn+ncx);
|
||||
k1 = estim_params_.corrn(j,1);
|
||||
k2 = estim_params_.corrn(j,2);
|
||||
name = [deblank(M_.endo_names(k1,:)) '_' deblank(M_.endo_names(k2,:))];
|
||||
name = sprintf('%s_%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
x1 = oo_.posterior_density.measurement_errors_corr.(name)(:,1);
|
||||
f1 = oo_.posterior_density.measurement_errors_corr.(name)(:,2);
|
||||
oo_.prior_density.measurement_errors_corr.(name)(:,1) = x2;
|
||||
|
@ -123,7 +123,7 @@ for i=1:npar
|
|||
end
|
||||
else
|
||||
j = i - (nvx+nvn+ncx+ncn);
|
||||
name = deblank(M_.param_names(estim_params_.param_vals(j,1),:));
|
||||
name = M_.param_names{estim_params_.param_vals(j,1)};
|
||||
x1 = oo_.posterior_density.parameters.(name)(:,1);
|
||||
f1 = oo_.posterior_density.parameters.(name)(:,2);
|
||||
oo_.prior_density.parameters.(name)(:,1) = x2;
|
||||
|
@ -133,35 +133,36 @@ for i=1:npar
|
|||
end
|
||||
end
|
||||
top1 = max(f1);
|
||||
top0 = max([top1;top2]);
|
||||
top0 = max([top1; top2]);
|
||||
binf1 = x1(1);
|
||||
bsup1 = x1(end);
|
||||
borneinf = min(binf1,binf2);
|
||||
bornesup = max(bsup1,bsup2);
|
||||
subplot(nn,nn,subplotnum)
|
||||
hh = plot(x2,f2,'-k','linewidth',2);
|
||||
set(hh,'color',[0.7 0.7 0.7]);
|
||||
borneinf = min(binf1, binf2);
|
||||
bornesup = max(bsup1, bsup2);
|
||||
subplot(nn, nn, subplotnum)
|
||||
hh = plot(x2, f2, '-k', 'linewidth', 2);
|
||||
set(hh, 'color', [0.7 0.7 0.7]);
|
||||
hold on;
|
||||
plot(x1,f1,'-k','linewidth',2);
|
||||
plot(x1, f1, '-k', 'linewidth', 2);
|
||||
if ~options_.mh_posterior_mode_estimation
|
||||
plot( [pmod pmod], [0.0 1.1*top0], '--g', 'linewidth', 2);
|
||||
plot([pmod pmod], [0.0 1.1*top0], '--g', 'linewidth', 2);
|
||||
end
|
||||
box on;
|
||||
axis([borneinf bornesup 0 1.1*top0]);
|
||||
title(nam,'Interpreter','none');
|
||||
hold off;
|
||||
box on
|
||||
axis([borneinf bornesup 0 1.1*top0])
|
||||
title(nam, 'Interpreter', 'none')
|
||||
hold off
|
||||
drawnow
|
||||
if subplotnum == MaxNumberOfPlotPerFigure || i == npar
|
||||
dyn_saveas(hfig,[OutputDirectoryName '/' M_.fname '_PriorsAndPosteriors' int2str(figunumber)],options_.nodisplay,options_.graph_format);
|
||||
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for j = 1:size(NAMES,1)
|
||||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(j,:)),deblank(TeXNAMES(j,:)));
|
||||
dyn_saveas(hfig,[OutputDirectoryName '/' M_.fname '_PriorsAndPosteriors' int2str(figunumber)], options_.nodisplay, options_.graph_format);
|
||||
if TeX && any(strcmp('eps', cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX, '\\begin{figure}[H]\n');
|
||||
for j = 1:size(NAMES, 1)
|
||||
fprintf(fidTeX, '\\psfrag{%s}[1][][0.5][0]{%s}\n', NAMES{j}, TeXNAMES{j});
|
||||
end
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s/%s_PriorsAndPosteriors%s}\n',options_.figures.textwidth*min(subplotnum/nn,1),OutputDirectoryName,M_.fname,int2str(figunumber));
|
||||
fprintf(fidTeX, '\\centering\n');
|
||||
fprintf(fidTeX, '\\includegraphics[width=%2.2f\\textwidth]{%s/%s_PriorsAndPosteriors%s}\n', ...
|
||||
options_.figures.textwidth*min(subplotnum/nn,1), OutputDirectoryName, M_.fname, int2str(figunumber));
|
||||
fprintf(fidTeX,'\\caption{Priors and posteriors.}');
|
||||
fprintf(fidTeX,'\\label{Fig:PriorsAndPosteriors:%s}\n',int2str(figunumber));
|
||||
fprintf(fidTeX,'\\label{Fig:PriorsAndPosteriors:%s}\n', int2str(figunumber));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
fprintf(fidTeX,' \n');
|
||||
if i == npar
|
||||
|
|
|
@ -16,7 +16,7 @@ function PosteriorIRF(type)
|
|||
% functions associated with it(the _core1 and _core2).
|
||||
% See also the comments posterior_sampler.m funtion.
|
||||
|
||||
% Copyright (C) 2006-2017 Dynare Team
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -43,17 +43,17 @@ end
|
|||
% Set varlist if necessary
|
||||
varlist = options_.varlist;
|
||||
if isempty(varlist)
|
||||
varlist = char(options_.varobs);
|
||||
varlist = options_.varobs;
|
||||
end
|
||||
options_.varlist = varlist;
|
||||
nvar = size(varlist,1);
|
||||
nvar = length(varlist);
|
||||
IndxVariables = [];
|
||||
for i=1:nvar
|
||||
idx = strmatch(deblank(varlist(i,:)),M_.endo_names,'exact');
|
||||
idx = strmatch(varlist{i}, M_.endo_names, 'exact');
|
||||
if isempty(idx)
|
||||
disp(['PosteriorIRF :: ' deblank(varlist(i,:)) 'is not a declared endogenous variable!'])
|
||||
disp(['PosteriorIRF :: ' varlist{i} 'is not a declared endogenous variable!'])
|
||||
else
|
||||
IndxVariables = [IndxVariables,idx];
|
||||
IndxVariables = [IndxVariables, idx];
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -281,17 +281,14 @@ DistribIRF = zeros(options_.irf,9,nvar,M_.exo_nbr);
|
|||
HPDIRF = zeros(options_.irf,2,nvar,M_.exo_nbr);
|
||||
|
||||
if options_.TeX
|
||||
varlist_TeX = cell(nvar, 1);
|
||||
for i=1:nvar
|
||||
if i==1
|
||||
varlist_TeX = M_.endo_names_tex(IndxVariables(i),:);
|
||||
else
|
||||
varlist_TeX = char(varlist_TeX,M_.endo_names_tex(IndxVariables(i),:));
|
||||
end
|
||||
varlist_TeX(i) = {M_.endo_names_tex{IndxVariables(i)}};
|
||||
end
|
||||
end
|
||||
|
||||
fprintf('Estimation::mcmc: Posterior (dsge) IRFs...\n');
|
||||
tit(M_.exo_names_orig_ord,:) = M_.exo_names;
|
||||
tit(M_.exo_names_orig_ord) = M_.exo_names;
|
||||
kdx = 0;
|
||||
|
||||
for file = 1:NumberOfIRFfiles_dsge
|
||||
|
@ -313,7 +310,7 @@ clear STOCK_IRF_DSGE;
|
|||
|
||||
for i = irf_shocks_indx
|
||||
for j = 1:nvar
|
||||
name = [deblank(M_.endo_names(IndxVariables(j),:)) '_' deblank(tit(i,:))];
|
||||
name = sprintf('%s_%s', M_.endo_names{IndxVariables(j)}, tit{i});
|
||||
oo_.PosteriorIRF.dsge.Mean.(name) = MeanIRF(:,j,i);
|
||||
oo_.PosteriorIRF.dsge.Median.(name) = MedianIRF(:,j,i);
|
||||
oo_.PosteriorIRF.dsge.Var.(name) = VarIRF(:,j,i);
|
||||
|
@ -331,7 +328,7 @@ if MAX_nirfs_dsgevar
|
|||
DistribIRFdsgevar = zeros(options_.irf,9,nvar,M_.exo_nbr);
|
||||
HPDIRFdsgevar = zeros(options_.irf,2,nvar,M_.exo_nbr);
|
||||
fprintf('Estimation::mcmc: Posterior (bvar-dsge) IRFs...\n');
|
||||
tit(M_.exo_names_orig_ord,:) = M_.exo_names;
|
||||
tit(M_.exo_names_orig_ord) = M_.exo_names;
|
||||
kdx = 0;
|
||||
for file = 1:NumberOfIRFfiles_dsgevar
|
||||
load([MhDirectoryName filesep M_.fname '_IRF_BVARDSGEs' int2str(file) '.mat']);
|
||||
|
@ -350,7 +347,7 @@ if MAX_nirfs_dsgevar
|
|||
clear STOCK_IRF_BVARDSGE;
|
||||
for i = irf_shocks_indx
|
||||
for j = 1:nvar
|
||||
name = [deblank(M_.endo_names(IndxVariables(j),:)) '_' deblank(tit(i,:))];
|
||||
name = sprintf('%s_%s', M_.endo_names{IndxVariables(j)}, tit{i});
|
||||
oo_.PosteriorIRF.bvardsge.Mean.(name) = MeanIRFdsgevar(:,j,i);
|
||||
oo_.PosteriorIRF.bvardsge.Median.(name) = MedianIRFdsgevar(:,j,i);
|
||||
oo_.PosteriorIRF.bvardsge.Var.(name) = VarIRFdsgevar(:,j,i);
|
||||
|
@ -396,13 +393,13 @@ if ~options_.nograph && ~options_.no_graph.posterior
|
|||
|
||||
% The files .TeX are generated in sequential way always!
|
||||
subplotnum = 0;
|
||||
tit_TeX(M_.exo_names_orig_ord,:) = M_.exo_names_tex;
|
||||
titTeX(M_.exo_names_orig_ord) = M_.exo_names_tex;
|
||||
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fidTeX = fopen([DirectoryName filesep M_.fname '_BayesianIRF.tex'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by PosteriorIRF.m (Dynare).\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
titTeX(M_.exo_names_orig_ord,:) = M_.exo_names_tex;
|
||||
titTeX(M_.exo_names_orig_ord) = M_.exo_names_tex;
|
||||
|
||||
for ii=irf_shocks_indx
|
||||
figunumber = 0;
|
||||
|
@ -414,24 +411,23 @@ if ~options_.nograph && ~options_.no_graph.posterior
|
|||
if subplotnum == 1
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
end
|
||||
name = deblank(varlist(jj,:));
|
||||
texname = deblank(varlist_TeX(jj,:));
|
||||
name = varlist{jj};
|
||||
texname = varlist_TeX{jj};
|
||||
fprintf(fidTeX,['\\psfrag{%s}[1][][0.5][0]{%s}\n'],name,['$' texname '$']);
|
||||
end
|
||||
if subplotnum == MaxNumberOfPlotPerFigure || (jj == nvar && subplotnum> 0)
|
||||
figunumber = figunumber+1;
|
||||
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s/%s_Bayesian_IRF_%s_%d}\n',options_.figures.textwidth*min(subplotnum/nn,1),DirectoryName,M_.fname,deblank(tit(ii,:)),figunumber);
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s/%s_Bayesian_IRF_%s_%d}\n',options_.figures.textwidth*min(subplotnum/nn,1),DirectoryName,M_.fname,tit{ii},figunumber);
|
||||
if options_.relative_irf
|
||||
fprintf(fidTeX,['\\caption{Bayesian relative IRF.}']);
|
||||
else
|
||||
fprintf(fidTeX,'\\caption{Bayesian IRF: Orthogonalized shock to $%s$.}\n',deblank(tit_TeX(ii,:)));
|
||||
fprintf(fidTeX,'\\caption{Bayesian IRF: Orthogonalized shock to $%s$.}\n',titTeX{ii});
|
||||
end
|
||||
fprintf(fidTeX,'\\label{Fig:BayesianIRF:%s:%d}\n',deblank(tit(ii,:)),figunumber);
|
||||
fprintf(fidTeX,'\\label{Fig:BayesianIRF:%s:%d}\n', tit{ii},figunumber);
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
fprintf(fidTeX,' \n');
|
||||
|
||||
subplotnum = 0;
|
||||
end
|
||||
end
|
||||
|
@ -445,7 +441,7 @@ if ~options_.nograph && ~options_.no_graph.posterior
|
|||
|
||||
% Comment for testing!
|
||||
if ~isoctave
|
||||
if isnumeric(options_.parallel) || (M_.exo_nbr*ceil(size(varlist,1)/MaxNumberOfPlotPerFigure))<8
|
||||
if isnumeric(options_.parallel) || (M_.exo_nbr*ceil(length(varlist)/MaxNumberOfPlotPerFigure))<8
|
||||
[fout] = PosteriorIRF_core2(localVars,1,M_.exo_nbr,0);
|
||||
else
|
||||
isRemoteOctave = 0;
|
||||
|
|
|
@ -23,7 +23,7 @@ function myoutput=PosteriorIRF_core1(myinputs,fpar,B,whoiam, ThisMatlab)
|
|||
% SPECIAL REQUIREMENTS.
|
||||
% None.
|
||||
%
|
||||
% Copyright (C) 2006-2017 Dynare Team
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -195,7 +195,7 @@ while fpar<B
|
|||
if MAX_nirfs_dsgevar
|
||||
IRUN = IRUN+1;
|
||||
[fval,info,junk1,junk2,junk3,junk3,junk4,PHI,SIGMAu,iXX] = dsge_var_likelihood(deep',dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
|
||||
dsge_prior_weight = M_.params(strmatch('dsge_prior_weight',M_.param_names));
|
||||
dsge_prior_weight = M_.params(strmatch('dsge_prior_weight', M_.param_names));
|
||||
DSGE_PRIOR_WEIGHT = floor(dataset_.nobs*(1+dsge_prior_weight));
|
||||
SIGMA_inv_upper_chol = chol(inv(SIGMAu*dataset_.nobs*(dsge_prior_weight+1)));
|
||||
explosive_var = 1;
|
||||
|
|
|
@ -30,7 +30,7 @@ function myoutput=PosteriorIRF_core2(myinputs,fpar,npar,whoiam,ThisMatlab)
|
|||
% SPECIAL REQUIREMENTS.
|
||||
% None.
|
||||
%
|
||||
% Copyright (C) 2006-2017 Dynare Team
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -103,9 +103,9 @@ for i=fpar:npar
|
|||
if max(abs(MeanIRF(:,j,i))) >= options_.impulse_responses.plot_threshold
|
||||
subplotnum = subplotnum+1;
|
||||
if subplotnum == 1 && options_.relative_irf
|
||||
hh = dyn_figure(options_.nodisplay,'Name',['Relative response to orthogonalized shock to ' tit(i,:)]);
|
||||
hh = dyn_figure(options_.nodisplay,'Name',['Relative response to orthogonalized shock to ' tit{i}]);
|
||||
elseif subplotnum == 1 && ~options_.relative_irf
|
||||
hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit(i,:)]);
|
||||
hh = dyn_figure(options_.nodisplay,'Name',['Orthogonalized shock to ' tit{i}]);
|
||||
end
|
||||
|
||||
set(0,'CurrentFigure',hh)
|
||||
|
@ -142,17 +142,17 @@ for i=fpar:npar
|
|||
remove_fractional_xticks;
|
||||
hold off
|
||||
end
|
||||
name = deblank(varlist(j,:));
|
||||
name = varlist{j};
|
||||
title(name,'Interpreter','none')
|
||||
else
|
||||
if options_.debug
|
||||
fprintf('POSTERIOR_IRF: The IRF of %s to %s is smaller than the irf_plot_threshold of %4.3f and will not be displayed.\n',deblank(varlist(j,:)),tit(i,:),options_.impulse_responses.plot_threshold)
|
||||
fprintf('POSTERIOR_IRF: The IRF of %s to %s is smaller than the irf_plot_threshold of %4.3f and will not be displayed.\n',varlist{j},tit{i},options_.impulse_responses.plot_threshold)
|
||||
end
|
||||
end
|
||||
|
||||
if subplotnum == MaxNumberOfPlotPerFigure || (j == nvar && subplotnum> 0)
|
||||
figunumber = figunumber+1;
|
||||
dyn_saveas(hh,[DirectoryName '/' M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber)],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(hh,[DirectoryName '/' M_.fname '_Bayesian_IRF_' tit{i} '_' int2str(figunumber)],options_.nodisplay,options_.graph_format);
|
||||
if RemoteFlag==1
|
||||
OutputFileName = [OutputFileName; {[DirectoryName,filesep], [M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber) '.*']}];
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ function [oo_] = UnivariateSpectralDensity(M_,oo_,options_,var_list)
|
|||
|
||||
% Adapted from th_autocovariances.m.
|
||||
|
||||
% Copyright (C) 2006-2017 Dynare Team
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -50,15 +50,15 @@ else
|
|||
warning off MATLAB:dividebyzero
|
||||
end
|
||||
if nargin<2
|
||||
var_list = [];
|
||||
var_list = {};
|
||||
end
|
||||
if size(var_list,1) == 0
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr, :);
|
||||
if isempty(var_list)
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
nvar = size(var_list,1);
|
||||
nvar = length(var_list);
|
||||
ivar=zeros(nvar,1);
|
||||
for i=1:nvar
|
||||
i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
|
||||
i_tmp = strmatch(var_list{i}, M_.endo_names, 'exact');
|
||||
if isempty(i_tmp)
|
||||
error (['One of the variables specified does not exist']) ;
|
||||
else
|
||||
|
@ -159,12 +159,12 @@ if options_.nograph == 0
|
|||
end
|
||||
|
||||
for i= 1:nvar
|
||||
hh = dyn_figure(options_.nodisplay,'Name',['Spectral Density of ' deblank(M_.endo_names(ivar(i),:)) '.']);
|
||||
hh = dyn_figure(options_.nodisplay,'Name',['Spectral Density of ' M_.endo_names{ivar(i)} '.']);
|
||||
plot(freqs,f(i,:),'-k','linewidth',2)
|
||||
xlabel('0 \leq \omega \leq \pi')
|
||||
ylabel('f(\omega)')
|
||||
box on
|
||||
axis tight
|
||||
dyn_saveas(hh,[M_.fname ,filesep,'graphs', filesep, 'SpectralDensity_' deblank(M_.endo_names(ivar(i),:))],options_.nodisplay,options_.graph_format)
|
||||
dyn_saveas(hh,[M_.fname ,filesep,'graphs', filesep, 'SpectralDensity_' M_.endo_names{ivar(i)}],options_.nodisplay,options_.graph_format)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ function WriteShockDecomp2Excel(z,shock_names,endo_names,i_var,initial_date,Dyna
|
|||
% DynareModel [structure] Dynare model structure
|
||||
% DynareOptions [structure] Dynare options structure
|
||||
|
||||
% Copyright (C) 2016-2017 Dynare Team
|
||||
% Copyright (C) 2016-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -94,7 +94,7 @@ for j=1:nvar
|
|||
z1 = squeeze(z(i_var(j),:,:));
|
||||
if screen_shocks
|
||||
[junk, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend');
|
||||
labels = char(char(shock_names(isort(1:16),:)),'Others', 'Initial values');
|
||||
labels = char(char(shock_names(isort(1:16))),'Others', 'Initial values');
|
||||
zres = sum(z1(isort(17:end),:),1);
|
||||
z1 = [z1(isort(1:16),:); zres; z1(comp_nbr0:end,:)];
|
||||
comp_nbr=18;
|
||||
|
@ -115,9 +115,9 @@ for j=1:nvar
|
|||
|
||||
warning off
|
||||
if ~ismac
|
||||
[STATUS,MESSAGE] = xlswrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,deblank(endo_names(i_var(j),:)));
|
||||
[STATUS,MESSAGE] = xlswrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,endo_names{i_var(j)});
|
||||
else
|
||||
[STATUS] = xlwrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,deblank(endo_names(i_var(j),:)));
|
||||
[STATUS] = xlwrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,endo_names{i_var(j)});
|
||||
end
|
||||
warning on
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ function [z, endo_names, endo_names_tex, steady_state, i_var, oo_] = annualized_
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2017 Dynare Team
|
||||
% Copyright (C) 2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -109,17 +109,15 @@ elseif mytype
|
|||
gtex = 'g';
|
||||
end
|
||||
steady_state=steady_state(i_var);
|
||||
% endo_names = M_.endo_names(i_var,:);
|
||||
% endo_names_tex = M_.endo_names_tex(i_var,:);
|
||||
nterms = size(z,2);
|
||||
nfrcst = opts.forecast/4;
|
||||
|
||||
for j=1:nvar
|
||||
if j>1
|
||||
endo_names = char(endo_names,[deblank(M_.endo_names(i_var(j),:)) '_A']);
|
||||
endo_names_tex = char(endo_names_tex,['{' deblank(M_.endo_names_tex(i_var(j),:)) '}^A']);
|
||||
gendo_names = char(gendo_names,[gtxt endo_names(j,:)]);
|
||||
gendo_names_tex = char(gendo_names_tex,[gtex '(' deblank(endo_names_tex(j,:)) ')']);
|
||||
endo_names = char(endo_names, sprintf('%s_A', M_.endo_names{i_var(j)}));
|
||||
endo_names_tex = char(endo_names_tex, sprintf('{%s}^A', M_.endo_names_tex{i_var(j)}));
|
||||
gendo_names = char(gendo_names,[gtxt endo_names{j}]);
|
||||
gendo_names_tex = char(gendo_names_tex,[gtex '(' endo_names_tex{j} ')']);
|
||||
else
|
||||
if nvar==1 && ~mytype
|
||||
endo_names = mytxt;
|
||||
|
@ -127,10 +125,10 @@ for j=1:nvar
|
|||
gendo_names = gtxt;
|
||||
gendo_names_tex = gtex;
|
||||
else
|
||||
endo_names = [deblank(M_.endo_names(i_var(j),:)) '_A'];
|
||||
endo_names_tex = ['{' deblank(M_.endo_names_tex(i_var(j),:)) '}^A'];
|
||||
gendo_names = [gtxt endo_names(j,:)];
|
||||
gendo_names_tex = [gtex '(' deblank(endo_names_tex(j,:)) ')'];
|
||||
endo_names = sprintf('%s_A', M_.endo_names{i_var(j)});
|
||||
endo_names_tex = sprintf('{%s}^A', M_.endo_names_tex{i_var(j)});
|
||||
gendo_names = [gtxt endo_names{j}];
|
||||
gendo_names_tex = [gtex '(' endo_names_tex{j} ')'];
|
||||
end
|
||||
end
|
||||
for k =1:nterms
|
||||
|
@ -331,3 +329,6 @@ else
|
|||
steady_state = steady_state_a;
|
||||
end
|
||||
end
|
||||
|
||||
endo_names = cellstr(endo_names);
|
||||
endo_names_tex = cellstr(endo_names_tex);
|
|
@ -10,7 +10,7 @@ function forecasts = backward_model_forecast(initialcondition, listofvariables,
|
|||
% OUTPUTS
|
||||
% - forecast [dseries]
|
||||
|
||||
% Copyright (C) 2017 Dynare Team
|
||||
% Copyright (C) 2017-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -39,7 +39,7 @@ forecasts = struct();
|
|||
|
||||
% Set defaults.
|
||||
if nargin<2
|
||||
listofvariables = cellstr(M_.endo_names);
|
||||
listofvariables = M_.endo_names;
|
||||
periods = 8;
|
||||
withuncertainty = false;
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ function [deviations, baseline, irfs] = backward_model_irf(initialcondition, inn
|
|||
% argument.
|
||||
% - If second argument is not empty, periods must not be greater than innovationbaseline.nobs.
|
||||
|
||||
% Copyright (C) 2017 Dynare Team
|
||||
% Copyright (C) 2017-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -72,7 +72,7 @@ else
|
|||
end
|
||||
if deterministicshockflag
|
||||
numberofexperiments = length(listofshocks);
|
||||
exonames = cellstr(M_.exo_names);
|
||||
exonames = M_.exo_names;
|
||||
initialconditionperiod = initialcondition.dates(end);
|
||||
for i=1:numberofexperiments
|
||||
shock = listofshocks{i};
|
||||
|
@ -108,7 +108,7 @@ if ~isempty(innovationbaseline)
|
|||
error('The second input argument must at least have %s observations or lower the number of periods.', periods)
|
||||
end
|
||||
% Fill innovations with provided paths for the innovations.
|
||||
exonames = cellstr(M_.exo_names);
|
||||
exonames = M_.exo_names;
|
||||
for i = 1:length(exonames)
|
||||
if ~isempty(strmatch(exonames{i}, innovationbaseline.name))
|
||||
Innovations(:,i) = innovationbaseline{exonames{i}}.data(1:periods);
|
||||
|
@ -183,9 +183,9 @@ for i=1:length(listofshocks)
|
|||
endo_simul__1 = feval(transform, ysim__1);
|
||||
end
|
||||
% Instantiate a dseries object (with all the endogenous variables)
|
||||
alldeviations = dseries(transpose(endo_simul__1-endo_simul__0), initialcondition.init, endonames(1:M_.orig_endo_nbr), cellstr(DynareModel.endo_names_tex(1:M_.orig_endo_nbr,:)));
|
||||
alldeviations = dseries(transpose(endo_simul__1-endo_simul__0), initialcondition.init, endonames(1:M_.orig_endo_nbr), DynareModel.endo_names_tex(1:M_.orig_endo_nbr));
|
||||
if nargout>2
|
||||
allirfs = dseries(transpose(endo_simul__1), initialcondition.init, endonames(1:M_.orig_endo_nbr), cellstr(DynareModel.endo_names_tex(1:M_.orig_endo_nbr,:)));
|
||||
allirfs = dseries(transpose(endo_simul__1), initialcondition.init, endonames(1:M_.orig_endo_nbr), DynareModel.endo_names_tex(1:M_.orig_endo_nbr));
|
||||
end
|
||||
% Extract a sub-dseries object
|
||||
if deterministicshockflag
|
||||
|
@ -201,6 +201,6 @@ for i=1:length(listofshocks)
|
|||
end
|
||||
|
||||
if nargout>1
|
||||
baseline = dseries(transpose(endo_simul__0), initialcondition.init, endonames(1:M_.orig_endo_nbr), cellstr(DynareModel.endo_names_tex(1:M_.orig_endo_nbr,:)));
|
||||
baseline = dseries(transpose(endo_simul__0), initialcondition.init, endonames(1:M_.orig_endo_nbr), DynareModel.endo_names_tex(1:M_.orig_endo_nbr));
|
||||
baseline = [baseline, innovationbaseline];
|
||||
end
|
|
@ -18,7 +18,7 @@ function simulation = simul_backward_model(initialconditions, samplesize, innova
|
|||
% [3] If the first input argument is empty, the endogenous variables are initialized with 0, or if available with the informations
|
||||
% provided thrtough the histval block.
|
||||
|
||||
% Copyright (C) 2012-2017 Dynare Team
|
||||
% Copyright (C) 2012-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -47,7 +47,7 @@ else
|
|||
end
|
||||
% Set array holding innovations values.
|
||||
Innovations = zeros(samplesize, M_.exo_nbr);
|
||||
exonames = cellstr(M_.exo_names);
|
||||
exonames = M_.exo_names;
|
||||
for i=1:M_.exo_nbr
|
||||
if ismember(exonames{i}, innovations.name)
|
||||
Innovations(:,i) = innovations{exonames{i}}.data(1:samplesize);
|
||||
|
|
|
@ -2,7 +2,7 @@ function [initialconditions, samplesize, innovations, DynareOptions, DynareModel
|
|||
|
||||
% Initialization of the routines simulating backward models.
|
||||
|
||||
% Copyright (C) 2017 Dynare Team
|
||||
% Copyright (C) 2017-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -41,7 +41,7 @@ if ~isdseries(initialconditions)
|
|||
end
|
||||
|
||||
% Test if the first argument contains all the lagged endogenous variables
|
||||
endonames = cellstr(DynareModel.endo_names);
|
||||
endonames = DynareModel.endo_names;
|
||||
missingendogenousvariables = setdiff(endonames, initialconditions.name);
|
||||
endolags = get_lags_on_endogenous_variables(DynareModel);
|
||||
endolags_ = endolags(find(endolags));
|
||||
|
@ -84,7 +84,7 @@ if missinginitialcondition
|
|||
end
|
||||
|
||||
% If the model has lags on the exogenous variables, test if we have corresponding initial conditions.
|
||||
exonames = cellstr(DynareModel.exo_names);
|
||||
exonames = DynareModel.exo_names;
|
||||
missingexogenousvariables = setdiff(exonames, initialconditions.name);
|
||||
exolags = get_lags_on_exogenous_variables(DynareModel);
|
||||
exolags_ = exolags(find(exolags));
|
||||
|
@ -131,16 +131,16 @@ k = 0;
|
|||
for i = DynareModel.orig_endo_nbr+1:DynareModel.endo_nbr
|
||||
k = k+1;
|
||||
if DynareModel.aux_vars(k).type==1
|
||||
if ismember(deblank(DynareModel.endo_names(DynareModel.aux_vars(k).orig_index,:)), initialconditions.name)
|
||||
initialconditions{deblank(DynareModel.endo_names(DynareModel.aux_vars(k).endo_index, :))} = ...
|
||||
initialconditions{deblank(DynareModel.endo_names(DynareModel.aux_vars(k).orig_index, :))}.lag(abs(DynareModel.aux_vars(k).orig_lead_lag));
|
||||
if ismember(DynareModel.endo_names{DynareModel.aux_vars(k).orig_index}, initialconditions.name)
|
||||
initialconditions{DynareModel.endo_names{DynareModel.aux_vars(k).endo_index}} = ...
|
||||
initialconditions{DynareModel.endo_names{DynareModel.aux_vars(k).orig_index}}.lag(abs(DynareModel.aux_vars(k).orig_lead_lag));
|
||||
else
|
||||
error('This is a bug. Please contact Dynare Team!');
|
||||
end
|
||||
elseif DynareModel.aux_vars(k).type==3
|
||||
if ismember(deblank(DynareModel.exo_names(DynareModel.aux_vars(k).orig_index, :)), initialconditions.name)
|
||||
initialconditions{deblank(DynareModel.endo_names(DynareModel.aux_vars(k).endo_index,:))} = ...
|
||||
initialconditions{deblank(DynareModel.exo_names(DynareModel.aux_vars(k).orig_index, :))}.lag(abs(DynareModel.aux_vars(k).orig_lead_lag));
|
||||
if ismember(DynareModel.exo_names{DynareModel.aux_vars(k).orig_index}, initialconditions.name)
|
||||
initialconditions{DynareModel.endo_names{DynareModel.aux_vars(k).endo_index}} = ...
|
||||
initialconditions{DynareModel.exo_names{DynareModel.aux_vars(k).orig_index}}.lag(abs(DynareModel.aux_vars(k).orig_lead_lag));
|
||||
else
|
||||
error('This is a bug. Please contact Dynare Team!');
|
||||
end
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
function n = cellofchararraymaxlength(c)
|
||||
|
||||
% Copyright (C) 2018 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/>.
|
||||
|
||||
if ~all(cellfun(@ischar, c))
|
||||
error('Input has to be a cell of char arrays!')
|
||||
end
|
||||
|
||||
if ~all(cellfun(@isrow, c))
|
||||
error('Input has to be a cell of one dimensional char arrays!')
|
||||
end
|
||||
|
||||
n = max(cellfun(@length, c));
|
|
@ -5,16 +5,16 @@ function varlist = check_list_of_variables(options_, M_, varlist)
|
|||
%
|
||||
% INPUTS
|
||||
%
|
||||
% options_ [structure] Dynare structure.
|
||||
% M_ [structure] Dynare structure (related to model definition).
|
||||
% varlist [string] Array of strings with name of the endogenous variables.
|
||||
% options_ [structure] Dynare structure.
|
||||
% M_ [structure] Dynare structure (related to model definition).
|
||||
% varlist [cell of char arrays] Array of strings with name of the endogenous variables.
|
||||
%
|
||||
% OUTPUTS
|
||||
% varlist [string]
|
||||
% varlist [cell of char arrays]
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -33,21 +33,21 @@ function varlist = check_list_of_variables(options_, M_, varlist)
|
|||
|
||||
%get uniques
|
||||
|
||||
[junk1,junk2,index_uniques] = varlist_indices(varlist,M_.endo_names);
|
||||
varlist=varlist(index_uniques,:);
|
||||
[junk1, junk2, index_uniques] = varlist_indices(varlist, M_.endo_names);
|
||||
varlist = varlist(index_uniques);
|
||||
|
||||
msg = 0;
|
||||
msg = false;
|
||||
if options_.dsge_var && options_.bayesian_irf
|
||||
if ~isempty(varlist)
|
||||
for i=1:size(varlist,1)
|
||||
idx = strmatch(deblank(varlist(i,:)),options_.varobs,'exact');
|
||||
idx = strmatch(varlist{i}, options_.varobs, 'exact');
|
||||
if isempty(idx)
|
||||
disp([varlist(i,:) ' is not an observed variable!']);
|
||||
msg = 1;
|
||||
disp(sprintf('%s is not an observed variable!', varlist{i}))
|
||||
msg = true;
|
||||
end
|
||||
end
|
||||
if size(varlist,1)~=length(options_.varobs)
|
||||
msg = 1;
|
||||
if ~isequal(size(varlist), length(options_.varobs))
|
||||
msg = true;
|
||||
end
|
||||
if msg
|
||||
skipline()
|
||||
|
@ -55,7 +55,7 @@ if options_.dsge_var && options_.bayesian_irf
|
|||
skipline()
|
||||
end
|
||||
end
|
||||
varlist = char(options_.varobs);
|
||||
varlist = options_.varobs;
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -63,16 +63,16 @@ if ~isempty(varlist) && ~isempty(options_.endo_vars_for_moment_computations_in_e
|
|||
error('You cannot use the consider_all_endogenous or consider_all_observed options when listing variables after the estimation command')
|
||||
elseif isempty(varlist) && ~isempty(options_.endo_vars_for_moment_computations_in_estimation)
|
||||
if strcmp(options_.endo_vars_for_moment_computations_in_estimation,'all_endogenous_variables')
|
||||
varlist = M_.endo_names(1:M_.orig_endo_nbr, :);
|
||||
varlist = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
elseif strcmp(options_.endo_vars_for_moment_computations_in_estimation,'only_observed_variables')
|
||||
varlist = char(options_.varobs');
|
||||
varlist = options_.varobs;
|
||||
else
|
||||
error('Unknown option')
|
||||
end
|
||||
elseif isempty(varlist) && isempty(options_.endo_vars_for_moment_computations_in_estimation)
|
||||
skipline()
|
||||
disp(['You did not declare endogenous variables after the estimation/calib_smoother command.'])
|
||||
cas = [];
|
||||
cas = '';
|
||||
if options_.bayesian_irf
|
||||
cas = 'Posterior IRFs';
|
||||
end
|
||||
|
@ -80,37 +80,37 @@ elseif isempty(varlist) && isempty(options_.endo_vars_for_moment_computations_in
|
|||
if isempty(cas)
|
||||
cas = 'Posterior moments';
|
||||
else
|
||||
cas = [ cas , ', posterior moments'];
|
||||
cas = [cas, ', posterior moments'];
|
||||
end
|
||||
end
|
||||
if options_.smoother
|
||||
if isempty(cas)
|
||||
cas = 'Smoothed variables';
|
||||
else
|
||||
cas = [ cas , ', smoothed variables'];
|
||||
cas = [cas, ', smoothed variables'];
|
||||
end
|
||||
end
|
||||
if ~isempty(options_.filter_step_ahead)
|
||||
if isempty(cas)
|
||||
cas = 'k-step ahead filtered variables';
|
||||
else
|
||||
cas = [ cas , ', k-step ahead filtered variables'];
|
||||
cas = [cas, ', k-step ahead filtered variables'];
|
||||
end
|
||||
end
|
||||
if options_.forecast
|
||||
if isempty(cas)
|
||||
cas = 'Forecasts';
|
||||
else
|
||||
cas = [ cas , ' and forecasts'];
|
||||
cas = [cas, ' and forecasts'];
|
||||
end
|
||||
end
|
||||
if ~isempty(cas)
|
||||
string = [ cas , ' will be computed for the ' num2str(M_.endo_nbr) ' endogenous variables'];
|
||||
string = [ string ' of your model, this can take a long time ....'];
|
||||
format_text(string, 10)
|
||||
str = sprintf('%s will be computed for the %s endogenous variables of your model', cas, num2str(M_.orig_endo_nbr));
|
||||
str = sprintf('%s, this can take a long time ....', str);
|
||||
format_text(str, 10)
|
||||
if options_.nointeractive
|
||||
% Default behaviour is to consider all the endogenous variables.
|
||||
varlist = M_.endo_names(1:M_.orig_endo_nbr, :);
|
||||
varlist = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
else
|
||||
choice = [];
|
||||
while isempty(choice)
|
||||
|
@ -126,9 +126,9 @@ elseif isempty(varlist) && isempty(options_.endo_vars_for_moment_computations_in
|
|||
choice=1;
|
||||
end
|
||||
if choice==1
|
||||
varlist = M_.endo_names(1:M_.orig_endo_nbr, :);
|
||||
varlist = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
elseif choice==2
|
||||
varlist = char(options_.varobs);
|
||||
varlist = options_.varobs;
|
||||
elseif choice==3
|
||||
varlist = NaN;
|
||||
else
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
function oo_ = compute_moments_varendo(type,options_,M_,oo_,var_list_)
|
||||
function oo_ = compute_moments_varendo(type, options_, M_, oo_, var_list_)
|
||||
|
||||
% Computes the second order moments (autocorrelation function, covariance
|
||||
% matrix and variance decomposition) distributions for all the endogenous variables selected in
|
||||
% var_list_. The results are saved in oo_
|
||||
%
|
||||
% INPUTS:
|
||||
% type [string] 'posterior' or 'prior'
|
||||
% options_ [structure] Dynare structure.
|
||||
% M_ [structure] Dynare structure (related to model definition).
|
||||
% oo_ [structure] Dynare structure (results).
|
||||
% var_list_ [string] Array of string with endogenous variable names.
|
||||
% type [string] 'posterior' or 'prior'
|
||||
% options_ [structure] Dynare structure.
|
||||
% M_ [structure] Dynare structure (related to model definition).
|
||||
% oo_ [structure] Dynare structure (results).
|
||||
% var_list_ [cell of char arrays] Endogenous variable names.
|
||||
%
|
||||
% OUTPUTS
|
||||
% oo_ [structure] Dynare structure (results).
|
||||
|
@ -16,7 +17,7 @@ function oo_ = compute_moments_varendo(type,options_,M_,oo_,var_list_)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2008-2017 Dynare Team
|
||||
% Copyright (C) 2008-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -39,21 +40,21 @@ fprintf('Estimation::compute_moments_varendo: I''m computing endogenous moments
|
|||
if strcmpi(type,'posterior')
|
||||
posterior = 1;
|
||||
if nargin==4
|
||||
var_list_ = char(options_.varobs);
|
||||
var_list_ = options_.varobs;
|
||||
end
|
||||
elseif strcmpi(type,'prior')
|
||||
posterior = 0;
|
||||
if nargin==4
|
||||
var_list_ = options_.prior_analysis_endo_var_list;
|
||||
if isempty(var_list_)
|
||||
options_.prior_analysis_var_list = char(options_.varobs);
|
||||
options_.prior_analysis_var_list = options_.varobs;
|
||||
end
|
||||
end
|
||||
else
|
||||
error('compute_moments_varendo:: Unknown type!')
|
||||
end
|
||||
|
||||
NumberOfEndogenousVariables = rows(var_list_);
|
||||
NumberOfEndogenousVariables = length(var_list_);
|
||||
NumberOfExogenousVariables = M_.exo_nbr;
|
||||
NumberOfLags = options_.ar;
|
||||
NoDecomposition = options_.nodecomposition;
|
||||
|
@ -64,9 +65,9 @@ else
|
|||
end
|
||||
|
||||
if options_.TeX
|
||||
var_list_tex='';
|
||||
for var_iter=1:size(var_list_,1)
|
||||
var_list_tex=strvcat(var_list_tex,M_.endo_names_tex(strmatch(var_list_(var_iter,:),M_.endo_names,'exact'),:));
|
||||
var_list_tex={};
|
||||
for var_iter = 1:length(var_list_)
|
||||
var_list_tex = vertcat(var_list_tex, M_.endo_names_tex{strmatch(var_list_{var_iter}, M_.endo_names, 'exact')});
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -74,22 +75,23 @@ end
|
|||
if posterior
|
||||
for i=1:NumberOfEndogenousVariables
|
||||
for j=i:NumberOfEndogenousVariables
|
||||
oo_ = posterior_analysis('variance',var_list_(i,:),var_list_(j,:),[],options_,M_,oo_);
|
||||
oo_ = posterior_analysis('variance', var_list_{i}, var_list_{j}, [], options_, M_, oo_);
|
||||
end
|
||||
end
|
||||
else
|
||||
for i=1:NumberOfEndogenousVariables
|
||||
for j=i:NumberOfEndogenousVariables
|
||||
oo_ = prior_analysis('variance',var_list_(i,:),var_list_(j,:),[],options_,M_,oo_);
|
||||
oo_ = prior_analysis('variance', var_list_{i}, var_list_{j}, [], options_, M_, oo_);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% CORRELATION FUNCTION.
|
||||
if posterior
|
||||
for h=NumberOfLags:-1:1
|
||||
for i=1:NumberOfEndogenousVariables
|
||||
for j=1:NumberOfEndogenousVariables
|
||||
oo_ = posterior_analysis('correlation',var_list_(i,:),var_list_(j,:),h,options_,M_,oo_);
|
||||
oo_ = posterior_analysis('correlation', var_list_{i}, var_list_{j}, h, options_, M_, oo_);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -97,11 +99,12 @@ else
|
|||
for h=NumberOfLags:-1:1
|
||||
for i=1:NumberOfEndogenousVariables
|
||||
for j=1:NumberOfEndogenousVariables
|
||||
oo_ = prior_analysis('correlation',var_list_(i,:),var_list_(j,:),h,options_,M_,oo_);
|
||||
oo_ = prior_analysis('correlation', var_list_{i}, var_list_{j}, h, options_, M_, oo_);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% VARIANCE DECOMPOSITION.
|
||||
if M_.exo_nbr > 1
|
||||
if ~NoDecomposition
|
||||
|
@ -109,8 +112,8 @@ if M_.exo_nbr > 1
|
|||
if posterior
|
||||
for i=1:NumberOfEndogenousVariables
|
||||
for j=1:NumberOfExogenousVariables
|
||||
oo_ = posterior_analysis('decomposition',var_list_(i,:),M_.exo_names(j,:),[],options_,M_,oo_);
|
||||
temp(i,j)=oo_.PosteriorTheoreticalMoments.dsge.VarianceDecomposition.Mean.(deblank(var_list_(i,:))).(deblank(M_.exo_names(j,:)));
|
||||
oo_ = posterior_analysis('decomposition', var_list_{i}, M_.exo_names{j}, [], options_, M_, oo_);
|
||||
temp(i,j) = oo_.PosteriorTheoreticalMoments.dsge.VarianceDecomposition.Mean.(var_list_{i}).(M_.exo_names{j});
|
||||
end
|
||||
end
|
||||
title='Posterior mean variance decomposition (in percent)';
|
||||
|
@ -118,160 +121,157 @@ if M_.exo_nbr > 1
|
|||
else
|
||||
for i=1:NumberOfEndogenousVariables
|
||||
for j=1:NumberOfExogenousVariables
|
||||
oo_ = prior_analysis('decomposition',var_list_(i,:),M_.exo_names(j,:),[],options_,M_,oo_);
|
||||
temp(i,j)=oo_.PriorTheoreticalMoments.dsge.VarianceDecomposition.Mean.(deblank(var_list_(i,:))).(deblank(M_.exo_names(j,:)));
|
||||
oo_ = prior_analysis('decomposition', var_list_{i}, M_.exo_names{j}, [], options_, M_, oo_);
|
||||
temp(i,j)=oo_.PriorTheoreticalMoments.dsge.VarianceDecomposition.Mean.(var_list_{i}).(M_.exo_names{j});
|
||||
end
|
||||
end
|
||||
title='Prior mean variance decomposition (in percent)';
|
||||
save_name_string='dsge_prior_mean_var_decomp_uncond';
|
||||
end
|
||||
title=add_filter_subtitle(title,options_);
|
||||
title=add_filter_subtitle(title, options_);
|
||||
headers = M_.exo_names;
|
||||
headers(M_.exo_names_orig_ord,:) = headers;
|
||||
headers = char(' ',headers);
|
||||
lh = size(deblank(var_list_),2)+2;
|
||||
dyntable(options_,title,headers,deblank(var_list_),100* ...
|
||||
temp,lh,8,2);
|
||||
headers(M_.exo_names_orig_ord) = headers;
|
||||
headers = vertcat(' ', headers);
|
||||
lh = cellofchararraymaxlength(var_list_)+2;
|
||||
dyntable(options_, title, headers, var_list_, 100*temp, lh, 8, 2);
|
||||
if options_.TeX
|
||||
headers=M_.exo_names_tex;
|
||||
headers = char(' ',headers);
|
||||
labels = deblank(var_list_tex);
|
||||
headers = M_.exo_names_tex;
|
||||
headers = vertcat(' ', headers);
|
||||
labels = var_list_tex;
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title,save_name_string,headers,labels,100*temp,lh,8,2);
|
||||
dyn_latex_table(M_, options_, title, save_name_string, headers, labels, 100*temp, lh, 8, 2);
|
||||
end
|
||||
skipline();
|
||||
end
|
||||
skipline();
|
||||
if ~all(M_.H==0)
|
||||
[observable_name_requested_vars,varlist_pos]=intersect(var_list_,options_.varobs,'stable');
|
||||
[observable_name_requested_vars, varlist_pos] = intersect(var_list_, options_.varobs, 'stable');
|
||||
if ~isempty(observable_name_requested_vars)
|
||||
NumberOfObservedEndogenousVariables=length(observable_name_requested_vars);
|
||||
temp=NaN(NumberOfObservedEndogenousVariables,NumberOfExogenousVariables+1);
|
||||
NumberOfObservedEndogenousVariables = length(observable_name_requested_vars);
|
||||
temp = NaN(NumberOfObservedEndogenousVariables, NumberOfExogenousVariables+1);
|
||||
if posterior
|
||||
for i=1:NumberOfObservedEndogenousVariables
|
||||
for j=1:NumberOfExogenousVariables
|
||||
temp(i,j,:)=oo_.PosteriorTheoreticalMoments.dsge.VarianceDecompositionME.Mean.(deblank(observable_name_requested_vars{i,1})).(deblank(M_.exo_names(j,:)));
|
||||
temp(i,j,:) = oo_.PosteriorTheoreticalMoments.dsge.VarianceDecompositionME.Mean.(observable_name_requested_vars{i}).(M_.exo_names{j});
|
||||
end
|
||||
endo_index_varlist=strmatch(deblank(observable_name_requested_vars{i,1}),var_list_,'exact');
|
||||
oo_ = posterior_analysis('decomposition',var_list_(endo_index_varlist,:),'ME',[],options_,M_,oo_);
|
||||
temp(i,j+1,:)=oo_.PosteriorTheoreticalMoments.dsge.VarianceDecompositionME.Mean.(deblank(observable_name_requested_vars{i,1})).('ME');
|
||||
endo_index_varlist = strmatch(observable_name_requested_vars{i}, var_list_, 'exact');
|
||||
oo_ = posterior_analysis('decomposition', var_list_{endo_index_varlist}, 'ME', [], options_, M_, oo_);
|
||||
temp(i,j+1,:) = oo_.PosteriorTheoreticalMoments.dsge.VarianceDecompositionME.Mean.(observable_name_requested_vars{i}).('ME');
|
||||
end
|
||||
title='Posterior mean variance decomposition (in percent) with measurement error';
|
||||
save_name_string='dsge_post_mean_var_decomp_uncond_ME';
|
||||
else
|
||||
for i=1:NumberOfObservedEndogenousVariables
|
||||
for j=1:NumberOfExogenousVariables
|
||||
temp(i,j,:)=oo_.PriorTheoreticalMoments.dsge.VarianceDecompositionME.Mean.(deblank(observable_name_requested_vars(i,:))).(deblank(M_.exo_names(j,:)));
|
||||
temp(i,j,:) = oo_.PriorTheoreticalMoments.dsge.VarianceDecompositionME.Mean.(observable_name_requested_vars{i}).(M_.exo_names{j});
|
||||
end
|
||||
endo_index_varlist=strmatch(deblank(observable_name_requested_vars{i,1}),var_list_,'exact');
|
||||
oo_ = prior_analysis('decomposition',var_list_(endo_index_varlist,:),'ME',[],options_,M_,oo_);
|
||||
temp(i,j+1,:)=oo_.PriorTheoreticalMoments.dsge.VarianceDecompositionME.Mean.(deblank(observable_name_requested_vars{i,1})).('ME');
|
||||
endo_index_varlist = strmatch(observable_name_requested_vars{i}, var_list_, 'exact');
|
||||
oo_ = prior_analysis('decomposition', var_list_{endo_index_varlist}, 'ME', [], options_, M_, oo_);
|
||||
temp(i,j+1,:) = oo_.PriorTheoreticalMoments.dsge.VarianceDecompositionME.Mean.(observable_name_requested_vars{i}).('ME');
|
||||
end
|
||||
title='Prior mean variance decomposition (in percent) with measurement error';
|
||||
save_name_string='dsge_prior_mean_var_decomp_uncond_ME';
|
||||
end
|
||||
title=add_filter_subtitle(title,options_);
|
||||
title=add_filter_subtitle(title, options_);
|
||||
headers = M_.exo_names;
|
||||
headers(M_.exo_names_orig_ord,:) = headers;
|
||||
headers = char(' ',headers,'ME');
|
||||
lh = size(deblank(var_list_),2)+2;
|
||||
dyntable(options_,title,headers,deblank(char(observable_name_requested_vars)),100* ...
|
||||
temp,lh,8,2);
|
||||
headers(M_.exo_names_orig_ord) = headers;
|
||||
headers = vertcat(' ', headers, 'ME');
|
||||
lh = cellofchararraymaxlength(var_list_)+2;
|
||||
dyntable(options_, title, headers, observable_name_requested_vars,100*temp,lh,8,2);
|
||||
if options_.TeX
|
||||
headers=M_.exo_names_tex;
|
||||
headers = char(' ',headers,'ME');
|
||||
labels = deblank(var_list_tex(varlist_pos,:));
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title,save_name_string,headers,labels,100*temp,lh,8,2);
|
||||
headers = M_.exo_names_tex;
|
||||
headers = vertcat(' ', headers, 'ME');
|
||||
labels = var_list_tex(varlist_pos);
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title, save_name_string, headers, labels, 100*temp, lh, 8, 2);
|
||||
end
|
||||
skipline();
|
||||
end
|
||||
end
|
||||
% CONDITIONAL VARIANCE DECOMPOSITION.
|
||||
% CONDITIONAL VARIANCE DECOMPOSITION.
|
||||
if Steps
|
||||
temp=NaN(NumberOfEndogenousVariables,NumberOfExogenousVariables,length(Steps));
|
||||
temp = NaN(NumberOfEndogenousVariables, NumberOfExogenousVariables, length(Steps));
|
||||
if posterior
|
||||
for i=1:NumberOfEndogenousVariables
|
||||
for j=1:NumberOfExogenousVariables
|
||||
oo_ = posterior_analysis('conditional decomposition',i,M_.exo_names(j,:),Steps,options_,M_,oo_);
|
||||
temp(i,j,:)=oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecomposition.Mean.(deblank(var_list_(i,:))).(deblank(M_.exo_names(j,:)));
|
||||
oo_ = posterior_analysis('conditional decomposition', var_list_{i}, M_.exo_names{j}, Steps, options_, M_, oo_);
|
||||
temp(i,j,:) = oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecomposition.Mean.(var_list_{i}).(M_.exo_names{j});
|
||||
end
|
||||
end
|
||||
title='Posterior mean conditional variance decomposition (in percent)';
|
||||
save_name_string='dsge_post_mean_var_decomp_cond_h';
|
||||
title = 'Posterior mean conditional variance decomposition (in percent)';
|
||||
save_name_string = 'dsge_post_mean_var_decomp_cond_h';
|
||||
else
|
||||
for i=1:NumberOfEndogenousVariables
|
||||
for j=1:NumberOfExogenousVariables
|
||||
oo_ = prior_analysis('conditional decomposition',var_list_(i,:),M_.exo_names(j,:),Steps,options_,M_,oo_);
|
||||
temp(i,j,:)=oo_.PriorTheoreticalMoments.dsge.ConditionalVarianceDecomposition.Mean.(deblank(var_list_(i,:))).(deblank(M_.exo_names(j,:)));
|
||||
oo_ = prior_analysis('conditional decomposition', var_list_{i}, M_.exo_names{j}, Steps, options_, M_, oo_);
|
||||
temp(i,j,:) = oo_.PriorTheoreticalMoments.dsge.ConditionalVarianceDecomposition.Mean.(var_list_{i}).(M_.exo_names{j});
|
||||
end
|
||||
end
|
||||
title='Prior mean conditional variance decomposition (in percent)';
|
||||
save_name_string='dsge_prior_mean_var_decomp_cond_h';
|
||||
title = 'Prior mean conditional variance decomposition (in percent)';
|
||||
save_name_string = 'dsge_prior_mean_var_decomp_cond_h';
|
||||
end
|
||||
for step_iter=1:length(Steps)
|
||||
title_print=[title, ' Period ' int2str(Steps(step_iter))];
|
||||
headers = M_.exo_names;
|
||||
headers(M_.exo_names_orig_ord,:) = headers;
|
||||
headers = char(' ',headers);
|
||||
lh = size(deblank(var_list_),2)+2;
|
||||
dyntable(options_,title_print,headers,deblank(var_list_),100* ...
|
||||
headers(M_.exo_names_orig_ord) = headers;
|
||||
headers = vertcat(' ', headers);
|
||||
lh = cellofchararraymaxlength(var_list_)+2;
|
||||
dyntable(options_,title_print,headers, var_list_,100* ...
|
||||
temp(:,:,step_iter),lh,8,2);
|
||||
if options_.TeX
|
||||
headers=M_.exo_names_tex;
|
||||
headers = char(' ',headers);
|
||||
labels = deblank(var_list_tex);
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title_print,[save_name_string,int2str(Steps(step_iter))],headers,labels,100*temp(:,:,step_iter),lh,8,2);
|
||||
headers = M_.exo_names_tex;
|
||||
headers = vertcat(' ', headers);
|
||||
labels = var_list_tex;
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title_print, [save_name_string, int2str(Steps(step_iter))], headers, labels, 100*temp(:,:,step_iter), lh, 8, 2);
|
||||
end
|
||||
end
|
||||
skipline();
|
||||
if ~all(M_.H==0)
|
||||
if ~isempty(observable_name_requested_vars)
|
||||
NumberOfObservedEndogenousVariables=length(observable_name_requested_vars);
|
||||
NumberOfObservedEndogenousVariables = length(observable_name_requested_vars);
|
||||
temp=NaN(NumberOfObservedEndogenousVariables,NumberOfExogenousVariables+1,length(Steps));
|
||||
if posterior
|
||||
for i=1:NumberOfObservedEndogenousVariables
|
||||
for j=1:NumberOfExogenousVariables
|
||||
temp(i,j,:)=oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecompositionME.Mean.(deblank(observable_name_requested_vars{i,1})).(deblank(M_.exo_names(j,:)));
|
||||
temp(i,j,:) = oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecompositionME.Mean.(observable_name_requested_vars{i}).(M_.exo_names{j});
|
||||
end
|
||||
endo_index_varlist=strmatch(deblank(observable_name_requested_vars{i,1}),var_list_,'exact');
|
||||
oo_ = posterior_analysis('conditional decomposition',endo_index_varlist,'ME',Steps,options_,M_,oo_);
|
||||
temp(i,j+1,:)=oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecompositionME.Mean.(deblank(observable_name_requested_vars{i,1})).('ME');
|
||||
end
|
||||
title='Posterior mean conditional variance decomposition (in percent) with measurement error';
|
||||
save_name_string='dsge_post_mean_var_decomp_ME_cond_h';
|
||||
endo_index_varlist = strmatch(observable_name_requested_vars{i}, var_list_, 'exact');
|
||||
oo_ = posterior_analysis('conditional decomposition', var_list_{endo_index_varlist}, 'ME', Steps, options_, M_, oo_);
|
||||
temp(i,j+1,:) = oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecompositionME.Mean.(observable_name_requested_vars{i}).('ME');
|
||||
end
|
||||
title = 'Posterior mean conditional variance decomposition (in percent) with measurement error';
|
||||
save_name_string = 'dsge_post_mean_var_decomp_ME_cond_h';
|
||||
else
|
||||
for i=1:NumberOfObservedEndogenousVariables
|
||||
for j=1:NumberOfExogenousVariables
|
||||
temp(i,j,:)=oo_.PriorTheoreticalMoments.dsge.ConditionalVarianceDecompositionME.Mean.(deblank(observable_name_requested_vars(i,:))).(deblank(M_.exo_names(j,:)));
|
||||
temp(i,j,:) = oo_.PriorTheoreticalMoments.dsge.ConditionalVarianceDecompositionME.Mean.(observable_name_requested_vars{i}).(M_.exo_names{j});
|
||||
end
|
||||
endo_index_varlist=strmatch(deblank(observable_name_requested_vars{i,1}),var_list_,'exact');
|
||||
oo_ = prior_analysis('conditional decomposition',endo_index_varlist,'ME',Steps,options_,M_,oo_);
|
||||
temp(i,j+1,:)=oo_.PriorTheoreticalMoments.dsge.ConditionalVarianceDecompositionME.Mean.(deblank(observable_name_requested_vars{i,1})).('ME');
|
||||
end
|
||||
title='Prior mean conditional variance decomposition (in percent) with measurement error';
|
||||
save_name_string='dsge_prior_mean_var_decomp_ME_cond_h';
|
||||
endo_index_varlist = strmatch(observable_name_requested_vars{i}, var_list_, 'exact');
|
||||
oo_ = prior_analysis('conditional decomposition', var_list_{endo_index_varlist}, 'ME', Steps, options_, M_, oo_);
|
||||
temp(i,j+1,:) = oo_.PriorTheoreticalMoments.dsge.ConditionalVarianceDecompositionME.Mean.(observable_name_requested_vars{i}).('ME');
|
||||
end
|
||||
title = 'Prior mean conditional variance decomposition (in percent) with measurement error';
|
||||
save_name_string = 'dsge_prior_mean_var_decomp_ME_cond_h';
|
||||
end
|
||||
for step_iter=1:length(Steps)
|
||||
title_print=[title, ' Period ' int2str(Steps(step_iter))];
|
||||
title_print = [title, ' Period ' int2str(Steps(step_iter))];
|
||||
headers = M_.exo_names;
|
||||
headers(M_.exo_names_orig_ord,:) = headers;
|
||||
headers = char(' ',headers,'ME');
|
||||
lh = size(deblank(var_list_),2)+2;
|
||||
dyntable(options_,title_print,headers,deblank(char(observable_name_requested_vars)),100* ...
|
||||
temp(:,:,step_iter),lh,8,2);
|
||||
headers(M_.exo_names_orig_ord) = headers;
|
||||
headers = vertcat(' ', headers, 'ME');
|
||||
lh = cellofchararraymaxlength(var_list_)+2;
|
||||
dyntable(options_, title_print, headers, observable_name_requested_vars, 100*temp(:,:,step_iter), lh, 8, 2);
|
||||
if options_.TeX
|
||||
headers=M_.exo_names_tex;
|
||||
headers = char(' ',headers,'ME');
|
||||
labels = deblank(var_list_tex(varlist_pos,:));
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title_print,[save_name_string,int2str(Steps(step_iter))],headers,labels,100*temp(:,:,step_iter),lh,8,2);
|
||||
headers = M_.exo_names_tex;
|
||||
headers = vertcat(' ', headers, 'ME');
|
||||
labels = var_list_tex(varlist_pos);
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title_print, [save_name_string, int2str(Steps(step_iter))], headers, labels, 100*temp(:,:,step_iter), lh, 8, 2);
|
||||
end
|
||||
end
|
||||
skipline();
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function oo_ = ...
|
||||
conditional_variance_decomposition_ME_mc_analysis(NumberOfSimulations, type, dname, fname, Steps, exonames, exo, var_list, endogenous_variable_index, mh_conf_sig, oo_,options_)
|
||||
conditional_variance_decomposition_ME_mc_analysis(NumberOfSimulations, type, dname, fname, Steps, exonames, exo, var_list, endo, mh_conf_sig, oo_,options_)
|
||||
% This function analyses the (posterior or prior) distribution of the
|
||||
% endogenous variables' conditional variance decomposition with measurement error.
|
||||
%
|
||||
|
@ -14,8 +14,7 @@ function oo_ = ...
|
|||
% variable
|
||||
% var_list [string] (n_endo*char_length) character array with name
|
||||
% of endogenous variables
|
||||
% endogenous_variable_index [integer] index of the current
|
||||
% endogenous variable
|
||||
% endo [integer] Current endogenous variable
|
||||
% mh_conf_sig [double] 2 by 1 vector with upper
|
||||
% and lower bound of HPD intervals
|
||||
% oo_ [structure] Dynare structure where the results are saved.
|
||||
|
@ -23,7 +22,7 @@ function oo_ = ...
|
|||
% OUTPUTS
|
||||
% oo_ [structure] Dynare structure where the results are saved.
|
||||
|
||||
% Copyright (C) 2017 Dynare Team
|
||||
% Copyright (C) 2017-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -48,16 +47,16 @@ else
|
|||
PATH = [dname '/prior/moments/'];
|
||||
end
|
||||
|
||||
% $$$ indx = check_name(vartan,var);
|
||||
% $$$ if isempty(indx)
|
||||
% $$$ disp([ type '_analysis:: ' var ' is not a stationary endogenous variable!'])
|
||||
% $$$ return
|
||||
% $$$ end
|
||||
% $$$ endogenous_variable_index = sum(1:indx);
|
||||
endogenous_variable_index = check_name(var_list, endo);
|
||||
if isempty(endogenous_variable_index)
|
||||
disp([ type '_analysis:: Can''t find ' endo '!'])
|
||||
return
|
||||
end
|
||||
|
||||
exogenous_variable_index = check_name(exonames,exo);
|
||||
if isempty(exogenous_variable_index)
|
||||
if isequal(exo,'ME')
|
||||
exogenous_variable_index=size(exonames,1)+1;
|
||||
exogenous_variable_index=length(exonames)+1;
|
||||
else
|
||||
disp([ type '_analysis:: ' exo ' is not a declared exogenous variable!'])
|
||||
return
|
||||
|
@ -65,9 +64,9 @@ if isempty(exogenous_variable_index)
|
|||
end
|
||||
|
||||
[observable_pos_requested_vars,index_subset,index_observables]=intersect(var_list,options_.varobs,'stable');
|
||||
matrix_pos=strmatch(var_list(endogenous_variable_index,:),var_list(index_subset,:),'exact');
|
||||
name_1 = deblank(var_list(endogenous_variable_index,:));
|
||||
name_2 = deblank(exo);
|
||||
matrix_pos=strmatch(endo, var_list(index_subset),'exact');
|
||||
name_1 = endo;
|
||||
name_2 = exo;
|
||||
name = [ name_1 '.' name_2 ];
|
||||
|
||||
if isfield(oo_, [ TYPE 'TheoreticalMoments' ])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function oo_ = ...
|
||||
conditional_variance_decomposition_mc_analysis(NumberOfSimulations, type, dname, fname, Steps, exonames, exo, var_list, endogenous_variable_index, mh_conf_sig, oo_,options_)
|
||||
conditional_variance_decomposition_mc_analysis(NumberOfSimulations, type, dname, fname, Steps, exonames, exo, var_list, endo, mh_conf_sig, oo_,options_)
|
||||
% This function analyses the (posterior or prior) distribution of the
|
||||
% endogenous variables' conditional variance decomposition.
|
||||
%
|
||||
|
@ -23,7 +23,7 @@ function oo_ = ...
|
|||
% OUTPUTS
|
||||
% oo_ [structure] Dynare structure where the results are saved.
|
||||
|
||||
% Copyright (C) 2009-2017 Dynare Team
|
||||
% Copyright (C) 2009-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -48,12 +48,6 @@ else
|
|||
PATH = [dname '/prior/moments/'];
|
||||
end
|
||||
|
||||
% $$$ indx = check_name(vartan,var);
|
||||
% $$$ if isempty(indx)
|
||||
% $$$ disp([ type '_analysis:: ' var ' is not a stationary endogenous variable!'])
|
||||
% $$$ return
|
||||
% $$$ end
|
||||
% $$$ endogenous_variable_index = sum(1:indx);
|
||||
exogenous_variable_index = check_name(exonames,exo);
|
||||
if isempty(exogenous_variable_index)
|
||||
if ~isequal(exo,'ME')
|
||||
|
@ -62,8 +56,14 @@ if isempty(exogenous_variable_index)
|
|||
return
|
||||
end
|
||||
|
||||
name_1 = deblank(var_list(endogenous_variable_index,:));
|
||||
name_2 = deblank(exo);
|
||||
endogenous_variable_index = check_name(var_list, endo);
|
||||
if isempty(endogenous_variable_index)
|
||||
disp([ type '_analysis:: Can''t find ' endo '!'])
|
||||
return
|
||||
end
|
||||
|
||||
name_1 = endo;
|
||||
name_2 = exo;
|
||||
name = [ name_1 '.' name_2 ];
|
||||
|
||||
if isfield(oo_, [ TYPE 'TheoreticalMoments' ])
|
||||
|
|
|
@ -16,7 +16,7 @@ function oo_ = McMCDiagnostics(options_, estim_params_, M_, oo_)
|
|||
% PARALLEL CONTEXT
|
||||
% See the comment in posterior_sampler.m funtion.
|
||||
|
||||
% Copyright (C) 2005-2017 Dynare Team
|
||||
% Copyright (C) 2005-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -77,41 +77,42 @@ TotalNumberOfMhDraws = sum(record.MhDraws(:,1));
|
|||
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
||||
NumberOfDraws = TotalNumberOfMhDraws-floor(options_.mh_drop*TotalNumberOfMhDraws);
|
||||
|
||||
param_name=[];
|
||||
param_name_tex=[];
|
||||
for jj=1:npar
|
||||
param_name = {};
|
||||
param_name_tex = {};
|
||||
|
||||
for jj = 1:npar
|
||||
if options_.TeX
|
||||
[par_name_temp,par_name_tex_temp]=get_the_name(jj,options_.TeX,M_,estim_params_,options_);
|
||||
param_name = strvcat(param_name,par_name_temp);
|
||||
[par_name_temp, par_name_tex_temp] = get_the_name(jj, options_.TeX, M_,estim_params_, options_);
|
||||
param_name = vertcat(param_name, par_name_temp);
|
||||
par_name_tex_temp = strrep(par_name_tex_temp,'$','');
|
||||
param_name_tex = strvcat(param_name_tex,par_name_tex_temp);
|
||||
param_name_tex = vertcat(param_name_tex, par_name_tex_temp);
|
||||
else
|
||||
[par_name_temp]=get_the_name(jj,options_.TeX,M_,estim_params_,options_);
|
||||
param_name = strvcat(param_name,par_name_temp);
|
||||
par_name_temp = get_the_name(jj, options_.TeX, M_, estim_params_, options_);
|
||||
param_name = vertcat(param_name, par_name_temp);
|
||||
end
|
||||
Draws = GetAllPosteriorDraws(jj,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
Draws = reshape(Draws,[NumberOfDraws nblck]);
|
||||
Draws = GetAllPosteriorDraws(jj, FirstMhFile, FirstLine, TotalNumberOfMhFiles, NumberOfDraws);
|
||||
Draws = reshape(Draws, [NumberOfDraws nblck]);
|
||||
Nc = min(1000, NumberOfDraws/2);
|
||||
for ll=1:nblck
|
||||
for ll = 1:nblck
|
||||
Ifac(ll,jj) = mcmc_ifac(Draws(:,ll), Nc);
|
||||
end
|
||||
tmp = num2cell(Ifac(:,jj));
|
||||
end
|
||||
|
||||
my_title='MCMC Inefficiency factors per block';
|
||||
IFAC_header='Parameter';
|
||||
IFAC_header_tex='Parameter';
|
||||
for j=1:nblck
|
||||
IFAC_header = char(IFAC_header,['Block ' int2str(j)]);
|
||||
IFAC_header_tex = char(IFAC_header_tex,['Block~' int2str(j)]);
|
||||
IFAC_header = {'Parameter'};
|
||||
IFAC_header_tex = {'Parameter'};
|
||||
for j = 1:nblck
|
||||
IFAC_header = vertcat(IFAC_header, ['Block ' int2str(j)]);
|
||||
IFAC_header_tex = vertcat(IFAC_header_tex, ['Block~' int2str(j)]);
|
||||
end
|
||||
|
||||
lh = size(param_name,2)+2;
|
||||
dyntable(options_,my_title,IFAC_header,param_name,Ifac',lh,12,3);
|
||||
lh = cellofchararraymaxlength(param_name)+2;
|
||||
dyntable(options_, my_title, IFAC_header, param_name, Ifac', lh, 12, 3);
|
||||
skipline()
|
||||
|
||||
if options_.TeX
|
||||
dyn_latex_table(M_,options_,my_title,'MCMC_inefficiency_factors',IFAC_header_tex,param_name_tex,Ifac',lh,12,3);
|
||||
dyn_latex_table(M_, options_, my_title, 'MCMC_inefficiency_factors', IFAC_header_tex, param_name_tex, Ifac', lh, 12, 3);
|
||||
end
|
||||
record.InefficiencyFactorsPerBlock = Ifac;
|
||||
update_last_mh_history_file(MetropolisFolder, ModelName, record);
|
||||
|
@ -137,25 +138,25 @@ if nblck == 1 % Brooks and Gelman tests need more than one block
|
|||
first_obs_begin_sample = max(1,ceil(options_.mh_drop*NumberOfDraws));
|
||||
last_obs_begin_sample = first_obs_begin_sample+round(options_.convergence.geweke.geweke_interval(1)*NumberOfDraws*(1-options_.mh_drop));
|
||||
first_obs_end_sample = first_obs_begin_sample+round(options_.convergence.geweke.geweke_interval(2)*NumberOfDraws*(1-options_.mh_drop));
|
||||
param_name=[];
|
||||
param_name = {};
|
||||
if options_.TeX
|
||||
param_name_tex=[];
|
||||
param_name_tex = {};
|
||||
end
|
||||
for jj=1:npar
|
||||
if options_.TeX
|
||||
[param_name_temp, param_name_tex_temp]= get_the_name(jj,options_.TeX,M_,estim_params_,options_);
|
||||
param_name_tex = strvcat(param_name_tex,strrep(param_name_tex_temp,'$',''));
|
||||
param_name = strvcat(param_name,param_name_temp);
|
||||
[param_name_temp, param_name_tex_temp] = get_the_name(jj, options_.TeX, M_, estim_params_, options_);
|
||||
param_name_tex = vertcat(param_name_tex, strrep(param_name_tex_temp, '$',''));
|
||||
param_name = vertcat(param_name, param_name_temp);
|
||||
else
|
||||
param_name_temp = get_the_name(jj,options_.TeX,M_,estim_params_,options_);
|
||||
param_name = strvcat(param_name,param_name_temp);
|
||||
param_name_temp = get_the_name(jj, options_.TeX, M_,estim_params_, options_);
|
||||
param_name = vertcat(param_name, param_name_temp);
|
||||
end
|
||||
end
|
||||
fprintf('\nGeweke (1992) Convergence Tests, based on means of draws %d to %d vs %d to %d.\n',first_obs_begin_sample,last_obs_begin_sample,first_obs_end_sample,NumberOfDraws);
|
||||
fprintf('p-values are for Chi2-test for equality of means.\n');
|
||||
Geweke_header=char('Parameter', 'Post. Mean', 'Post. Std', 'p-val No Taper');
|
||||
for ii=1:length(options_.convergence.geweke.taper_steps)
|
||||
Geweke_header=char(Geweke_header,['p-val ' num2str(options_.convergence.geweke.taper_steps(ii)),'% Taper']);
|
||||
Geweke_header = {'Parameter'; 'Post. Mean'; 'Post. Std'; 'p-val No Taper'};
|
||||
for ii = 1:length(options_.convergence.geweke.taper_steps)
|
||||
Geweke_header = vertcat(Geweke_header, ['p-val ' num2str(options_.convergence.geweke.taper_steps(ii)),'% Taper']);
|
||||
end
|
||||
datamat=NaN(npar,3+length(options_.convergence.geweke.taper_steps));
|
||||
for jj=1:npar
|
||||
|
@ -175,22 +176,22 @@ if nblck == 1 % Brooks and Gelman tests need more than one block
|
|||
[results_vec2] = geweke_moments(param_draws2,options_);
|
||||
|
||||
results_struct = geweke_chi2_test(results_vec1,results_vec2,results_struct,options_);
|
||||
eval(['oo_.convergence.geweke.',param_name(jj,:),'=results_struct;'])
|
||||
oo_.convergence.geweke.(param_name{jj}) = results_struct;
|
||||
datamat(jj,:)=[results_struct.posteriormean,results_struct.posteriorstd,results_struct.prob_chi2_test];
|
||||
end
|
||||
lh = size(param_name,2)+2;
|
||||
dyntable(options_,'',Geweke_header,param_name,datamat,lh,12,3);
|
||||
dyntable(options_, '', Geweke_header, param_name, datamat, lh, 12, 3);
|
||||
if options_.TeX
|
||||
Geweke_tex_header=char('Parameter', 'Mean', 'Std', 'No\ Taper');
|
||||
additional_header={[' & \multicolumn{2}{c}{Posterior} & \multicolumn{',num2str(1+length(options_.convergence.geweke.taper_steps)),'}{c}{p-values} \\'],
|
||||
Geweke_tex_header = {'Parameter'; 'Mean'; 'Std'; 'No\ Taper'};
|
||||
additional_header = {[' & \multicolumn{2}{c}{Posterior} & \multicolumn{',num2str(1+length(options_.convergence.geweke.taper_steps)),'}{c}{p-values} \\'],
|
||||
['\cmidrule(r{.75em}){2-3} \cmidrule(r{.75em}){4-',num2str(4+length(options_.convergence.geweke.taper_steps)),'}']};
|
||||
for ii=1:length(options_.convergence.geweke.taper_steps)
|
||||
Geweke_tex_header=char(Geweke_tex_header,[num2str(options_.convergence.geweke.taper_steps(ii)),'\%%\ Taper']);
|
||||
Geweke_tex_header = vertcat(Geweke_tex_header, [num2str(options_.convergence.geweke.taper_steps(ii)),'\%%\ Taper']);
|
||||
end
|
||||
headers = char(Geweke_tex_header);
|
||||
lh = size(param_name_tex,2)+2;
|
||||
headers = Geweke_tex_header;
|
||||
lh = cellofchararraymaxlength(param_name_tex)+2;
|
||||
my_title=sprintf('Geweke (1992) Convergence Tests, based on means of draws %d to %d vs %d to %d. p-values are for $\\\\chi^2$-test for equality of means.',first_obs_begin_sample,last_obs_begin_sample,first_obs_end_sample,NumberOfDraws);
|
||||
dyn_latex_table(M_,options_,my_title,'geweke',headers,param_name_tex,datamat,lh,12,4,additional_header);
|
||||
dyn_latex_table(M_, options_, my_title, 'geweke', headers, param_name_tex, datamat, lh, 12, 4, additional_header);
|
||||
end
|
||||
skipline(2);
|
||||
|
||||
|
@ -206,17 +207,16 @@ if nblck == 1 % Brooks and Gelman tests need more than one block
|
|||
oo_.Raftery_Lewis = raftery_lewis(x2,Raftery_Lewis_q,Raftery_Lewis_r,Raftery_Lewis_s);
|
||||
oo_.Raftery_Lewis.parameter_names=param_name;
|
||||
my_title=sprintf('Raftery/Lewis (1992) Convergence Diagnostics, based on quantile q=%4.3f with precision r=%4.3f with probability s=%4.3f.',Raftery_Lewis_q,Raftery_Lewis_r,Raftery_Lewis_s);
|
||||
headers = char('Variables','M (burn-in)','N (req. draws)','N+M (total draws)','k (thinning)');
|
||||
|
||||
headers = {'Variables'; 'M (burn-in)'; 'N (req. draws)'; 'N+M (total draws)'; 'k (thinning)'};
|
||||
raftery_data_mat=[oo_.Raftery_Lewis.M_burn,oo_.Raftery_Lewis.N_prec,oo_.Raftery_Lewis.N_total,oo_.Raftery_Lewis.k_thin];
|
||||
raftery_data_mat=[raftery_data_mat;max(raftery_data_mat)];
|
||||
labels_Raftery_Lewis=char(param_name,'Maximum');
|
||||
lh = size(labels_Raftery_Lewis,2)+2;
|
||||
dyntable(options_,my_title,headers,labels_Raftery_Lewis,raftery_data_mat,lh,10,0);
|
||||
labels_Raftery_Lewis = vertcat(param_name, 'Maximum');
|
||||
lh = cellofchararraymaxlength(labels_Raftery_Lewis)+2;
|
||||
dyntable(options_, my_title, headers, labels_Raftery_Lewis, raftery_data_mat, lh, 10, 0);
|
||||
if options_.TeX
|
||||
labels_Raftery_Lewis_tex=char(param_name_tex,'Maximum');
|
||||
lh = size(labels_Raftery_Lewis_tex,2)+2;
|
||||
dyn_latex_table(M_,options_,my_title,'raftery_lewis',headers,labels_Raftery_Lewis_tex,raftery_data_mat,lh,10,0);
|
||||
labels_Raftery_Lewis_tex = vertcat(param_name_tex, 'Maximum');
|
||||
lh = cellofchararraymaxlength(labels_Raftery_Lewis_tex)+2;
|
||||
dyn_latex_table(M_, options_, my_title, 'raftery_lewis', headers, labels_Raftery_Lewis_tex, raftery_data_mat, lh, 10, 0);
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ function datatomfile (s, var_list, names)
|
|||
% provided, all the variables as defined in M_.endo_names will be saved in
|
||||
% the generated m file.
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -40,24 +40,28 @@ global M_ oo_
|
|||
sm=[s,'.m'];
|
||||
fid=fopen(sm,'w') ;
|
||||
|
||||
if nargin < 2 || size(var_list,1) == 0
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr,:);
|
||||
if nargin < 2 || isempty(var_list)
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
|
||||
n = size(var_list,1);
|
||||
ivar=zeros(n,1);
|
||||
n = length(var_list);
|
||||
|
||||
if nargin==3
|
||||
if ~isequal(size(var_list,1),n)
|
||||
names = cellstr(names);
|
||||
n = length(names);
|
||||
if ~isequal(length(var_list), n)
|
||||
error('datatomfile:: Second and third arguments must have the same number of rows (variables)!')
|
||||
end
|
||||
else
|
||||
names = var_list;
|
||||
n = length(names);
|
||||
end
|
||||
|
||||
ivar=zeros(n, 1);
|
||||
|
||||
% Get indices for the endogenous variables.
|
||||
for i=1:n
|
||||
i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
|
||||
i_tmp = strmatch(var_list{i}, M_.endo_names, 'exact');
|
||||
if isempty(i_tmp)
|
||||
error (['One of the specified variables does not exist']) ;
|
||||
else
|
||||
|
@ -69,7 +73,7 @@ fprintf(fid,'%% Dataset generated by %s.\n',stack(2).file);
|
|||
fprintf(fid,['%% ' datestr(now,0) '\n']);
|
||||
% Save the selected data.
|
||||
for i = 1:n
|
||||
fprintf(fid,[strtrim(names(i,:)), ' = ['],'\n') ;
|
||||
fprintf(fid,[names{i}, ' = ['],'\n') ;
|
||||
fprintf(fid,'\n') ;
|
||||
fprintf(fid,'%15.8g\n',oo_.endo_simul(ivar(i),:)') ;
|
||||
fprintf(fid,'];\n') ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function info = discretionary_policy(var_list)
|
||||
|
||||
% Copyright (C) 2007-2015 Dynare Team
|
||||
% Copyright (C) 2007-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -27,9 +27,8 @@ info = stoch_simul(var_list);
|
|||
if options_.noprint == 0
|
||||
disp_steady_state(M_,oo_)
|
||||
for i=M_.orig_endo_nbr:M_.endo_nbr
|
||||
if strmatch('mult_',M_.endo_names(i,:))
|
||||
disp(sprintf('%s \t\t %g',M_.endo_names(i,:), ...
|
||||
oo_.dr.ys(i)));
|
||||
if strmatch('mult_', M_.endo_names{i})
|
||||
disp(sprintf('%s \t\t %g', M_.endo_names{i}, oo_.dr.ys(i)));
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function [dr,ys,info]=discretionary_policy_1(oo_,Instruments)
|
||||
|
||||
% Copyright (C) 2007-2017 Dynare Team
|
||||
% Copyright (C) 2007-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -42,7 +42,7 @@ else
|
|||
M_.orig_model = M_;
|
||||
end
|
||||
|
||||
beta = get_optimal_policy_discount_factor(M_.params,M_.param_names);
|
||||
beta = get_optimal_policy_discount_factor(M_.params, M_.param_names);
|
||||
|
||||
exo_nbr = M_.exo_nbr;
|
||||
if isfield(M_,'orig_model')
|
||||
|
@ -70,7 +70,7 @@ end
|
|||
if any(any(Uy~=0))
|
||||
non_zero_derivs=find(any(Uy~=0));
|
||||
for ii=1:length(non_zero_derivs)
|
||||
non_zero_deriv_names{ii,1}=deblank(M_.endo_names(non_zero_derivs(ii),:));
|
||||
non_zero_deriv_names{ii,1} = M_.endo_names{non_zero_derivs(ii)};
|
||||
end
|
||||
disp_string=[non_zero_deriv_names{1,:}];
|
||||
for ii=2:size(non_zero_deriv_names,1)
|
||||
|
@ -116,7 +116,7 @@ end
|
|||
instr_id=nan(instr_nbr,1);
|
||||
for j=1:instr_nbr
|
||||
vj=deblank(Instruments(j,:));
|
||||
vj_id=strmatch(vj,endo_names,'exact');
|
||||
vj_id=strmatch(vj, endo_names, 'exact');
|
||||
if ~isempty(vj_id)
|
||||
instr_id(j)=vj_id;
|
||||
else
|
||||
|
|
|
@ -8,7 +8,7 @@ function disp_dr(dr,order,var_list)
|
|||
% var_list [char array]: list of endogenous variables for which the
|
||||
% decision rules should be printed
|
||||
%
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -43,17 +43,17 @@ else
|
|||
k1 = dr.order_var;
|
||||
end
|
||||
|
||||
if size(var_list,1) == 0
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr, :);
|
||||
if isempty(var_list)
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
|
||||
nvar = size(var_list,1);
|
||||
nvar = length(var_list);
|
||||
|
||||
ivar=zeros(nvar,1);
|
||||
for i=1:nvar
|
||||
i_tmp = strmatch(var_list(i,:),M_.endo_names(k1,:),'exact');
|
||||
i_tmp = strmatch(var_list{i}, M_.endo_names(k1), 'exact');
|
||||
if isempty(i_tmp)
|
||||
disp(var_list(i,:));
|
||||
disp(var_list{i});
|
||||
error (['One of the variable specified does not exist']) ;
|
||||
else
|
||||
ivar(i) = i_tmp;
|
||||
|
@ -63,7 +63,7 @@ end
|
|||
% get length of display strings
|
||||
header_label_length=16; %default
|
||||
for ii=1:length(ivar)
|
||||
header_label_length=max(header_label_length,length(deblank(M_.endo_names(k1(ivar(ii)),:)))+2);
|
||||
header_label_length = max(header_label_length,length(M_.endo_names{k1(ivar(ii))})+2);
|
||||
end
|
||||
header_label_format = sprintf('%%%ds',header_label_length);
|
||||
value_format_float = sprintf('%%%d.6f',header_label_length);
|
||||
|
@ -81,7 +81,7 @@ else
|
|||
aux_var_additional_characters=0;
|
||||
end
|
||||
|
||||
var_name_width=max([max(size(deblank(M_.endo_names(k1(ivar),:)),2)),max(size(deblank(M_.exo_names),2))]);
|
||||
var_name_width = max([cellofchararraymaxlength(M_.endo_names(k1(ivar))), cellofchararraymaxlength(M_.exo_names)]);
|
||||
|
||||
%deal with covariances
|
||||
if order > 1
|
||||
|
@ -97,7 +97,7 @@ disp('POLICY AND TRANSITION FUNCTIONS')
|
|||
% variable names
|
||||
str = char(32*ones(1,var_name_width));
|
||||
for i=1:nvar
|
||||
str = [str sprintf(header_label_format,deblank(M_.endo_names(k1(ivar(i)),:)))];
|
||||
str = [str sprintf(header_label_format, M_.endo_names{k1(ivar(i))})];
|
||||
end
|
||||
disp(str);
|
||||
%
|
||||
|
@ -150,10 +150,10 @@ end
|
|||
%
|
||||
for k=1:nu
|
||||
flag = 0;
|
||||
str = sprintf(label_format,M_.exo_names(k,:));
|
||||
str = sprintf(label_format, M_.exo_names{k});
|
||||
for i=1:nvar
|
||||
x = dr.ghu(ivar(i),k);
|
||||
[str,flag]=get_print_string(str,x,value_format_zero,value_format_float,flag,options_);
|
||||
[str,flag] = get_print_string(str, x, value_format_zero, value_format_float, flag, options_);
|
||||
end
|
||||
if flag
|
||||
disp(str)
|
||||
|
@ -167,7 +167,7 @@ if order > 1
|
|||
flag = 0;
|
||||
str1 = sprintf('%s,%s',subst_auxvar(k1(klag(k,1)),klag(k,2)-M_.maximum_lag-2), ...
|
||||
subst_auxvar(k1(klag(j,1)),klag(j,2)-M_.maximum_lag-2));
|
||||
str = sprintf(label_format,str1);
|
||||
str = sprintf(label_format, str1);
|
||||
for i=1:nvar
|
||||
if k == j
|
||||
x = dr.ghxx(ivar(i),(k-1)*nx+j)/2;
|
||||
|
@ -187,14 +187,14 @@ if order > 1
|
|||
for k = 1:nu
|
||||
for j = 1:k
|
||||
flag = 0;
|
||||
str = sprintf(label_format,[deblank(M_.exo_names(k,:)) ',' deblank(M_.exo_names(j,:))] );
|
||||
str = sprintf(label_format, [M_.exo_names{k} ',' M_.exo_names{j}]);
|
||||
for i=1:nvar
|
||||
if k == j
|
||||
x = dr.ghuu(ivar(i),(k-1)*nu+j)/2;
|
||||
else
|
||||
x = dr.ghuu(ivar(i),(k-1)*nu+j);
|
||||
end
|
||||
[str,flag]=get_print_string(str,x,value_format_zero,value_format_float,flag,options_);
|
||||
[str,flag]=get_print_string(str, x, value_format_zero, value_format_float, flag, options_);
|
||||
end
|
||||
if flag
|
||||
disp(str)
|
||||
|
@ -207,8 +207,7 @@ if order > 1
|
|||
for k = 1:nx
|
||||
for j = 1:nu
|
||||
flag = 0;
|
||||
str1 = sprintf('%s,%s',subst_auxvar(k1(klag(k,1)),klag(k,2)-M_.maximum_lag-2), ...
|
||||
deblank(M_.exo_names(j,:)));
|
||||
str1 = sprintf('%s,%s',subst_auxvar(k1(klag(k,1)),klag(k,2)-M_.maximum_lag-2), M_.exo_names{j});
|
||||
str = sprintf(label_format,str1);
|
||||
for i=1:nvar
|
||||
x = dr.ghxu(ivar(i),(k-1)*nu+j);
|
||||
|
@ -230,41 +229,40 @@ function str = subst_auxvar(aux_index, aux_lead_lag)
|
|||
global M_
|
||||
|
||||
if aux_index <= M_.orig_endo_nbr
|
||||
str = sprintf('%s(%d)', deblank(M_.endo_names(aux_index,:)), aux_lead_lag);
|
||||
str = sprintf('%s(%d)', M_.endo_names{aux_index}, aux_lead_lag);
|
||||
return
|
||||
end
|
||||
for i = 1:length(M_.aux_vars)
|
||||
if M_.aux_vars(i).endo_index == aux_index
|
||||
switch M_.aux_vars(i).type
|
||||
case 0
|
||||
str = sprintf('%s(%d)',deblank(M_.endo_names(aux_index,:)),aux_lead_lag);
|
||||
str = sprintf('%s(%d)', M_.endo_names{aux_index}, aux_lead_lag);
|
||||
return
|
||||
case 1
|
||||
orig_name = deblank(M_.endo_names(M_.aux_vars(i).orig_index, :));
|
||||
orig_name = M_.endo_names{M_.aux_vars(i).orig_index};
|
||||
case 3
|
||||
orig_name = deblank(M_.exo_names(M_.aux_vars(i).orig_index, :));
|
||||
orig_name = M_.exo_names{M_.aux_vars(i).orig_index};
|
||||
case 4
|
||||
str = sprintf('EXPECTATION(%d)(...)', aux_lead_lag);
|
||||
return
|
||||
case 6
|
||||
str = sprintf('%s(%d)', ...
|
||||
deblank(M_.endo_names(M_.aux_vars(i).endo_index, :)),aux_lead_lag);
|
||||
str = sprintf('%s(%d)', M_.endo_names{M_.aux_vars(i).endo_index}, aux_lead_lag);
|
||||
return
|
||||
otherwise
|
||||
error(sprintf('Invalid auxiliary type: %s', M_.endo_names(aux_index, :)))
|
||||
error(sprintf('Invalid auxiliary type: %s', M_.endo_names{aux_index}))
|
||||
end
|
||||
str = sprintf('%s(%d)', orig_name, M_.aux_vars(i).orig_lead_lag+aux_lead_lag);
|
||||
return
|
||||
end
|
||||
end
|
||||
error(sprintf('Could not find aux var: %s', M_.endo_names(aux_index, :)))
|
||||
error(sprintf('Could not find aux var: %s', M_.endo_names{aux_index}))
|
||||
end
|
||||
|
||||
function [str,flag]=get_print_string(str,x,value_format_zero,value_format_float,flag,options_)
|
||||
function [str,flag]=get_print_string(str, x, value_format_zero, value_format_float, flag, options_)
|
||||
if abs(x) >= options_.dr_display_tol
|
||||
flag = 1;
|
||||
str = [str sprintf(value_format_float,x)];
|
||||
str = [str sprintf(value_format_float, x)];
|
||||
else
|
||||
str = [str sprintf(value_format_zero,0)];
|
||||
str = [str sprintf(value_format_zero, 0)];
|
||||
end
|
||||
end
|
|
@ -8,7 +8,7 @@ function disp_model_summary(M,dr,options)
|
|||
% dr [matlab structure] Decision rules
|
||||
% options [matlab structure] Options
|
||||
%
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -36,7 +36,7 @@ disp([' Number of jumpers: ' ...
|
|||
int2str(length(find(dr.kstate(:,2) == M.maximum_lag+2)))])
|
||||
disp([' Number of static variables: ' int2str(M.nstatic)])
|
||||
my_title='MATRIX OF COVARIANCE OF EXOGENOUS SHOCKS';
|
||||
labels = deblank(M.exo_names);
|
||||
headers = char('Variables',labels);
|
||||
lh = size(labels,2)+2;
|
||||
dyntable(options,my_title,headers,labels,M.Sigma_e,lh,10,6);
|
||||
labels = M.exo_names;
|
||||
headers = vertcat('Variables', labels);
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyntable(options, my_title, headers, labels, M.Sigma_e, lh, 10, 6);
|
||||
|
|
|
@ -11,7 +11,7 @@ function oo_=disp_moments(y,var_list,M_,options_,oo_)
|
|||
% OUTPUTS
|
||||
% oo_ [structure] Dynare's results structure,
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -31,16 +31,16 @@ function oo_=disp_moments(y,var_list,M_,options_,oo_)
|
|||
warning_old_state = warning;
|
||||
warning off
|
||||
|
||||
if size(var_list,1) == 0
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr, :);
|
||||
if isempty(var_list)
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
|
||||
nvar = size(var_list,1);
|
||||
nvar = length(var_list);
|
||||
ivar=zeros(nvar,1);
|
||||
for i=1:nvar
|
||||
i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
|
||||
i_tmp = strmatch(var_list{i}, M_.endo_names, 'exact');
|
||||
if isempty(i_tmp)
|
||||
error (['One of the variable specified does not exist']) ;
|
||||
error ('One of the variable specified does not exist') ;
|
||||
else
|
||||
ivar(i) = i_tmp;
|
||||
end
|
||||
|
@ -50,7 +50,7 @@ y = y(ivar,options_.drop+1:end)';
|
|||
|
||||
ME_present=0;
|
||||
if ~all(M_.H==0)
|
||||
[observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
|
||||
[observable_pos_requested_vars, index_subset, index_observables] = intersect(ivar, options_.varobs_id, 'stable');
|
||||
if ~isempty(observable_pos_requested_vars)
|
||||
ME_present=1;
|
||||
i_ME = setdiff([1:size(M_.H,1)],find(diag(M_.H) == 0)); % find ME with 0 variance
|
||||
|
@ -79,20 +79,17 @@ oo_.var = y'*y/size(y,1);
|
|||
oo_.skewness = (mean(y.^3)./s2.^1.5)';
|
||||
oo_.kurtosis = (mean(y.^4)./(s2.*s2)-3)';
|
||||
|
||||
labels = deblank(M_.endo_names(ivar,:));
|
||||
labels_TeX = deblank(M_.endo_names_tex(ivar,:));
|
||||
labels = M_.endo_names(ivar);
|
||||
labels_TeX = M_.endo_names_tex(ivar);
|
||||
|
||||
if options_.nomoments == 0
|
||||
z = [ m' s' s2' (mean(y.^3)./s2.^1.5)' (mean(y.^4)./(s2.*s2)-3)' ];
|
||||
title='MOMENTS OF SIMULATED VARIABLES';
|
||||
|
||||
title=add_filter_subtitle(title,options_);
|
||||
|
||||
headers=char('VARIABLE','MEAN','STD. DEV.','VARIANCE','SKEWNESS', ...
|
||||
'KURTOSIS');
|
||||
dyntable(options_,title,headers,labels,z,size(labels,2)+2,16,6);
|
||||
title=add_filter_subtitle(title, options_);
|
||||
headers = {'VARIABLE'; 'MEAN'; 'STD. DEV.'; 'VARIANCE'; 'SKEWNESS'; 'KURTOSIS'};
|
||||
dyntable(options_, title, headers, labels, z, cellofchararraymaxlength(labels)+2, 16, 6);
|
||||
if options_.TeX
|
||||
dyn_latex_table(M_,options_,title,'sim_moments',headers,labels_TeX,z,size(labels,2)+2,16,6);
|
||||
dyn_latex_table(M_, options_, title, 'sim_moments', headers, labels_TeX, z, cellofchararraymaxlength(labels)+2, 16, 6);
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -103,15 +100,13 @@ if options_.nocorr == 0
|
|||
end
|
||||
if options_.noprint == 0
|
||||
title = 'CORRELATION OF SIMULATED VARIABLES';
|
||||
|
||||
title=add_filter_subtitle(title,options_);
|
||||
|
||||
headers = char('VARIABLE',M_.endo_names(ivar,:));
|
||||
dyntable(options_,title,headers,labels,corr,size(labels,2)+2,8,4);
|
||||
headers = vertcat('VARIABLE', M_.endo_names(ivar));
|
||||
dyntable(options_, title, headers, labels, corr, cellofchararraymaxlength(labels)+2, 8, 4);
|
||||
if options_.TeX
|
||||
headers = char('VARIABLE',M_.endo_names_tex(ivar,:));
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title,'sim_corr_matrix',headers,labels_TeX,corr,size(labels,2)+2,8,4);
|
||||
headers = vertcat('VARIABLE', M_.endo_names_tex(ivar));
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title, 'sim_corr_matrix', headers, labels_TeX, corr, lh, 8,4);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -130,12 +125,12 @@ if ar > 0
|
|||
if options_.noprint == 0
|
||||
title = 'AUTOCORRELATION OF SIMULATED VARIABLES';
|
||||
title=add_filter_subtitle(title,options_);
|
||||
headers = char('VARIABLE',int2str([1:ar]'));
|
||||
dyntable(options_,title,headers,labels,autocorr,size(labels,2)+2,8,4);
|
||||
headers = vertcat('VARIABLE', cellstr(int2str([1:ar]')));
|
||||
dyntable(options_, title, headers, labels, autocorr, cellofchararraymaxlength(labels)+2, 8, 4);
|
||||
if options_.TeX
|
||||
headers = char('VARIABLE',int2str([1:ar]'));
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title,'sim_autocorr_matrix',headers,labels_TeX,autocorr,size(labels_TeX,2)+2,8,4);
|
||||
headers = vertcat('VARIABLE', cellstr(int2str([1:ar]')));
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title, 'sim_autocorr_matrix', headers, labels_TeX, autocorr, cellofchararraymaxlength(labels_TeX)+2, 8, 4);
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -180,28 +175,31 @@ if ~options_.nodecomposition
|
|||
if ~options_.noprint %options_.nomoments == 0
|
||||
skipline()
|
||||
title='VARIANCE DECOMPOSITION SIMULATING ONE SHOCK AT A TIME (in percent)';
|
||||
|
||||
title=add_filter_subtitle(title,options_);
|
||||
|
||||
headers = M_.exo_names;
|
||||
headers(M_.exo_names_orig_ord,:) = headers;
|
||||
headers = char(' ',headers);
|
||||
lh = size(deblank(M_.endo_names(ivar,:)),2)+2;
|
||||
dyntable(options_,title,char(headers,'Tot. lin. contr.'),deblank(M_.endo_names(ivar,:)),[oo_.variance_decomposition sum(oo_.variance_decomposition,2)],lh,8,2);
|
||||
headers(M_.exo_names_orig_ord) = headers;
|
||||
headers = vertcat(' ', headers);
|
||||
lh = cellofchararraymaxlength(M_.endo_names(ivar))+2;
|
||||
dyntable(options_, title, vertcat(headers, 'Tot. lin. contr.'), ...
|
||||
M_.endo_names(ivar), [oo_.variance_decomposition sum(oo_.variance_decomposition,2)], lh, 8, 2);
|
||||
if ME_present
|
||||
headers_ME=char(headers,'ME');
|
||||
dyntable(options_,[title,' WITH MEASUREMENT ERROR'],char(headers_ME,'Tot. lin. contr.'),deblank(M_.endo_names(ivar(index_subset), ...
|
||||
:)),[oo_.variance_decomposition_ME sum(oo_.variance_decomposition_ME,2)],lh,8,2);
|
||||
headers_ME = vertcat(headers, 'ME');
|
||||
dyntable(options_, [title,' WITH MEASUREMENT ERROR'], vertcat(headers_ME, 'Tot. lin. contr.'), M_.endo_names(ivar(index_subset)), ...
|
||||
[oo_.variance_decomposition_ME sum(oo_.variance_decomposition_ME, 2)], lh, 8, 2);
|
||||
end
|
||||
if options_.TeX
|
||||
headers=M_.exo_names_tex;
|
||||
headers = char(' ',headers);
|
||||
labels = deblank(M_.endo_names_tex(ivar,:));
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title,'sim_var_decomp',char(headers,'Tot. lin. contr.'),labels_TeX,[oo_.variance_decomposition sum(oo_.variance_decomposition,2)],lh,8,2);
|
||||
headers = M_.exo_names_tex;
|
||||
headers = vertcat(' ', headers);
|
||||
labels = M_.endo_names_tex(ivar);
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title, 'sim_var_decomp', vertcat(headers, 'Tot. lin. contr.'), ...
|
||||
labels_TeX, [oo_.variance_decomposition sum(oo_.variance_decomposition, 2)], lh, 8, 2);
|
||||
if ME_present
|
||||
headers_ME=char(headers,'ME');
|
||||
dyn_latex_table(M_,options_,[title,' WITH MEASUREMENT ERROR'],'sim_var_decomp_ME',char(headers_ME,'Tot. lin. contr.'),labels_TeX(ivar(index_subset),:),[oo_.variance_decomposition_ME sum(oo_.variance_decomposition_ME,2)],lh,8,2);
|
||||
headers_ME = vertcat(headers, 'ME');
|
||||
dyn_latex_table(M_, options_, [title, ' WITH MEASUREMENT ERROR'], 'sim_var_decomp_ME', ...
|
||||
vertcat(headers_ME, 'Tot. lin. contr.'), ...
|
||||
labels_TeX(ivar(index_subset)), ...
|
||||
[oo_.variance_decomposition_ME sum(oo_.variance_decomposition_ME, 2)], lh, 8, 2);
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -218,7 +216,7 @@ end
|
|||
warning(warning_old_state);
|
||||
end
|
||||
|
||||
function y=get_filtered_time_series(y,m,options_)
|
||||
function y = get_filtered_time_series(y, m, options_)
|
||||
|
||||
if options_.hp_filter && ~options_.one_sided_hp_filter && ~options_.bandpass.indicator
|
||||
[hptrend,y] = sample_hp_filter(y,options_.hp_filter);
|
||||
|
|
|
@ -12,7 +12,7 @@ function disp_steady_state(M,oo)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -34,6 +34,7 @@ disp('STEADY-STATE RESULTS:')
|
|||
skipline()
|
||||
endo_names = M.endo_names;
|
||||
steady_state = oo.steady_state;
|
||||
for i=1:M.orig_endo_nbr
|
||||
disp(sprintf('%s \t\t %g',endo_names(i,:),steady_state(i)));
|
||||
|
||||
for i = 1:M.orig_endo_nbr
|
||||
disp(sprintf('%s \t\t %g', endo_names{i}, steady_state(i)));
|
||||
end
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
function oo_=disp_th_moments(dr,var_list,M_,options_,oo_)
|
||||
function oo_ = disp_th_moments(dr, var_list, M_, options_, oo_)
|
||||
|
||||
% Display theoretical moments of variables
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -22,21 +23,21 @@ nodecomposition = options_.nodecomposition;
|
|||
if options_.one_sided_hp_filter
|
||||
error(['disp_th_moments:: theoretical moments incompatible with one-sided HP filter. Use simulated moments instead'])
|
||||
end
|
||||
if size(var_list,1) == 0
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr, :);
|
||||
if isempty(var_list)
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
nvar = size(var_list,1);
|
||||
nvar = length(var_list);
|
||||
ivar=zeros(nvar,1);
|
||||
for i=1:nvar
|
||||
i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
|
||||
i_tmp = strmatch(var_list{i}, M_.endo_names, 'exact');
|
||||
if isempty(i_tmp)
|
||||
error (['One of the variable specified does not exist']) ;
|
||||
error ('One of the variable specified does not exist');
|
||||
else
|
||||
ivar(i) = i_tmp;
|
||||
end
|
||||
end
|
||||
|
||||
[oo_.gamma_y,stationary_vars] = th_autocovariances(dr,ivar,M_,options_, nodecomposition);
|
||||
[oo_.gamma_y,stationary_vars] = th_autocovariances(dr, ivar, M_, options_, nodecomposition);
|
||||
m = dr.ys(ivar);
|
||||
non_stationary_vars = setdiff(1:length(ivar),stationary_vars);
|
||||
m(non_stationary_vars) = NaN;
|
||||
|
@ -71,75 +72,73 @@ if size(stationary_vars, 1) > 0
|
|||
end
|
||||
if ~options_.noprint %options_.nomoments == 0
|
||||
if options_.order == 2
|
||||
title='APPROXIMATED THEORETICAL MOMENTS';
|
||||
title = 'APPROXIMATED THEORETICAL MOMENTS';
|
||||
else
|
||||
title='THEORETICAL MOMENTS';
|
||||
title = 'THEORETICAL MOMENTS';
|
||||
end
|
||||
title=add_filter_subtitle(title,options_);
|
||||
headers=char('VARIABLE','MEAN','STD. DEV.','VARIANCE');
|
||||
labels = deblank(M_.endo_names(ivar,:));
|
||||
lh = size(labels,2)+2;
|
||||
dyntable(options_,title,headers,labels,z,lh,11,4);
|
||||
title = add_filter_subtitle(title, options_);
|
||||
headers = {'VARIABLE';'MEAN';'STD. DEV.';'VARIANCE'};
|
||||
labels = M_.endo_names(ivar);
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyntable(options_, title, headers, labels, z, lh, 11, 4);
|
||||
if options_.TeX
|
||||
labels = deblank(M_.endo_names_tex(ivar,:));
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title,'th_moments',headers,labels,z,lh,11,4);
|
||||
labels = M_.endo_names_tex(ivar);
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title, 'th_moments', headers, labels, z, lh, 11, 4);
|
||||
end
|
||||
|
||||
if M_.exo_nbr > 1 && ~nodecomposition
|
||||
skipline()
|
||||
if options_.order == 2
|
||||
title='APPROXIMATED VARIANCE DECOMPOSITION (in percent)';
|
||||
title = 'APPROXIMATED VARIANCE DECOMPOSITION (in percent)';
|
||||
else
|
||||
title='VARIANCE DECOMPOSITION (in percent)';
|
||||
title = 'VARIANCE DECOMPOSITION (in percent)';
|
||||
end
|
||||
title=add_filter_subtitle(title,options_);
|
||||
title = add_filter_subtitle(title, options_);
|
||||
headers = M_.exo_names;
|
||||
headers(M_.exo_names_orig_ord,:) = headers;
|
||||
headers = char(' ',headers);
|
||||
lh = size(deblank(M_.endo_names(ivar(stationary_vars),:)),2)+2;
|
||||
dyntable(options_,title,headers,deblank(M_.endo_names(ivar(stationary_vars), ...
|
||||
:)),100* ...
|
||||
oo_.gamma_y{options_.ar+2}(stationary_vars,:),lh,8,2);
|
||||
headers(M_.exo_names_orig_ord) = headers;
|
||||
headers = vertcat(' ', headers);
|
||||
lh = cellofchararraymaxlength(M_.endo_names(ivar(stationary_vars)))+2;
|
||||
dyntable(options_, title, headers, M_.endo_names(ivar(stationary_vars)), 100*oo_.gamma_y{options_.ar+2}(stationary_vars,:), lh, 8, 2);
|
||||
if ME_present
|
||||
[stationary_observables,pos_index_subset]=intersect(index_subset,stationary_vars,'stable');
|
||||
headers_ME=char(headers,'ME');
|
||||
dyntable(options_,[title,' WITH MEASUREMENT ERROR'],headers_ME,deblank(M_.endo_names(ivar(stationary_observables), ...
|
||||
:)),oo_.variance_decomposition_ME(pos_index_subset,:),lh,8,2);
|
||||
[stationary_observables, pos_index_subset] = intersect(index_subset, stationary_vars, 'stable');
|
||||
headers_ME = vertcat(headers, 'ME');
|
||||
dyntable(options_, [title,' WITH MEASUREMENT ERROR'], headers_ME, M_.endo_names(ivar(stationary_observables)), ...
|
||||
oo_.variance_decomposition_ME(pos_index_subset,:), lh, 8, 2);
|
||||
end
|
||||
if options_.TeX
|
||||
headers=M_.exo_names_tex;
|
||||
headers = char(' ',headers);
|
||||
labels = deblank(M_.endo_names_tex(ivar(stationary_vars),:));
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title,'th_var_decomp_uncond',headers,labels,100*oo_.gamma_y{options_.ar+2}(stationary_vars,:),lh,8,2);
|
||||
headers = M_.exo_names_tex;
|
||||
headers = vertcat(' ', headers);
|
||||
labels = M_.endo_names_tex(ivar(stationary_vars));
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title, 'th_var_decomp_uncond', headers, labels, 100*oo_.gamma_y{options_.ar+2}(stationary_vars,:), lh, 8, 2);
|
||||
if ME_present
|
||||
headers_ME=char(headers,'ME');
|
||||
dyn_latex_table(M_,options_,[title,' WITH MEASUREMENT ERROR'],'th_var_decomp_uncond_ME',headers_ME,labels,oo_.variance_decomposition_ME(pos_index_subset,:),lh,8,2);
|
||||
headers_ME = vertcat(headers, 'ME');
|
||||
dyn_latex_table(M_, options_, [title,' WITH MEASUREMENT ERROR'], ...
|
||||
'th_var_decomp_uncond_ME', headers_ME, labels, oo_.variance_decomposition_ME(pos_index_subset,:), lh, 8, 2);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
conditional_variance_steps = options_.conditional_variance_decomposition;
|
||||
if length(conditional_variance_steps)
|
||||
StateSpaceModel.number_of_state_equations = M_.endo_nbr;
|
||||
StateSpaceModel.number_of_state_innovations = M_.exo_nbr;
|
||||
StateSpaceModel.sigma_e_is_diagonal = M_.sigma_e_is_diagonal;
|
||||
[StateSpaceModel.transition_matrix,StateSpaceModel.impulse_matrix] = kalman_transition_matrix(dr,(1:M_.endo_nbr)',M_.nstatic+(1:M_.nspred)',M_.exo_nbr);
|
||||
[StateSpaceModel.transition_matrix, StateSpaceModel.impulse_matrix] = ...
|
||||
kalman_transition_matrix(dr,(1:M_.endo_nbr)',M_.nstatic+(1:M_.nspred)',M_.exo_nbr);
|
||||
StateSpaceModel.state_innovations_covariance_matrix = M_.Sigma_e;
|
||||
StateSpaceModel.order_var = dr.order_var;
|
||||
StateSpaceModel.measurement_error=M_.H;
|
||||
StateSpaceModel.observable_pos=options_.varobs_id;
|
||||
[oo_.conditional_variance_decomposition, oo_.conditional_variance_decomposition_ME]= conditional_variance_decomposition(StateSpaceModel,conditional_variance_steps,ivar);
|
||||
|
||||
StateSpaceModel.measurement_error = M_.H;
|
||||
StateSpaceModel.observable_pos = options_.varobs_id;
|
||||
[oo_.conditional_variance_decomposition, oo_.conditional_variance_decomposition_ME] = ...
|
||||
conditional_variance_decomposition(StateSpaceModel, conditional_variance_steps, ivar);
|
||||
if options_.noprint == 0
|
||||
display_conditional_variance_decomposition(oo_.conditional_variance_decomposition,conditional_variance_steps,...
|
||||
ivar,M_,options_);
|
||||
display_conditional_variance_decomposition(oo_.conditional_variance_decomposition, conditional_variance_steps, ivar, M_, options_);
|
||||
if ME_present
|
||||
display_conditional_variance_decomposition(oo_.conditional_variance_decomposition_ME,conditional_variance_steps,...
|
||||
observable_pos_requested_vars,M_,options_);
|
||||
end
|
||||
display_conditional_variance_decomposition(oo_.conditional_variance_decomposition_ME, conditional_variance_steps, ...
|
||||
observable_pos_requested_vars, M_, options_);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -151,32 +150,33 @@ if length(i1) == 0
|
|||
return
|
||||
end
|
||||
|
||||
if options_.nocorr == 0 && size(stationary_vars, 1) > 0
|
||||
corr=NaN(size(oo_.gamma_y{1}));
|
||||
if options_.nocorr == 0 && size(stationary_vars, 1)>0
|
||||
corr = NaN(size(oo_.gamma_y{1}));
|
||||
corr(i1,i1) = oo_.gamma_y{1}(i1,i1)./(sd(i1)*sd(i1)');
|
||||
if options_.contemporaneous_correlation
|
||||
oo_.contemporaneous_correlation = corr;
|
||||
end
|
||||
if ~options_.noprint
|
||||
skipline()
|
||||
if options_.order == 2
|
||||
title='APPROXIMATED MATRIX OF CORRELATIONS';
|
||||
if options_.order==2
|
||||
title = 'APPROXIMATED MATRIX OF CORRELATIONS';
|
||||
else
|
||||
title='MATRIX OF CORRELATIONS';
|
||||
title = 'MATRIX OF CORRELATIONS';
|
||||
end
|
||||
title=add_filter_subtitle(title,options_);
|
||||
labels = deblank(M_.endo_names(ivar(i1),:));
|
||||
headers = char('Variables',labels);
|
||||
lh = size(labels,2)+2;
|
||||
dyntable(options_,title,headers,labels,corr(i1,i1),lh,8,4);
|
||||
title = add_filter_subtitle(title, options_);
|
||||
labels = M_.endo_names(ivar(i1));
|
||||
headers = vertcat('Variables', labels);
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyntable(options_, title, headers, labels, corr(i1,i1), lh, 8, 4);
|
||||
if options_.TeX
|
||||
labels = deblank(M_.endo_names_tex(ivar(i1),:));
|
||||
headers=char('Variables',labels);
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title,'th_corr_matrix',headers,labels,corr(i1,i1),lh,8,4);
|
||||
labels = M_.endo_names_tex(ivar(i1));
|
||||
headers = vertcat('Variables', labels);
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title, 'th_corr_matrix', headers, labels, corr(i1,i1), lh, 8, 4);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if options_.ar > 0 && size(stationary_vars, 1) > 0
|
||||
z=[];
|
||||
for i=1:options_.ar
|
||||
|
@ -186,20 +186,20 @@ if options_.ar > 0 && size(stationary_vars, 1) > 0
|
|||
if ~options_.noprint
|
||||
skipline()
|
||||
if options_.order == 2
|
||||
title='APPROXIMATED COEFFICIENTS OF AUTOCORRELATION';
|
||||
title = 'APPROXIMATED COEFFICIENTS OF AUTOCORRELATION';
|
||||
else
|
||||
title='COEFFICIENTS OF AUTOCORRELATION';
|
||||
title = 'COEFFICIENTS OF AUTOCORRELATION';
|
||||
end
|
||||
title=add_filter_subtitle(title,options_);
|
||||
labels = deblank(M_.endo_names(ivar(i1),:));
|
||||
headers = char('Order ',int2str([1:options_.ar]'));
|
||||
lh = size(labels,2)+2;
|
||||
dyntable(options_,title,headers,labels,z,lh,8,4);
|
||||
title = add_filter_subtitle(title, options_);
|
||||
labels = M_.endo_names(ivar(i1));
|
||||
headers = vertcat('Order ', cellstr(int2str([1:options_.ar]')));
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyntable(options_, title, headers, labels, z, lh, 8, 4);
|
||||
if options_.TeX
|
||||
labels = deblank(M_.endo_names_tex(ivar(i1),:));
|
||||
headers=char('Order ',int2str([1:options_.ar]'));
|
||||
lh = size(labels,2)+2;
|
||||
dyn_latex_table(M_,options_,title,'th_autocorr_matrix',headers,labels,z,lh,8,4);
|
||||
labels = M_.endo_names_tex(ivar(i1));
|
||||
headers = vertcat('Order ', cellstr(int2str([1:options_.ar]')));
|
||||
lh = cellofchararraymaxlength(labels)+2;
|
||||
dyn_latex_table(M_, options_, title, 'th_autocorr_matrix', headers, labels, z, lh, 8, 4);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ function display_conditional_variance_decomposition(conditional_decomposition_ar
|
|||
% OUTPUTS
|
||||
% none
|
||||
%
|
||||
% Copyright (C) 2010-2017 Dynare Team
|
||||
% Copyright (C) 2010-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -33,18 +33,19 @@ function display_conditional_variance_decomposition(conditional_decomposition_ar
|
|||
if size(conditional_decomposition_array,3)==M_.exo_nbr %no ME input
|
||||
shock_number=M_.exo_nbr;
|
||||
headers = M_.exo_names;
|
||||
headers(M_.exo_names_orig_ord,:) = headers;
|
||||
headers(M_.exo_names_orig_ord) = headers;
|
||||
if options_.TeX
|
||||
headers_TeX=char('',deblank(M_.exo_names_tex));
|
||||
headers_TeX = vertcat(' ', M_.exo_names_tex);
|
||||
end
|
||||
title_addon='';
|
||||
elseif size(conditional_decomposition_array,3)==M_.exo_nbr+1 %ME input
|
||||
shock_number=M_.exo_nbr+1;
|
||||
headers = M_.exo_names;
|
||||
headers(M_.exo_names_orig_ord,:) = headers;
|
||||
headers=char(headers,'ME');
|
||||
headers(M_.exo_names_orig_ord) = headers;
|
||||
headers = vertcat(headers, 'ME');
|
||||
if options_.TeX
|
||||
headers_TeX=char('',deblank(strvcat(M_.exo_names_tex,'ME')));
|
||||
headers_TeX = vertcat(M_.exo_names_tex, 'ME');
|
||||
headers_TeX = vertcat(' ', headers_TeX);
|
||||
end
|
||||
title_addon=' - WITH MEASUREMENT ERROR';
|
||||
else
|
||||
|
@ -61,25 +62,22 @@ else
|
|||
disp(title)
|
||||
end
|
||||
|
||||
headers = char(' ',headers);
|
||||
lh = size(deblank(M_.endo_names(SubsetOfVariables,:)),2)+2;
|
||||
headers = vertcat(' ', headers);
|
||||
lh = cellofchararraymaxlength(M_.endo_names(SubsetOfVariables))+2;
|
||||
if options_.TeX
|
||||
labels_TeX = deblank(M_.endo_names_tex(SubsetOfVariables,:));
|
||||
lh = size(labels_TeX,2)+2;
|
||||
labels_TeX = M_.endo_names_tex(SubsetOfVariables);
|
||||
lh = cellofchararraymaxlength(labels_TeX)+2;
|
||||
end
|
||||
|
||||
vardec_i = zeros(length(SubsetOfVariables),shock_number);
|
||||
vardec_i = zeros(length(SubsetOfVariables), shock_number);
|
||||
|
||||
for i=1:length(Steps)
|
||||
disp(['Period ' int2str(Steps(i)) ':'])
|
||||
for j=1:shock_number
|
||||
vardec_i(:,j) = 100*conditional_decomposition_array(:, ...
|
||||
i,j);
|
||||
vardec_i(:,j) = 100*conditional_decomposition_array(:,i,j);
|
||||
end
|
||||
dyntable(options_,'',headers,...
|
||||
deblank(M_.endo_names(SubsetOfVariables,:)),...
|
||||
vardec_i,lh,8,2);
|
||||
dyntable(options_, '', headers, M_.endo_names(SubsetOfVariables), vardec_i, lh, 8, 2);
|
||||
if options_.TeX
|
||||
dyn_latex_table(M_,options_,[title,'; Period ' int2str(Steps(i))],['th_var_decomp_cond_h',int2str(Steps(i))],headers_TeX,labels_TeX,vardec_i,lh,8,2);
|
||||
dyn_latex_table(M_, options_, [title, '; Period ' int2str(Steps(i))], ['th_var_decomp_cond_h', int2str(Steps(i))], headers_TeX, labels_TeX, vardec_i, lh, 8, 2);
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@ function oo_=display_estimation_results_table(xparam1,stdh,M_,options_,estim_par
|
|||
% o options_ Matlab's structure describing the options (initialized by dynare, see @ref{options_}).
|
||||
% o bayestopt_ Matlab's structure describing the priors (initialized by dynare, see @ref{bayesopt_}).
|
||||
% o oo_ Matlab's structure gathering the results (initialized by dynare, see @ref{oo_}).
|
||||
% o pnames [string] Character Array storing the names for prior distributions
|
||||
% o pnames [string] Cell of strings storing the names for prior distributions
|
||||
% o table_title [string] Title of the Table
|
||||
% o field_name [string] String storing the name of the fields for oo_ where the parameters are stored
|
||||
%
|
||||
|
@ -20,7 +20,7 @@ function oo_=display_estimation_results_table(xparam1,stdh,M_,options_,estim_par
|
|||
% SPECIAL REQUIREMENTS
|
||||
% None.
|
||||
|
||||
% Copyright (C) 2014-2017 Dynare Team
|
||||
% Copyright (C) 2014-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -49,12 +49,12 @@ disp(['RESULTS FROM ' upper(table_title) ' ESTIMATION'])
|
|||
LaTeXtitle=strrep(table_title,' ','_');
|
||||
tstath = abs(xparam1)./stdh;
|
||||
|
||||
header_width = row_header_width(M_,estim_params_,bayestopt_);
|
||||
header_width = row_header_width(M_, estim_params_, bayestopt_);
|
||||
if strcmp(field_name,'posterior')
|
||||
tit1 = sprintf('%-*s %7s %8s %7s %4s %6s\n',header_width-2,' ','prior mean', ...
|
||||
'mode','s.d.','prior','pstdev');
|
||||
tit1 = sprintf('%-*s %7s %8s %7s %4s %6s\n', header_width-2, ' ', 'prior mean', ...
|
||||
'mode', 's.d.', 'prior', 'pstdev');
|
||||
else
|
||||
tit1 = sprintf('%-*s %10s %7s %6s\n',header_width-2,' ','Estimate','s.d.','t-stat');
|
||||
tit1 = sprintf('%-*s %10s %7s %6s\n', header_width-2, ' ', 'Estimate', 's.d.', 't-stat');
|
||||
end
|
||||
if np
|
||||
ip = nvx+nvn+ncx+ncn+1;
|
||||
|
@ -66,11 +66,11 @@ if np
|
|||
fprintf('%-*s %7.3f %8.4f %7.4f %4s %6.4f \n', ...
|
||||
header_width,name, ...
|
||||
bayestopt_.p1(ip),xparam1(ip),stdh(ip), ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:), ...
|
||||
pnames{bayestopt_.pshape(ip)+1}, ...
|
||||
bayestopt_.p2(ip));
|
||||
else
|
||||
fprintf('%-*s %8.4f %7.4f %7.4f \n', ...
|
||||
header_width,name,xparam1(ip),stdh(ip),tstath(ip));
|
||||
header_width, name, xparam1(ip), stdh(ip), tstath(ip));
|
||||
end
|
||||
eval(['oo_.' field_name '_mode.parameters.' name ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.parameters.' name ' = stdh(ip);']);
|
||||
|
@ -84,14 +84,14 @@ if nvx
|
|||
disp(tit1)
|
||||
for i=1:nvx
|
||||
k = estim_params_.var_exo(i,1);
|
||||
name = deblank(M_.exo_names(k,:));
|
||||
name = M_.exo_names{k};
|
||||
if strcmp(field_name,'posterior')
|
||||
fprintf('%-*s %7.3f %8.4f %7.4f %4s %6.4f \n', ...
|
||||
header_width,name,bayestopt_.p1(ip),xparam1(ip), ...
|
||||
stdh(ip),pnames(bayestopt_.pshape(ip)+1,:), ...
|
||||
header_width, name, bayestopt_.p1(ip), xparam1(ip), ...
|
||||
stdh(ip), pnames{bayestopt_.pshape(ip)+1}, ...
|
||||
bayestopt_.p2(ip));
|
||||
else
|
||||
fprintf('%-*s %8.4f %7.4f %7.4f \n',header_width,name,xparam1(ip),stdh(ip),tstath(ip));
|
||||
fprintf('%-*s %8.4f %7.4f %7.4f \n', header_width, name, xparam1(ip), stdh(ip), tstath(ip));
|
||||
end
|
||||
M_.Sigma_e(k,k) = xparam1(ip)*xparam1(ip);
|
||||
eval(['oo_.' field_name '_mode.shocks_std.' name ' = xparam1(ip);']);
|
||||
|
@ -108,12 +108,13 @@ if nvn
|
|||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i,1)};
|
||||
if strcmp(field_name,'posterior')
|
||||
fprintf('%-*s %7.3f %8.4f %7.4f %4s %6.4f \n', ...
|
||||
header_width,name,bayestopt_.p1(ip), ...
|
||||
xparam1(ip),stdh(ip), ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:), ...
|
||||
header_width, name, bayestopt_.p1(ip), ...
|
||||
xparam1(ip), stdh(ip), ...
|
||||
pnames{bayestopt_.pshape(ip)+1}, ...
|
||||
bayestopt_.p2(ip));
|
||||
else
|
||||
fprintf('%-*s %8.4f %7.4f %7.4f \n',header_width,name,xparam1(ip),stdh(ip),tstath(ip))
|
||||
fprintf('%-*s %8.4f %7.4f %7.4f \n', header_width, name, xparam1(ip), ...
|
||||
stdh(ip), tstath(ip))
|
||||
end
|
||||
eval(['oo_.' field_name '_mode.measurement_errors_std.' name ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.measurement_errors_std.' name ' = stdh(ip);']);
|
||||
|
@ -129,14 +130,15 @@ if ncx
|
|||
for i=1:ncx
|
||||
k1 = estim_params_.corrx(i,1);
|
||||
k2 = estim_params_.corrx(i,2);
|
||||
name = [deblank(M_.exo_names(k1,:)) ',' deblank(M_.exo_names(k2,:))];
|
||||
NAME = [deblank(M_.exo_names(k1,:)) '_' deblank(M_.exo_names(k2,:))];
|
||||
if strcmp(field_name,'posterior')
|
||||
name = sprintf('%s,%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
NAME = sprintf('%s_%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
if strcmp(field_name, 'posterior')
|
||||
fprintf('%-*s %7.3f %8.4f %7.4f %4s %6.4f \n', ...
|
||||
header_width,name,bayestopt_.p1(ip),xparam1(ip),stdh(ip), ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:), bayestopt_.p2(ip));
|
||||
header_width, name, bayestopt_.p1(ip), xparam1(ip), stdh(ip), ...
|
||||
pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p2(ip));
|
||||
else
|
||||
fprintf('%-*s %8.4f %7.4f %7.4f \n', header_width,name,xparam1(ip),stdh(ip),tstath(ip));
|
||||
fprintf('%-*s %8.4f %7.4f %7.4f \n', header_width,name, xparam1(ip), ...
|
||||
stdh(ip), tstath(ip));
|
||||
end
|
||||
M_.Sigma_e(k1,k2) = xparam1(ip)*sqrt(M_.Sigma_e(k1,k1)*M_.Sigma_e(k2,k2));
|
||||
M_.Sigma_e(k2,k1) = M_.Sigma_e(k1,k2);
|
||||
|
@ -154,14 +156,15 @@ if ncn
|
|||
for i=1:ncn
|
||||
k1 = estim_params_.corrn(i,1);
|
||||
k2 = estim_params_.corrn(i,2);
|
||||
name = [deblank(M_.endo_names(k1,:)) ',' deblank(M_.endo_names(k2,:))];
|
||||
NAME = [deblank(M_.endo_names(k1,:)) '_' deblank(M_.endo_names(k2,:))];
|
||||
name = sprintf('%s,%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
NAME = sprintf('%s_%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
if strcmp(field_name,'posterior')
|
||||
fprintf('%-*s %7.3f %8.4f %7.4f %4s %6.4f \n', ...
|
||||
header_width,name,bayestopt_.p1(ip),xparam1(ip),stdh(ip), ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:), bayestopt_.p2(ip));
|
||||
header_width, name, bayestopt_.p1(ip), xparam1(ip), stdh(ip), ...
|
||||
pnames{bayestopt_.pshape(ip)+1}, bayestopt_.p2(ip));
|
||||
else
|
||||
fprintf('%-*s %8.4f %7.4f %7.4f \n',header_width,name,xparam1(ip),stdh(ip),tstath(ip));
|
||||
fprintf('%-*s %8.4f %7.4f %7.4f \n',header_width, name, xparam1(ip), ...
|
||||
stdh(ip), tstath(ip));
|
||||
end
|
||||
eval(['oo_.' field_name '_mode.measurement_errors_corr.' NAME ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.measurement_errors_corr.' NAME ' = stdh(ip);']);
|
||||
|
@ -169,6 +172,7 @@ if ncn
|
|||
end
|
||||
skipline()
|
||||
end
|
||||
|
||||
if any(xparam1(1:nvx+nvn)<0)
|
||||
warning('Some estimated standard deviations are negative. Dynare internally works with variances so that the sign does not matter. Nevertheless, it is recommended to impose either prior restrictions (Bayesian Estimation) or a lower bound (ML) to assure positive values.')
|
||||
end
|
||||
|
@ -183,11 +187,11 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
ip = nvx+nvn+ncx+ncn+1;
|
||||
for i=1:np
|
||||
fprintf(fidTeX,'$%s$ & %s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n',...
|
||||
M_.param_names_tex(estim_params_.param_vals(i,1),:),...
|
||||
deblank(pnames(bayestopt_.pshape(ip)+1,:)),...
|
||||
bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),...
|
||||
xparam1(ip),...
|
||||
M_.param_names_tex{estim_params_.param_vals(i,1)}, ...
|
||||
pnames{bayestopt_.pshape(ip)+1}, ...
|
||||
bayestopt_.p1(ip), ...
|
||||
bayestopt_.p2(ip), ...
|
||||
xparam1(ip), ...
|
||||
stdh(ip));
|
||||
ip = ip + 1;
|
||||
end
|
||||
|
@ -201,8 +205,8 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
for i=1:nvx
|
||||
k = estim_params_.var_exo(i,1);
|
||||
fprintf(fidTeX,[ '$%s$ & %4s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n'],...
|
||||
deblank(M_.exo_names_tex(k,:)),...
|
||||
deblank(pnames(bayestopt_.pshape(ip)+1,:)),...
|
||||
M_.exo_names_tex{k},...
|
||||
pnames{bayestopt_.pshape(ip)+1},...
|
||||
bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),...
|
||||
xparam1(ip), ...
|
||||
|
@ -217,10 +221,10 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
TeXBegin_Bayesian(fidTeX,3,'standard deviation of measurement errors')
|
||||
ip = nvx+1;
|
||||
for i=1:nvn
|
||||
idx = strmatch(options_.varobs{estim_params_.nvn_observable_correspondence(i,1)},M_.endo_names);
|
||||
idx = strmatch(options_.varobs{estim_params_.nvn_observable_correspondence(i,1)}, M_.endo_names);
|
||||
fprintf(fidTeX,'$%s$ & %4s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n',...
|
||||
deblank(M_.endo_names_tex(idx,:)), ...
|
||||
deblank(pnames(bayestopt_.pshape(ip)+1,:)), ...
|
||||
M_.endo_names_tex{idx}, ...
|
||||
pnames{bayestopt_.pshape(ip)+1}, ...
|
||||
bayestopt_.p1(ip), ...
|
||||
bayestopt_.p2(ip),...
|
||||
xparam1(ip),...
|
||||
|
@ -238,8 +242,8 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
k1 = estim_params_.corrx(i,1);
|
||||
k2 = estim_params_.corrx(i,2);
|
||||
fprintf(fidTeX,[ '$%s$ & %s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n'],...
|
||||
[deblank(M_.exo_names_tex(k1,:)) ',' deblank(M_.exo_names_tex(k2,:))], ...
|
||||
deblank(pnames(bayestopt_.pshape(ip)+1,:)), ...
|
||||
[M_.exo_names_tex{k1} ',' M_.exo_names_tex{k2}], ...
|
||||
pnames{bayestopt_.pshape(ip)+1}, ...
|
||||
bayestopt_.p1(ip), ...
|
||||
bayestopt_.p2(ip), ...
|
||||
xparam1(ip), ...
|
||||
|
@ -257,8 +261,8 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
k1 = estim_params_.corrn(i,1);
|
||||
k2 = estim_params_.corrn(i,2);
|
||||
fprintf(fidTeX,'$%s$ & %s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n',...
|
||||
[deblank(M_.endo_names_tex(k1,:)) ',' deblank(M_.endo_names_tex(k2,:))], ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:), ...
|
||||
[ M_.endo_names_tex{k1} ',' M_.endo_names_tex{k2}], ...
|
||||
pnames{bayestopt_.pshape(ip)+1}, ...
|
||||
bayestopt_.p1(ip), ...
|
||||
bayestopt_.p2(ip), ...
|
||||
xparam1(ip), ...
|
||||
|
@ -270,14 +274,14 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
elseif all(bayestopt_.pshape == 0) && options_.TeX %% MLE and GMM Latex output
|
||||
if np
|
||||
filename = [OutputDirectoryName '/' M_.fname '_' LaTeXtitle '_Mode_1.tex'];
|
||||
fidTeX = fopen(filename,'w');
|
||||
TeXBegin_ML(fidTeX,1,'parameters',table_title,LaTeXtitle)
|
||||
fidTeX = fopen(filename, 'w');
|
||||
TeXBegin_ML(fidTeX, 1, 'parameters', table_title, LaTeXtitle)
|
||||
ip = nvx+nvn+ncx+ncn+1;
|
||||
for i=1:np
|
||||
fprintf(fidTeX,'$%s$ & %8.4f & %7.4f & %7.4f\\\\ \n',...
|
||||
M_.param_names_tex(estim_params_.param_vals(i,1),:),...
|
||||
xparam1(ip),...
|
||||
stdh(ip),...
|
||||
M_.param_names_tex{estim_params_.param_vals(i,1)}, ...
|
||||
xparam1(ip), ...
|
||||
stdh(ip), ...
|
||||
tstath(ip));
|
||||
ip = ip + 1;
|
||||
end
|
||||
|
@ -285,15 +289,15 @@ elseif all(bayestopt_.pshape == 0) && options_.TeX %% MLE and GMM Latex output
|
|||
end
|
||||
if nvx
|
||||
filename = [OutputDirectoryName '/' M_.fname '_' LaTeXtitle '_Mode_2.tex'];
|
||||
fidTeX = fopen(filename,'w');
|
||||
TeXBegin_ML(fidTeX,2,'standard deviation of structural shocks',table_title,LaTeXtitle)
|
||||
fidTeX = fopen(filename, 'w');
|
||||
TeXBegin_ML(fidTeX, 2, 'standard deviation of structural shocks', table_title, LaTeXtitle)
|
||||
ip = 1;
|
||||
for i=1:nvx
|
||||
k = estim_params_.var_exo(i,1);
|
||||
fprintf(fidTeX,[ '$%s$ & %8.4f & %7.4f & %7.4f\\\\ \n'],...
|
||||
deblank(M_.exo_names_tex(k,:)),...
|
||||
fprintf(fidTeX,[ '$%s$ & %8.4f & %7.4f & %7.4f\\\\ \n'], ...
|
||||
M_.exo_names_tex{k}, ...
|
||||
xparam1(ip), ...
|
||||
stdh(ip),...
|
||||
stdh(ip), ...
|
||||
tstath(ip));
|
||||
ip = ip+1;
|
||||
end
|
||||
|
@ -301,15 +305,15 @@ elseif all(bayestopt_.pshape == 0) && options_.TeX %% MLE and GMM Latex output
|
|||
end
|
||||
if nvn
|
||||
filename = [OutputDirectoryName '/' M_.fname '_' LaTeXtitle '_Mode_3.tex'];
|
||||
fidTeX = fopen(filename,'w');
|
||||
TeXBegin_ML(fidTeX,3,'standard deviation of measurement errors',table_title,LaTeXtitle)
|
||||
fidTeX = fopen(filename, 'w');
|
||||
TeXBegin_ML(fidTeX, 3, 'standard deviation of measurement errors', table_title, LaTeXtitle)
|
||||
ip = nvx+1;
|
||||
for i=1:nvn
|
||||
idx = strmatch(options_.varobs{estim_params_.nvn_observable_correspondence(i,1)},M_.endo_names);
|
||||
fprintf(fidTeX,'$%s$ & %8.4f & %7.4f & %7.4f \\\\ \n',...
|
||||
deblank(M_.endo_names_tex(idx,:)), ...
|
||||
xparam1(ip),...
|
||||
stdh(ip),...
|
||||
idx = strmatch(options_.varobs{estim_params_.nvn_observable_correspondence(i,1)}, M_.endo_names);
|
||||
fprintf(fidTeX, '$%s$ & %8.4f & %7.4f & %7.4f \\\\ \n', ...
|
||||
M_.endo_names_tex{idx}, ...
|
||||
xparam1(ip), ...
|
||||
stdh(ip), ...
|
||||
tstath(ip));
|
||||
ip = ip+1;
|
||||
end
|
||||
|
@ -317,16 +321,16 @@ elseif all(bayestopt_.pshape == 0) && options_.TeX %% MLE and GMM Latex output
|
|||
end
|
||||
if ncx
|
||||
filename = [OutputDirectoryName '/' M_.fname '_' LaTeXtitle '_Mode_4.tex'];
|
||||
fidTeX = fopen(filename,'w');
|
||||
TeXBegin_ML(fidTeX,4,'correlation of structural shocks',table_title,LaTeXtitle)
|
||||
fidTeX = fopen(filename, 'w');
|
||||
TeXBegin_ML(fidTeX, 4, 'correlation of structural shocks', table_title,LaTeXtitle)
|
||||
ip = nvx+nvn+1;
|
||||
for i=1:ncx
|
||||
k1 = estim_params_.corrx(i,1);
|
||||
k2 = estim_params_.corrx(i,2);
|
||||
fprintf(fidTeX,[ '$%s$ & %8.4f & %7.4f & %7.4f \\\\ \n'],...
|
||||
[deblank(M_.exo_names_tex(k1,:)) ',' deblank(M_.exo_names_tex(k2,:))], ...
|
||||
fprintf(fidTeX,[ '$%s$ & %8.4f & %7.4f & %7.4f \\\\ \n'], ...
|
||||
[M_.exo_names_tex{k1} ',' M_.exo_names_tex{k2}], ...
|
||||
xparam1(ip), ...
|
||||
stdh(ip),...
|
||||
stdh(ip), ...
|
||||
tstath(ip));
|
||||
ip = ip+1;
|
||||
end
|
||||
|
@ -334,16 +338,16 @@ elseif all(bayestopt_.pshape == 0) && options_.TeX %% MLE and GMM Latex output
|
|||
end
|
||||
if ncn
|
||||
filename = [OutputDirectoryName '/' M_.fname '_' LaTeXtitle '_Mode_5.tex'];
|
||||
fidTeX = fopen(filename,'w');
|
||||
TeXBegin_ML(fidTeX,5,'correlation of measurement errors',table_title,LaTeXtitle)
|
||||
fidTeX = fopen(filename, 'w');
|
||||
TeXBegin_ML(fidTeX, 5, 'correlation of measurement errors', table_title, LaTeXtitle)
|
||||
ip = nvx+nvn+ncx+1;
|
||||
for i=1:ncn
|
||||
k1 = estim_params_.corrn(i,1);
|
||||
k2 = estim_params_.corrn(i,2);
|
||||
fprintf(fidTeX,'$%s$ & %8.4f & %7.4f & %7.4f \\\\ \n',...
|
||||
[deblank(M_.endo_names_tex(k1,:)) ',' deblank(M_.endo_names_tex(k2,:))], ...
|
||||
fprintf(fidTeX, '$%s$ & %8.4f & %7.4f & %7.4f \\\\ \n', ...
|
||||
[ M_.endo_names_tex{k1} ',' M_.endo_names_tex{k2}], ...
|
||||
xparam1(ip), ...
|
||||
stdh(ip),...
|
||||
stdh(ip), ...
|
||||
tstath(ip));
|
||||
ip = ip+1;
|
||||
end
|
||||
|
@ -355,7 +359,7 @@ end
|
|||
|
||||
%% subfunctions:
|
||||
%
|
||||
function TeXBegin_Bayesian(fid,fnum,title)
|
||||
function TeXBegin_Bayesian(fid, fnum, title)
|
||||
fprintf(fid,'%% TeX-table generated by dynare_estimation (Dynare).\n');
|
||||
fprintf(fid,['%% RESULTS FROM POSTERIOR MAXIMIZATION (' title ')\n']);
|
||||
fprintf(fid,['%% ' datestr(now,0)]);
|
||||
|
@ -379,7 +383,7 @@ fprintf(fid,'\\midrule \\endhead \n');
|
|||
fprintf(fid,'\\bottomrule \\multicolumn{6}{r}{(Continued on next page)}\\endfoot \n');
|
||||
fprintf(fid,'\\bottomrule\\endlastfoot \n');
|
||||
|
||||
function TeXBegin_ML(fid,fnum,title,table_title,LaTeXtitle)
|
||||
function TeXBegin_ML(fid, fnum, title, table_title, LaTeXtitle)
|
||||
fprintf(fid,'%% TeX-table generated by dynare_estimation (Dynare).\n');
|
||||
fprintf(fid,['%% RESULTS FROM ' table_title ' MAXIMIZATION (' title ')\n']);
|
||||
fprintf(fid,['%% ' datestr(now,0)]);
|
||||
|
|
|
@ -16,7 +16,7 @@ function []=display_problematic_vars_Jacobian(problemrow,problemcol,M_,x,type,ca
|
|||
% none.
|
||||
%
|
||||
|
||||
% Copyright (C) 2014-2017 Dynare Team
|
||||
% Copyright (C) 2014-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -55,84 +55,98 @@ if strcmp(type,'dynamic')
|
|||
end
|
||||
if problemcol(ii)<=max(max(M_.lead_lag_incidence)) && var_index<=M_.orig_endo_nbr
|
||||
if problemrow(ii)<=aux_eq_nbr
|
||||
eq_nbr=problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to %s Variable %s (initial value of %s: %g) \n',eq_nbr,type_string,deblank(M_.endo_names(var_index,:)),deblank(M_.endo_names(var_index,:)),x(var_index))
|
||||
eq_nbr = problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to %s Variable %s (initial value of %s: %g) \n', ...
|
||||
eq_nbr, type_string, M_.endo_names{var_index}, M_.endo_names{var_index}, x(var_index));
|
||||
else
|
||||
eq_nbr=problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to %s Variable %s (initial value of %s: %g) \n',eq_nbr,type_string,deblank(M_.endo_names(var_index,:)),deblank(M_.endo_names(var_index,:)),x(var_index))
|
||||
eq_nbr = problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to %s Variable %s (initial value of %s: %g) \n', ...
|
||||
eq_nbr, type_string, M_.endo_names{var_index}, M_.endo_names{var_index}, x(var_index));
|
||||
end
|
||||
elseif problemcol(ii)<=max(max(M_.lead_lag_incidence)) && var_index>M_.orig_endo_nbr %auxiliary vars
|
||||
if M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).type ==6 %Ramsey Lagrange Multiplier
|
||||
if problemrow(ii)<=aux_eq_nbr
|
||||
eq_nbr=problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to %s of Langrange multiplier of equation %s (initial value: %g) \n',eq_nbr,type_string,M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).eq_nbr,x(problemcol(ii)))
|
||||
elseif problemcol(ii)<=max(max(M_.lead_lag_incidence)) && var_index>M_.orig_endo_nbr % auxiliary vars
|
||||
if M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).type==6 %Ramsey Lagrange Multiplier
|
||||
if problemrow(ii)<=aux_eq_nbr
|
||||
eq_nbr = problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to %s of Langrange multiplier of equation %s (initial value: %g) \n', ...
|
||||
eq_nbr, type_string, M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).eq_nbr, x(problemcol(ii)));
|
||||
else
|
||||
eq_nbr = problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to %s of Langrange multiplier of equation %s (initial value: %g) \n', ...
|
||||
eq_nbr, type_string, M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).eq_nbr, x(problemcol(ii)));
|
||||
end
|
||||
else
|
||||
eq_nbr=problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to %s of Langrange multiplier of equation %s (initial value: %g) \n',eq_nbr,type_string,M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).eq_nbr,x(problemcol(ii)))
|
||||
if problemrow(ii)<=aux_eq_nbr
|
||||
eq_nbr = problemrow(ii);
|
||||
orig_var_index = M_.aux_vars(1,var_index-M_.orig_endo_nbr).orig_index;
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to %s Variable %s (initial value of %s: %g) \n', ...
|
||||
eq_nbr, type_string, M_.endo_names{orig_var_index}, M_.endo_names{orig_var_index}, x(orig_var_index));
|
||||
else
|
||||
eq_nbr = problemrow(ii)-aux_eq_nbr;
|
||||
orig_var_index = M_.aux_vars(1,var_index-M_.orig_endo_nbr).orig_index;
|
||||
fprintf('Derivative of Equation %d with respect to %s Variable %s (initial value of %s: %g) \n', ...
|
||||
eq_nbr, type_string, M_.endo_names{orig_var_index}, M_.endo_names{orig_var_index}, x(orig_var_index));
|
||||
end
|
||||
end
|
||||
else
|
||||
if problemrow(ii)<=aux_eq_nbr
|
||||
eq_nbr=problemrow(ii);
|
||||
orig_var_index=M_.aux_vars(1,var_index-M_.orig_endo_nbr).orig_index;
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to %s Variable %s (initial value of %s: %g) \n',eq_nbr,type_string,deblank(M_.endo_names(orig_var_index,:)),deblank(M_.endo_names(orig_var_index,:)),x(orig_var_index))
|
||||
else
|
||||
eq_nbr=problemrow(ii)-aux_eq_nbr;
|
||||
orig_var_index=M_.aux_vars(1,var_index-M_.orig_endo_nbr).orig_index;
|
||||
fprintf('Derivative of Equation %d with respect to %s Variable %s (initial value of %s: %g) \n',eq_nbr,type_string,deblank(M_.endo_names(orig_var_index,:)),deblank(M_.endo_names(orig_var_index,:)),x(orig_var_index))
|
||||
end
|
||||
end
|
||||
elseif problemcol(ii)>max(max(M_.lead_lag_incidence)) && var_index<=M_.exo_nbr
|
||||
if problemrow(ii)<=aux_eq_nbr
|
||||
eq_nbr=problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to %s shock %s \n',eq_nbr,type_string,deblank(M_.exo_names(var_index,:)));
|
||||
eq_nbr = problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to %s shock %s \n', ...
|
||||
eq_nbr, type_string, M_.exo_names{var_index});
|
||||
else
|
||||
eq_nbr=problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to %s shock %s \n',eq_nbr,type_string,deblank(M_.exo_names(var_index,:)));
|
||||
eq_nbr = problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to %s shock %s \n', ...
|
||||
eq_nbr, type_string, M_.exo_names{var_index});
|
||||
end
|
||||
else
|
||||
error('display_problematic_vars_Jacobian:: The error should not happen. Please contact the developers')
|
||||
end
|
||||
end
|
||||
fprintf('\n%s The problem most often occurs, because a variable with\n',caller_string)
|
||||
fprintf('%s exponent smaller than 1 has been initialized to 0. Taking the derivative\n',caller_string)
|
||||
fprintf('%s and evaluating it at the steady state then results in a division by 0.\n',caller_string)
|
||||
fprintf('%s If you are using model-local variables (# operator), check their values as well.\n',caller_string)
|
||||
elseif strcmp(type,'static')
|
||||
fprintf('\n%s The problem most often occurs, because a variable with\n', caller_string)
|
||||
fprintf('%s exponent smaller than 1 has been initialized to 0. Taking the derivative\n', caller_string)
|
||||
fprintf('%s and evaluating it at the steady state then results in a division by 0.\n', caller_string)
|
||||
fprintf('%s If you are using model-local variables (# operator), check their values as well.\n', caller_string)
|
||||
elseif strcmp(type, 'static')
|
||||
for ii=1:length(problemrow)
|
||||
if problemcol(ii)<=M_.orig_endo_nbr
|
||||
if problemrow(ii)<=aux_eq_nbr
|
||||
eq_nbr=problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to Variable %s (initial value of %s: %g) \n',eq_nbr,deblank(M_.endo_names(problemcol(ii),:)),deblank(M_.endo_names(problemcol(ii),:)),x(problemcol(ii)))
|
||||
eq_nbr = problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to Variable %s (initial value of %s: %g) \n', ...
|
||||
eq_nbr, M_.endo_names{problemcol(ii)}, M_.endo_names{problemcol(ii)}, x(problemcol(ii)));
|
||||
else
|
||||
eq_nbr=problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to Variable %s (initial value of %s: %g) \n',eq_nbr,deblank(M_.endo_names(problemcol(ii),:)),deblank(M_.endo_names(problemcol(ii),:)),x(problemcol(ii)))
|
||||
eq_nbr = problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to Variable %s (initial value of %s: %g) \n', ...
|
||||
eq_nbr, M_.endo_names{problemcol(ii)}, M_.endo_names{problemcol(ii)}, x(problemcol(ii)));
|
||||
end
|
||||
else %auxiliary vars
|
||||
if M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).type ==6 %Ramsey Lagrange Multiplier
|
||||
if problemrow(ii)<=aux_eq_nbr
|
||||
eq_nbr=problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to Lagrange multiplier of equation %d (initial value: %g) \n',eq_nbr,M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).eq_nbr,x(problemcol(ii)))
|
||||
eq_nbr = problemrow(ii);
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to Lagrange multiplier of equation %d (initial value: %g) \n', ...
|
||||
eq_nbr, M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).eq_nbr, x(problemcol(ii)));
|
||||
else
|
||||
eq_nbr=problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to Lagrange multiplier of equation %d (initial value: %g) \n',eq_nbr,M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).eq_nbr,x(problemcol(ii)))
|
||||
eq_nbr = problemrow(ii)-aux_eq_nbr;
|
||||
fprintf('Derivative of Equation %d with respect to Lagrange multiplier of equation %d (initial value: %g) \n', ...
|
||||
eq_nbr, M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).eq_nbr, x(problemcol(ii)));
|
||||
end
|
||||
else
|
||||
if problemrow(ii)<=aux_eq_nbr
|
||||
eq_nbr=problemrow(ii);
|
||||
orig_var_index=M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).orig_index;
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to Variable %s (initial value of %s: %g) \n',eq_nbr,deblank(M_.endo_names(orig_var_index,:)),deblank(M_.endo_names(orig_var_index,:)),x(problemcol(ii)))
|
||||
eq_nbr = problemrow(ii);
|
||||
orig_var_index = M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).orig_index;
|
||||
fprintf('Derivative of Auxiliary Equation %d with respect to Variable %s (initial value of %s: %g) \n', ...
|
||||
eq_nbr, M_.endo_names{orig_var_index}, M_.endo_names{orig_var_index}, x(problemcol(ii)));
|
||||
else
|
||||
eq_nbr=problemrow(ii)-aux_eq_nbr;
|
||||
orig_var_index=M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).orig_index;
|
||||
fprintf('Derivative of Equation %d with respect to Variable %s (initial value of %s: %g) \n',eq_nbr,deblank(M_.endo_names(orig_var_index,:)),deblank(M_.endo_names(orig_var_index,:)),x(problemcol(ii)))
|
||||
eq_nbr = problemrow(ii)-aux_eq_nbr;
|
||||
orig_var_index = M_.aux_vars(1,problemcol(ii)-M_.orig_endo_nbr).orig_index;
|
||||
fprintf('Derivative of Equation %d with respect to Variable %s (initial value of %s: %g) \n', ...
|
||||
eq_nbr, M_.endo_names{orig_var_index}, M_.endo_names{orig_var_index}, x(problemcol(ii)));
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
fprintf('\n%s The problem most often occurs, because a variable with\n',caller_string)
|
||||
fprintf('%s exponent smaller than 1 has been initialized to 0. Taking the derivative\n',caller_string)
|
||||
fprintf('%s and evaluating it at the steady state then results in a division by 0.\n',caller_string)
|
||||
fprintf('%s If you are using model-local variables (# operator), check their values as well.\n',caller_string)
|
||||
fprintf('\n%s The problem most often occurs, because a variable with\n', caller_string)
|
||||
fprintf('%s exponent smaller than 1 has been initialized to 0. Taking the derivative\n', caller_string)
|
||||
fprintf('%s and evaluating it at the steady state then results in a division by 0.\n', caller_string)
|
||||
fprintf('%s If you are using model-local variables (# operator), check their values as well.\n', caller_string)
|
||||
else
|
||||
error('Unknown Type')
|
||||
end
|
|
@ -37,7 +37,7 @@ function [fval,info,exit_flag,grad,hess,SteadyState,trend_coeff,PHI_tilde,SIGMA_
|
|||
% SPECIAL REQUIREMENTS
|
||||
% None.
|
||||
|
||||
% Copyright (C) 2006-2017 Dynare Team
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -73,7 +73,7 @@ xparam1 = xparam1(:);
|
|||
|
||||
% Initialization of of the index for parameter dsge_prior_weight in Model.params.
|
||||
if isempty(dsge_prior_weight_idx)
|
||||
dsge_prior_weight_idx = strmatch('dsge_prior_weight',Model.param_names);
|
||||
dsge_prior_weight_idx = strmatch('dsge_prior_weight', Model.param_names);
|
||||
end
|
||||
|
||||
% Get the number of estimated (dsge) parameters.
|
||||
|
|
|
@ -14,7 +14,7 @@ function [z,zss]=dyn2vec(s1,s2)
|
|||
% none
|
||||
%
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -46,15 +46,15 @@ if nargin == 0
|
|||
error(t);
|
||||
end
|
||||
for i=1:size(oo_.endo_simul,1)
|
||||
assignin('base',deblank(M_.endo_names(i,:)),oo_.endo_simul(i,k)');
|
||||
assignin('base', M_.endo_names{i}, oo_.endo_simul(i,k)');
|
||||
end
|
||||
return
|
||||
else
|
||||
j = strmatch(s1,M_.endo_names,'exact');
|
||||
j = strmatch(s1, M_.endo_names, 'exact');
|
||||
if ~ isempty(j)
|
||||
z = oo_.endo_simul(j,k)';
|
||||
else
|
||||
j = strmatch(s1,M_.exo_names,'exact');
|
||||
j = strmatch(s1, M_.exo_names, 'exact');
|
||||
if ~ isempty(j)
|
||||
if options_.smpl == 0
|
||||
z = oo_.exo_simul(:,j);
|
||||
|
|
|
@ -21,7 +21,7 @@ function [forecast,info] = dyn_forecast(var_list,M,options,oo,task,dataset_info)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -52,13 +52,13 @@ maximum_lag = M.maximum_lag;
|
|||
|
||||
endo_names = M.endo_names;
|
||||
if isempty(var_list)
|
||||
var_list = endo_names(1:M.orig_endo_nbr, :);
|
||||
var_list = endo_names(1:M.orig_endo_nbr);
|
||||
end
|
||||
i_var = [];
|
||||
for i = 1:size(var_list)
|
||||
tmp = strmatch(var_list(i,:),endo_names,'exact');
|
||||
for i = 1:length(var_list)
|
||||
tmp = strmatch(var_list{i}, endo_names, 'exact');
|
||||
if isempty(tmp)
|
||||
error([var_list(i,:) ' isn''t an endogenous variable'])
|
||||
error([var_list{i} ' isn''t an endogenous variable'])
|
||||
end
|
||||
i_var = [i_var; tmp];
|
||||
end
|
||||
|
@ -90,7 +90,7 @@ switch task
|
|||
y_smoothed = oo.SmoothedVariables;
|
||||
y0 = zeros(M.endo_nbr,maximum_lag);
|
||||
for i = 1:M.endo_nbr
|
||||
v_name = deblank(M.endo_names(i,:));
|
||||
v_name = M.endo_names{i};
|
||||
y0(i,:) = y_smoothed.(v_name)(end-maximum_lag+1:end); %includes steady state or mean, but simult_ will subtract only steady state
|
||||
% 2. Subtract mean/steady state and add steady state; takes care of prefiltering
|
||||
if isfield(oo.Smoother,'Constant') && isfield(oo.Smoother.Constant,v_name)
|
||||
|
@ -98,7 +98,7 @@ switch task
|
|||
if options.loglinear
|
||||
y0(i,:)=y0(i,:)+log_variable(i,oo.dr.ys,M);
|
||||
else
|
||||
y0(i,:)=y0(i,:)+oo.dr.ys(strmatch(v_name,deblank(M.endo_names),'exact'));
|
||||
y0(i,:)=y0(i,:)+oo.dr.ys(strmatch(v_name, M.endo_names, 'exact'));
|
||||
end
|
||||
end
|
||||
% 2. Subtract trend
|
||||
|
@ -114,8 +114,8 @@ switch task
|
|||
i_var_obs = [];
|
||||
trend_coeffs = [];
|
||||
for i=1:length(var_obs)
|
||||
tmp = strmatch(var_obs{i},endo_names(i_var,:),'exact');
|
||||
trend_var_index=strmatch(var_obs{i},M.endo_names,'exact');
|
||||
tmp = strmatch(var_obs{i}, endo_names(i_var), 'exact');
|
||||
trend_var_index = strmatch(var_obs{i}, M.endo_names, 'exact');
|
||||
if ~isempty(tmp)
|
||||
i_var_obs = [ i_var_obs; tmp];
|
||||
trend_coeffs = [trend_coeffs; oo.Smoother.TrendCoeffs(trend_var_index)];
|
||||
|
@ -175,21 +175,21 @@ else
|
|||
end
|
||||
|
||||
for i=1:n_var
|
||||
vname = deblank(var_list(i,:));
|
||||
vname = var_list{i};
|
||||
forecast.Mean.(vname) = yf(i,maximum_lag+(1:horizon))';
|
||||
forecast.HPDinf.(vname)= yf(i,maximum_lag+(1:horizon))' - int_width(1:horizon,i);
|
||||
forecast.HPDsup.(vname) = yf(i,maximum_lag+(1:horizon))' + int_width(1:horizon,i);
|
||||
if ~isequal(M.H,0) && ismember(var_list(i,:),options.varobs)
|
||||
if ~isequal(M.H,0) && ismember(var_list{i},options.varobs)
|
||||
forecast.HPDinf_ME.(vname)= yf(i,maximum_lag+(1:horizon))' - int_width_ME(1:horizon,i);
|
||||
forecast.HPDsup_ME.(vname) = yf(i,maximum_lag+(1:horizon))' + int_width_ME(1:horizon,i);
|
||||
end
|
||||
end
|
||||
|
||||
for i=1:M.exo_det_nbr
|
||||
forecast.Exogenous.(deblank(M.exo_det_names(i,:))) = oo.exo_det_simul(maximum_lag+(1:horizon),i);
|
||||
forecast.Exogenous.(M.exo_det_names{i}) = oo.exo_det_simul(maximum_lag+(1:horizon),i);
|
||||
end
|
||||
|
||||
if options.nograph == 0
|
||||
oo.forecast = forecast;
|
||||
forecast_graphs(var_list,M, oo,options)
|
||||
forecast_graphs(var_list, M, oo, options)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
function dyn_latex_table(M_,options_,title,LaTeXtitle,headers,labels,values,label_width,val_width,val_precis,optional_header)
|
||||
function dyn_latex_table(M_, options_, title, LaTeXtitle, headers, labels, values, label_width, val_width, val_precis, optional_header)
|
||||
|
||||
%function dyn_latex_table(M_,options_,title,LaTeXtitle,headers,labels,values,label_width,val_width,val_precis,optional_header)
|
||||
|
||||
% Copyright (C) 2015-2017 Dynare Team
|
||||
% Copyright (C) 2015-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -24,16 +25,15 @@ end
|
|||
|
||||
OutputDirectoryName = CheckPath('Output',M_.dname);
|
||||
|
||||
%% get width of label column
|
||||
if ~isempty(label_width)
|
||||
label_width = max(size(deblank(char(headers(1,:),labels)),2)+2, ...
|
||||
label_width);
|
||||
else %use default length
|
||||
label_width = max(size(deblank(char(headers(1,:),labels)),2))+2;
|
||||
% Set width of label column
|
||||
if isempty(label_width)
|
||||
label_width = cellofchararraymaxlength(vertcat(headers{1}, labels))+2;
|
||||
else
|
||||
label_width = max(cellofchararraymaxlength(vertcat(headers{1}, labels))+2, label_width);
|
||||
end
|
||||
label_format_leftbound = sprintf('$%%-%ds$',label_width);
|
||||
label_format_leftbound = sprintf('$%%-%ds$', label_width);
|
||||
|
||||
%% get width of label column
|
||||
% Set width of other columns
|
||||
if all(~isfinite(values))
|
||||
values_length = 4;
|
||||
else
|
||||
|
@ -42,66 +42,64 @@ end
|
|||
if any(values) < 0 %add one character for minus sign
|
||||
values_length = values_length+1;
|
||||
end
|
||||
|
||||
%% get width of header strings
|
||||
headers_length = max(size(deblank(headers(2:end,:)),2));
|
||||
if ~isempty(val_width)
|
||||
val_width = max(max(headers_length,values_length)+4,val_width);
|
||||
headers_length = cellofchararraymaxlength(headers(2:end));
|
||||
if isempty(val_width)
|
||||
val_width = max(headers_length, values_length)+4;
|
||||
else
|
||||
val_width = max(headers_length,values_length)+4;
|
||||
val_width = max(max(headers_length, values_length)+4, val_width);
|
||||
end
|
||||
value_format = sprintf('%%%d.%df',val_width,val_precis);
|
||||
header_string_format = sprintf('$%%%ds$',val_width);
|
||||
value_format = sprintf('%%%d.%df', val_width, val_precis);
|
||||
header_string_format = sprintf('$%%%ds$', val_width);
|
||||
|
||||
%Create and print header string
|
||||
if length(headers) > 0
|
||||
header_string = sprintf(label_format_leftbound ,strrep(deblank(headers(1,:)),'\','\\'));
|
||||
header_code_string='l';
|
||||
for i=2:size(headers,1)
|
||||
header_string = [header_string '\t & \t ' sprintf(header_string_format,strrep(deblank(headers(i,:)),'\','\\'))];
|
||||
header_code_string= [header_code_string 'c'];
|
||||
% Create and print header string
|
||||
if length(headers)>0
|
||||
header_string = sprintf(label_format_leftbound, strrep(headers{1}, '\', '\\'));
|
||||
header_code_string = 'l';
|
||||
for i=2:length(headers)
|
||||
header_string = [header_string '\t & \t ' sprintf(header_string_format, strrep(headers{i},'\','\\'))];
|
||||
header_code_string = [header_code_string 'c'];
|
||||
end
|
||||
end
|
||||
header_string=[header_string '\\\\\n'];
|
||||
header_string = [header_string '\\\\\n'];
|
||||
|
||||
filename = [OutputDirectoryName '/' M_.fname '_' LaTeXtitle '.tex'];
|
||||
fidTeX = fopen(filename,'w');
|
||||
|
||||
stack = dbstack;
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) ', created by ' stack(2).file]);
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,'\\begin{center}\n');
|
||||
fprintf(fidTeX,['\\begin{longtable}{%s} \n'],header_code_string);
|
||||
fprintf(fidTeX,['\\caption{',title,'}\\\\\n ']);
|
||||
fprintf(fidTeX, ['%% ' datestr(now,0) ', created by ' stack(2).file]);
|
||||
fprintf(fidTeX, ' \n');
|
||||
fprintf(fidTeX, ' \n');
|
||||
fprintf(fidTeX, '\\begin{center}\n');
|
||||
fprintf(fidTeX, ['\\begin{longtable}{%s} \n'], header_code_string);
|
||||
fprintf(fidTeX, ['\\caption{',title,'}\\\\\n ']);
|
||||
|
||||
fprintf(fidTeX,['\\label{Table:',LaTeXtitle,'}\\\\\n']);
|
||||
fprintf(fidTeX,'\\toprule \n');
|
||||
fprintf(fidTeX, ['\\label{Table:',LaTeXtitle,'}\\\\\n']);
|
||||
fprintf(fidTeX, '\\toprule \n');
|
||||
if nargin==11
|
||||
for ii=1:size(optional_header,1)
|
||||
for ii = 1:length(optional_header)
|
||||
fprintf(fidTeX,'%s\n',optional_header{ii});
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,header_string);
|
||||
fprintf(fidTeX,'\\midrule \\endfirsthead \n');
|
||||
fprintf(fidTeX,'\\caption{(continued)}\\\\\n ');
|
||||
fprintf(fidTeX,'\\toprule \\\\ \n');
|
||||
fprintf(fidTeX, header_string);
|
||||
fprintf(fidTeX, '\\midrule \\endfirsthead \n');
|
||||
fprintf(fidTeX, '\\caption{(continued)}\\\\\n ');
|
||||
fprintf(fidTeX, '\\toprule \\\\ \n');
|
||||
if nargin==11
|
||||
for ii=1:size(optional_header,1)
|
||||
fprintf(fidTeX,'%s\n',optional_header{ii});
|
||||
for ii = 1:length(optional_header)
|
||||
fprintf(fidTeX, '%s\n', optional_header{ii});
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,header_string);
|
||||
fprintf(fidTeX,'\\midrule \\endhead \n');
|
||||
fprintf(fidTeX,['\\midrule \\multicolumn{',num2str(size(headers,1)),'}{r}{(Continued on next page)} \\\\ \\bottomrule \\endfoot \n']);
|
||||
fprintf(fidTeX,'\\bottomrule \\endlastfoot \n');
|
||||
for i=1:size(values,1)
|
||||
fprintf(fidTeX,label_format_leftbound,deblank(labels(i,:)));
|
||||
fprintf(fidTeX,['\t & \t' value_format],values(i,:));
|
||||
fprintf(fidTeX,' \\\\ \n');
|
||||
fprintf(fidTeX, header_string);
|
||||
fprintf(fidTeX, '\\midrule \\endhead \n');
|
||||
fprintf(fidTeX, ['\\midrule \\multicolumn{',num2str(size(headers,1)),'}{r}{(Continued on next page)} \\\\ \\bottomrule \\endfoot \n']);
|
||||
fprintf(fidTeX, '\\bottomrule \\endlastfoot \n');
|
||||
for i = 1:size(values,1)
|
||||
fprintf(fidTeX, label_format_leftbound, labels{i});
|
||||
fprintf(fidTeX, ['\t & \t' value_format], values(i,:));
|
||||
fprintf(fidTeX, ' \\\\ \n');
|
||||
end
|
||||
|
||||
fprintf(fidTeX,'\\end{longtable}\n ');
|
||||
fprintf(fidTeX,'\\end{center}\n');
|
||||
fprintf(fidTeX,'%% End of TeX file.\n');
|
||||
fprintf(fidTeX, '\\end{longtable}\n ');
|
||||
fprintf(fidTeX, '\\end{center}\n');
|
||||
fprintf(fidTeX, '%% End of TeX file.\n');
|
||||
fclose(fidTeX);
|
|
@ -18,7 +18,7 @@ function [steady_state,params,check] = dyn_ramsey_static(ys_init,M,options_,oo)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -50,8 +50,7 @@ elseif options_.steadystate_flag
|
|||
k_inst = [];
|
||||
inst_nbr = size(options_.instruments,1);
|
||||
for i = 1:inst_nbr
|
||||
k_inst = [k_inst; strmatch(options_.instruments(i,:), ...
|
||||
M.endo_names,'exact')];
|
||||
k_inst = [k_inst; strmatch(options_.instruments(i,:), M.endo_names, 'exact')];
|
||||
end
|
||||
if inst_nbr == 1
|
||||
%solve for instrument, using univariate solver, starting at initial value for instrument
|
||||
|
@ -113,8 +112,7 @@ if options_.steadystate_flag
|
|||
k_inst = [];
|
||||
instruments = options_.instruments;
|
||||
for i = 1:size(instruments,1)
|
||||
k_inst = [k_inst; strmatch(instruments(i,:), ...
|
||||
endo_names,'exact')];
|
||||
k_inst = [k_inst; strmatch(instruments(i,:), endo_names, 'exact')];
|
||||
end
|
||||
ys_init=zeros(size(oo.steady_state)); %create starting vector for steady state computation as only instrument value is handed over
|
||||
ys_init(k_inst) = x; %set instrument, the only value required for steady state computation, to current value
|
||||
|
|
|
@ -62,7 +62,7 @@ function [dr,info] = dyn_risky_steadystate_solver(ys0,M, ...
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -86,7 +86,7 @@ order_var = dr.order_var;
|
|||
endo_nbr = M.endo_nbr;
|
||||
exo_nbr = M.exo_nbr;
|
||||
|
||||
M.var_order_endo_names = M.endo_names(dr.order_var,:);
|
||||
M.var_order_endo_names = M.endo_names(dr.order_var);
|
||||
|
||||
[junk,dr.i_fwrd_g,i_fwrd_f] = find(lead_lag_incidence(3,order_var));
|
||||
dr.i_fwrd_f = i_fwrd_f;
|
||||
|
@ -138,10 +138,10 @@ dr.ghs2 = zeros(M.endo_nbr,1);
|
|||
|
||||
for i=1:M.endo_nbr
|
||||
if isfield(options,'portfolio') && options.portfolio == 1
|
||||
disp(sprintf('%16s %12.6f %12.6f',M.endo_names(i,:),ys1(i), ...
|
||||
disp(sprintf('%16s %12.6f %12.6f', M.endo_names{i}, ys1(i), ...
|
||||
ys(i)))
|
||||
else
|
||||
disp(sprintf('%16s %12.6f %12.6f',M.endo_names(i,:),ys(i)))
|
||||
disp(sprintf('%16s %12.6f %12.6f', M.endo_names{i}, ys(i)))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -500,11 +500,11 @@ M_np = M;
|
|||
M_np.lead_lag_incidence = lead_lag_incidence_np;
|
||||
M_np.lead_lag_incidence = lead_lag_incidence_np;
|
||||
M_np.endo_nbr = length(v_np);
|
||||
M_np.endo_names = M.endo_names(v_np,:);
|
||||
M_np.endo_names = M.endo_names(v_np);
|
||||
dr_np = struct();
|
||||
dr_np = set_state_space(dr_np,M_np,options);
|
||||
pm.dr_np = dr_np;
|
||||
M_np.var_order_endo_names = M_np.endo_names(dr_np.order_var,:);
|
||||
M_np.var_order_endo_names = M_np.endo_names(dr_np.order_var);
|
||||
pm.M_np = M_np;
|
||||
pm.i_fwrd_g = find(lead_lag_incidence_np(lead_index,dr_np.order_var)');
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function dynareroot = dynare_config(path_to_dynare,verbose)
|
||||
%function dynareroot = dynare_config(path_to_dynare)
|
||||
function dynareroot = dynare_config(path_to_dynare, verbose)
|
||||
|
||||
% This function tests the existence of valid mex files (for qz
|
||||
% decomposition, solution to sylvester equation and kronecker
|
||||
% products...) and, if needed, add paths to the matlab versions
|
||||
|
@ -15,7 +15,7 @@ function dynareroot = dynare_config(path_to_dynare,verbose)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
|
|
@ -12,7 +12,7 @@ function oo_recursive_=dynare_estimation(var_list,dname)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -117,16 +117,16 @@ if nnobs > 1 && horizon > 0
|
|||
|
||||
if isempty(var_list)
|
||||
var_list = endo_names;
|
||||
nvar = size(endo_names,1);
|
||||
nvar = length(endo_names);
|
||||
SelecVariables = transpose(1:nvar);
|
||||
else
|
||||
nvar = size(var_list,1);
|
||||
nvar = length(var_list);
|
||||
SelecVariables = [];
|
||||
for i=1:nvar
|
||||
if ~isempty(strmatch(var_list(i,:),endo_names,'exact'))
|
||||
SelecVariables = [SelecVariables;strmatch(var_list(i,:),endo_names, 'exact')];
|
||||
if ~isempty(strmatch(var_list{i}, endo_names, 'exact'))
|
||||
SelecVariables = [SelecVariables; strmatch(var_list{i}, endo_names, 'exact')];
|
||||
else
|
||||
error(['Estimation:: ' var_list(i,:) ' isn''t an endogenous variable'])
|
||||
error(['Estimation:: ' var_list{i} ' isn''t an endogenous variable'])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -148,7 +148,7 @@ if nnobs > 1 && horizon > 0
|
|||
m = 1;
|
||||
plot_index=0;
|
||||
OutputDirectoryName = CheckPath('graphs',M_.fname);
|
||||
for i = 1:size(var_list,1)
|
||||
for i = 1:length(var_list)
|
||||
if mod(i,nstar) == 1
|
||||
plot_index=plot_index+1;
|
||||
hfig = dyn_figure(options_.nodisplay,'Name',['Out of sample forecasts (',num2str(plot_index),')']);
|
||||
|
@ -163,7 +163,7 @@ if nnobs > 1 && horizon > 0
|
|||
else
|
||||
offsetx = 0;
|
||||
end
|
||||
vname = deblank(var_list(i,:));
|
||||
vname = var_list{i};
|
||||
for j=1:nnobs
|
||||
if mh_replic > 0
|
||||
oo_.RecursiveForecast.Mean.(vname)(j,:) = ...
|
||||
|
@ -207,7 +207,7 @@ if nnobs > 1 && horizon > 0
|
|||
hold off
|
||||
xlim([nobs(1)-offsetx nobs(end)+horizon])
|
||||
m = m + 1;
|
||||
if mod(i+1,nstar) == 1 || i ==size(var_list,1)
|
||||
if mod(i+1,nstar) == 1 || i==length(var_list)
|
||||
dyn_saveas(hfig,[M_.fname,filesep,'graphs',filesep M_.fname '_RecursiveForecasts_' int2str(plot_index)],options_.nodisplay,options_.graph_format);
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ function dynare_estimation_1(var_list_,dname)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -141,8 +141,10 @@ missing_value = dataset_info.missing.state;
|
|||
|
||||
% Set number of observations
|
||||
gend = dataset_.nobs;
|
||||
|
||||
% Set the number of observed variables.
|
||||
n_varobs = length(options_.varobs);
|
||||
|
||||
% Get the number of parameters to be estimated.
|
||||
nvx = estim_params_.nvx; % Variance of the structural innovations (number of parameters).
|
||||
nvn = estim_params_.nvn; % Variance of the measurement innovations (number of parameters).
|
||||
|
@ -150,8 +152,9 @@ ncx = estim_params_.ncx; % Covariance of the structural innovations (number of
|
|||
ncn = estim_params_.ncn; % Covariance of the measurement innovations (number of parameters).
|
||||
np = estim_params_.np ; % Number of deep parameters.
|
||||
nx = nvx+nvn+ncx+ncn+np; % Total number of parameters to be estimated.
|
||||
%% Set the names of the priors.
|
||||
pnames = [' '; 'beta '; 'gamm '; 'norm '; 'invg '; 'unif '; 'invg2'; ' '; 'weibl'];
|
||||
|
||||
% Set the names of the priors.
|
||||
pnames = {''; 'beta'; 'gamm'; 'norm'; 'invg'; 'unif'; 'invg2'; ''; 'weibl'};
|
||||
|
||||
dr = oo_.dr;
|
||||
|
||||
|
@ -358,7 +361,7 @@ end
|
|||
|
||||
if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
|
||||
% display results table and store parameter estimates and standard errors in results
|
||||
oo_=display_estimation_results_table(xparam1,stdh,M_,options_,estim_params_,bayestopt_,oo_,pnames,'Posterior','posterior');
|
||||
oo_ = display_estimation_results_table(xparam1, stdh, M_, options_, estim_params_, bayestopt_, oo_, pnames, 'Posterior', 'posterior');
|
||||
% Laplace approximation to the marginal log density:
|
||||
if options_.cova_compute
|
||||
estim_params_nbr = size(xparam1,1);
|
||||
|
@ -376,7 +379,7 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
|
|||
end
|
||||
|
||||
elseif ~any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
|
||||
oo_=display_estimation_results_table(xparam1,stdh,M_,options_,estim_params_,bayestopt_,oo_,pnames,'Maximum Likelihood','mle');
|
||||
oo_=display_estimation_results_table(xparam1, stdh, M_, options_, estim_params_, bayestopt_, oo_, pnames, 'Maximum Likelihood', 'mle');
|
||||
end
|
||||
|
||||
if np > 0
|
||||
|
@ -563,7 +566,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
hold on
|
||||
plot(1:gend,innov(k,:),marker_string{2,1},'linewidth',1)
|
||||
hold off
|
||||
name = deblank(M_.exo_names(k,:));
|
||||
name = M_.exo_names{k};
|
||||
if isempty(NAMES)
|
||||
NAMES = name;
|
||||
else
|
||||
|
@ -577,7 +580,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
xlim([1 gend])
|
||||
end
|
||||
if options_.TeX
|
||||
texname = M_.exo_names_tex(k,:);
|
||||
texname = M_.exo_names_tex{k};
|
||||
if isempty(TeXNAMES)
|
||||
TeXNAMES = ['$ ' deblank(texname) ' $'];
|
||||
else
|
||||
|
@ -656,12 +659,12 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
set(gca,'XTickLabel',options_.XTickLabel)
|
||||
end
|
||||
if options_.TeX
|
||||
idx = strmatch(options_.varobs{index(k)},M_.endo_names,'exact');
|
||||
texname = M_.endo_names_tex(idx,:);
|
||||
idx = strmatch(options_.varobs{index(k)}, M_.endo_names, 'exact');
|
||||
texname = M_.endo_names_tex{idx};
|
||||
if isempty(TeXNAMES)
|
||||
TeXNAMES = ['$ ' deblank(texname) ' $'];
|
||||
TeXNAMES = ['$ ' texname ' $'];
|
||||
else
|
||||
TeXNAMES = char(TeXNAMES,['$ ' deblank(texname) ' $']);
|
||||
TeXNAMES = char(TeXNAMES,['$ ' texname ' $']);
|
||||
end
|
||||
end
|
||||
title(name,'Interpreter','none')
|
||||
|
@ -731,12 +734,12 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
xlim([1 gend])
|
||||
end
|
||||
if options_.TeX
|
||||
idx = strmatch(options_.varobs{k},M_.endo_names,'exact');
|
||||
texname = M_.endo_names_tex(idx,:);
|
||||
idx = strmatch(options_.varobs{k}, M_.endo_names,'exact');
|
||||
texname = M_.endo_names_tex{idx};
|
||||
if isempty(TeXNAMES)
|
||||
TeXNAMES = ['$ ' deblank(texname) ' $'];
|
||||
TeXNAMES = ['$ ' texname ' $'];
|
||||
else
|
||||
TeXNAMES = char(TeXNAMES,['$ ' deblank(texname) ' $']);
|
||||
TeXNAMES = char(TeXNAMES,['$ ' texname ' $']);
|
||||
end
|
||||
end
|
||||
title(name,'Interpreter','none')
|
||||
|
|
|
@ -32,7 +32,7 @@ function [dataset_, dataset_info, xparam1, hh, M_, options_, oo_, estim_params_,
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -56,7 +56,7 @@ if isempty(gsa_flag)
|
|||
gsa_flag = false;
|
||||
else
|
||||
% Decide if a DSGE or DSGE-VAR has to be estimated.
|
||||
if ~isempty(strmatch('dsge_prior_weight',M_.param_names))
|
||||
if ~isempty(strmatch('dsge_prior_weight', M_.param_names))
|
||||
options_.dsge_var = 1;
|
||||
end
|
||||
if isempty(var_list_)
|
||||
|
@ -425,8 +425,8 @@ nspred = M_.nspred; % Number of predetermined variables in the state
|
|||
var_obs_index_dr = [];
|
||||
k1 = [];
|
||||
for i=1:options_.number_of_observed_variables
|
||||
var_obs_index_dr = [var_obs_index_dr; strmatch(options_.varobs{i},M_.endo_names(dr.order_var,:),'exact')];
|
||||
k1 = [k1; strmatch(options_.varobs{i},M_.endo_names, 'exact')];
|
||||
var_obs_index_dr = [var_obs_index_dr; strmatch(options_.varobs{i}, M_.endo_names(dr.order_var), 'exact')];
|
||||
k1 = [k1; strmatch(options_.varobs{i}, M_.endo_names, 'exact')];
|
||||
end
|
||||
|
||||
k3 = [];
|
||||
|
@ -437,9 +437,9 @@ if options_.selected_variables_only
|
|||
k3 = (1:M_.endo_nbr)';
|
||||
k3p = (1:M_.endo_nbr)';
|
||||
else
|
||||
for i=1:size(var_list_,1)
|
||||
k3 = [k3; strmatch(var_list_(i,:),M_.endo_names(dr.order_var,:), 'exact')];
|
||||
k3p = [k3; strmatch(var_list_(i,:),M_.endo_names, 'exact')];
|
||||
for i=1:length(var_list_)
|
||||
k3 = [k3; strmatch(var_list_{i}, M_.endo_names(dr.order_var), 'exact')];
|
||||
k3p = [k3; strmatch(var_list_{i}, M_.endo_names, 'exact')];
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -513,11 +513,11 @@ if options_.analytic_derivation
|
|||
skipline()
|
||||
if any(isnan(params))
|
||||
disp('After computing the steadystate, the following parameters are still NaN: '),
|
||||
disp(M.param_names(isnan(params),:))
|
||||
disp(char(M.param_names(isnan(params))))
|
||||
end
|
||||
if any(find(params(~isnan(params))-M.params(~isnan(params))))
|
||||
disp('The steadystate file changed the values for the following parameters: '),
|
||||
disp(M.param_names(find(params(~isnan(params))-M.params(~isnan(params))),:))
|
||||
disp(char(M.param_names(find(params(~isnan(params))-M.params(~isnan(params))))))
|
||||
end
|
||||
disp('The derivatives of jacobian and steady-state will be computed numerically'),
|
||||
disp('(re-set options_.analytic_derivation_mode= -2)'),
|
||||
|
|
|
@ -17,9 +17,7 @@ function [pdraws, TAU, GAM, LRE, gp, H, JJ] = dynare_identification(options_iden
|
|||
% SPECIAL REQUIREMENTS
|
||||
% None
|
||||
|
||||
% main
|
||||
%
|
||||
% Copyright (C) 2010-2017 Dynare Team
|
||||
% Copyright (C) 2010-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -147,8 +145,9 @@ options_ = set_default_option(options_,'datafile','');
|
|||
options_.mode_compute = 0;
|
||||
options_.plot_priors = 0;
|
||||
options_.smoother=1;
|
||||
[dataset_,dataset_info,xparam1,hh, M_, options_, oo_, estim_params_,bayestopt_,bounds]=dynare_estimation_init(M_.endo_names,fname_,1, M_, options_, oo_, estim_params_, bayestopt_);
|
||||
options_ident = set_default_option(options_ident,'analytic_derivation_mode',options_.analytic_derivation_mode); % if not set by user, inherit default global one
|
||||
[dataset_, dataset_info, xparam1, hh, M_, options_, oo_, estim_params_, bayestopt_, bounds] = ...
|
||||
dynare_estimation_init(M_.endo_names, fname_,1, M_, options_, oo_, estim_params_, bayestopt_);
|
||||
options_ident = set_default_option(options_ident,'analytic_derivation_mode', options_.analytic_derivation_mode); % if not set by user, inherit default global one
|
||||
|
||||
if prior_exist
|
||||
if any(bayestopt_.pshape > 0)
|
||||
|
@ -206,7 +205,7 @@ if prior_exist
|
|||
end
|
||||
end
|
||||
if options_.TeX
|
||||
name_tex=char(name_tex);
|
||||
name_tex=name_tex;
|
||||
end
|
||||
else
|
||||
indx = [1:M_.param_nbr];
|
||||
|
@ -214,8 +213,10 @@ else
|
|||
offset = M_.exo_nbr;
|
||||
np = M_.param_nbr;
|
||||
nparam = np+offset;
|
||||
name = [cellstr([repmat('SE_',size(M_.exo_names_tex)),M_.exo_names_tex]); cellstr(M_.param_names)];
|
||||
name_tex = [cellstr([repmat('$ SE_',size(M_.exo_names_tex)),M_.exo_names_tex,repmat('}$',size(M_.exo_names_tex))]); cellstr(M_.param_names_tex)];
|
||||
name = cellfun(@(x) horzcat('SE_', x), M_.exo_names, 'UniformOutput', false);
|
||||
name = vertcat(name, M_.param_names);
|
||||
name_tex = cellfun(@(x) horzcat('$ SE_{', x, '} $'), M_.exo_names, 'UniformOutput', false);
|
||||
name_tex = vertcat(name_tex, M_.param_names_tex);
|
||||
if ~isequal(M_.H,0)
|
||||
fprintf('\ndynare_identification:: Identification does not support measurement errors and will ignore them in the following. To test their identifiability, instead define them explicitly in measurement equations in the model definition.\n')
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ function x0=dynare_sensitivity(options_gsa)
|
|||
% Reference:
|
||||
% M. Ratto, Global Sensitivity Analysis for Macroeconomic models, MIMEO, 2006.
|
||||
|
||||
% Copyright (C) 2008-2017 Dynare Team
|
||||
% Copyright (C) 2008-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -124,7 +124,8 @@ if ~isempty(options_gsa.datafile) || isempty(bayestopt_) || options_gsa.rmse
|
|||
options_.mode_compute = 0;
|
||||
options_.filtered_vars = 1;
|
||||
options_.plot_priors = 0;
|
||||
[dataset_,dataset_info,xparam1,hh, M_, options_, oo_, estim_params_,bayestopt_]=dynare_estimation_init(M_.endo_names,fname_,1, M_, options_, oo_, estim_params_, bayestopt_);
|
||||
[dataset_,dataset_info,xparam1,hh, M_, options_, oo_, estim_params_, bayestopt_] = ...
|
||||
dynare_estimation_init(M_.endo_names, fname_, 1, M_, options_, oo_, estim_params_, bayestopt_);
|
||||
% computes a first linear solution to set up various variables
|
||||
else
|
||||
if isempty(options_.qz_criterium)
|
||||
|
@ -186,23 +187,23 @@ options_gsa = set_default_option(options_gsa,'logtrans_redform',0);
|
|||
options_gsa = set_default_option(options_gsa,'threshold_redform',[]);
|
||||
options_gsa = set_default_option(options_gsa,'ksstat_redform',0.001);
|
||||
options_gsa = set_default_option(options_gsa,'alpha2_redform',1.e-5);
|
||||
options_gsa = set_default_option(options_gsa,'namendo',[]);
|
||||
options_gsa = set_default_option(options_gsa,'namendo',{});
|
||||
options_gsa = set_default_option(options_gsa,'namlagendo',[]);
|
||||
options_gsa = set_default_option(options_gsa,'namexo',[]);
|
||||
options_gsa = set_default_option(options_gsa,'namexo',{});
|
||||
% RMSE mapping
|
||||
options_gsa = set_default_option(options_gsa,'load_rmse',0);
|
||||
options_gsa = set_default_option(options_gsa,'lik_only',0);
|
||||
options_gsa = set_default_option(options_gsa,'var_rmse',char(options_.varobs));
|
||||
options_gsa = set_default_option(options_gsa,'var_rmse', options_.varobs);
|
||||
%get corresponding TeX-names;
|
||||
options_gsa.var_rmse_tex='';
|
||||
for ii=1:size(options_gsa.var_rmse,1)
|
||||
temp_name=M_.endo_names_tex(strmatch(deblank(options_gsa.var_rmse(ii,:)),M_.endo_names,'exact'),:);
|
||||
options_gsa.var_rmse_tex=strvcat(options_gsa.var_rmse_tex,temp_name);
|
||||
options_gsa.var_rmse_tex={};
|
||||
for ii=1:length(options_gsa.var_rmse)
|
||||
temp_name = M_.endo_names_tex{strmatch(options_gsa.var_rmse{ii}, M_.endo_names, 'exact')};
|
||||
options_gsa.var_rmse_tex = vertcat(options_gsa.var_rmse_tex, temp_name);
|
||||
end
|
||||
options_gsa = set_default_option(options_gsa,'pfilt_rmse',0.1);
|
||||
options_gsa = set_default_option(options_gsa,'istart_rmse',options_.presample+1);
|
||||
options_gsa = set_default_option(options_gsa,'alpha_rmse',0.001);
|
||||
options_gsa = set_default_option(options_gsa,'alpha2_rmse',1.e-5);
|
||||
options_gsa = set_default_option(options_gsa,'pfilt_rmse', 0.1);
|
||||
options_gsa = set_default_option(options_gsa,'istart_rmse', options_.presample+1);
|
||||
options_gsa = set_default_option(options_gsa,'alpha_rmse', 0.001);
|
||||
options_gsa = set_default_option(options_gsa,'alpha2_rmse', 1.e-5);
|
||||
|
||||
if options_gsa.neighborhood_width
|
||||
options_gsa.pprior=0;
|
||||
|
@ -324,13 +325,13 @@ if options_gsa.redform && ~isempty(options_gsa.namendo)
|
|||
x0 = stab_map_(OutputDirectoryName,options_gsa);
|
||||
end
|
||||
if strmatch(':',options_gsa.namendo,'exact')
|
||||
options_gsa.namendo=M_.endo_names(1:M_.orig_endo_nbr,:);
|
||||
options_gsa.namendo = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
if strmatch(':',options_gsa.namexo,'exact')
|
||||
options_gsa.namexo=M_.exo_names;
|
||||
options_gsa.namexo = M_.exo_names;
|
||||
end
|
||||
if strmatch(':',options_gsa.namlagendo,'exact')
|
||||
options_gsa.namlagendo=M_.endo_names(1:M_.orig_endo_nbr,:);
|
||||
options_gsa.namlagendo = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
% options_.opt_gsa = options_gsa;
|
||||
if options_gsa.morris==1
|
||||
|
@ -345,7 +346,6 @@ if options_gsa.redform && ~isempty(options_gsa.namendo)
|
|||
fprintf('After obtaining the files, you need to unpack them and set a Matlab Path to those files.\n')
|
||||
error('SS-ANOVA-R Toolbox missing!')
|
||||
end
|
||||
|
||||
redform_map(OutputDirectoryName,options_gsa);
|
||||
end
|
||||
end
|
||||
|
@ -462,7 +462,7 @@ if options_gsa.glue
|
|||
Obs.name{j} = options_.varobs{j};
|
||||
vj = options_.varobs{j};
|
||||
|
||||
jxj = strmatch(vj,lgy_(dr_.order_var,:),'exact');
|
||||
jxj = strmatch(vj,lgy_(dr_.order_var),'exact');
|
||||
js = strmatch(vj,lgy_,'exact');
|
||||
if ~options_gsa.ppost
|
||||
% y0=zeros(gend+1,nruns);
|
||||
|
@ -502,7 +502,7 @@ if options_gsa.glue
|
|||
for j=1:M_.endo_nbr
|
||||
if ~ismember(j,ismoo)
|
||||
jsmoo=jsmoo+1;
|
||||
vj=deblank(M_.endo_names(dr_.order_var(j),:));
|
||||
vj = M_.endo_names{dr_.order_var(j)};
|
||||
if ~options_gsa.ppost
|
||||
% y0 = squeeze(stock_smooth(:,j,:)) + ...
|
||||
% kron(stock_ys(j,:),ones(size(stock_smooth,1),1));
|
||||
|
@ -518,9 +518,9 @@ if options_gsa.glue
|
|||
Out1(jsmoo).ini = 'yes';
|
||||
end
|
||||
end
|
||||
tit(M_.exo_names_orig_ord,:) = M_.exo_names;
|
||||
tit(M_.exo_names_orig_ord) = M_.exo_names;
|
||||
for j=1:M_.exo_nbr
|
||||
Exo(j).name = deblank(tit(j,:));
|
||||
Exo(j).name = tit{j};
|
||||
end
|
||||
if ~options_gsa.ppost
|
||||
Lik(length(options_.varobs)+1).name = 'logpo';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function dynasave(s,var_list)
|
||||
function dynasave(s, var_list)
|
||||
% function dynasave(s,var_list)
|
||||
% This optional command saves the simulation results in a .MAT file.
|
||||
%
|
||||
|
@ -12,7 +12,7 @@ function dynasave(s,var_list)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2001-2015 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -31,28 +31,28 @@ function dynasave(s,var_list)
|
|||
|
||||
global M_ oo_
|
||||
|
||||
if size(var_list,1) == 0
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr, :);
|
||||
if isempty(var_list)
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
|
||||
if ~isfield(oo_,'endo_simul') || isempty(oo_.endo_simul)
|
||||
if ~isfield(oo_, 'endo_simul') || isempty(oo_.endo_simul)
|
||||
error('dynasave:: The results structure does not contain simulated series. Maybe the periods option has not been set.')
|
||||
end
|
||||
|
||||
n = size(var_list,1);
|
||||
ivar=zeros(n,1);
|
||||
n = length(var_list);
|
||||
ivar = zeros(n, 1);
|
||||
for i=1:n
|
||||
i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
|
||||
i_tmp = strmatch(var_list{i}, M_.endo_names, 'exact');
|
||||
if isempty(i_tmp)
|
||||
error (['One of the specified variables does not exist']) ;
|
||||
error ('One of the specified variables does not exist') ;
|
||||
else
|
||||
ivar(i) = i_tmp;
|
||||
end
|
||||
end
|
||||
|
||||
eval([var_list(1,:) '=oo_.endo_simul(ivar(1),:)'';'])
|
||||
eval(['save ' s ' ' var_list(1,:) ' -mat'])
|
||||
eval([var_list{1} ' = oo_.endo_simul(ivar(1),:)'';'])
|
||||
eval(['save ' s ' ' var_list{1} ' -mat'])
|
||||
for dynare__i_ = 2:n
|
||||
eval([var_list(dynare__i_,:) '=oo_.endo_simul(ivar(dynare__i_),:)'';'])
|
||||
eval(['save ' s ' ' var_list(dynare__i_,:) ' -append -mat'])
|
||||
eval([var_list{dynare__i_} ' = oo_.endo_simul(ivar(dynare__i_),:)'';'])
|
||||
eval(['save ' s ' ' var_list{dynare__i_} ' -append -mat'])
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ function dynatype (s,var_list)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -34,23 +34,24 @@ global M_ oo_
|
|||
|
||||
fid=fopen(s,'w') ;
|
||||
|
||||
if size(var_list,1) == 0
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr,:);
|
||||
if isempty(var_list)
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
|
||||
n = size(var_list,1);
|
||||
ivar=zeros(n,1);
|
||||
n = length(var_list);
|
||||
ivar = zeros(n,1);
|
||||
|
||||
for i=1:n
|
||||
i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
|
||||
i_tmp = strmatch(var_list{i}, M_.endo_names, 'exact');
|
||||
if isempty(i_tmp)
|
||||
error (['One of the specified variables does not exist']) ;
|
||||
error ('One of the specified variables does not exist') ;
|
||||
else
|
||||
ivar(i) = i_tmp;
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1:n
|
||||
fprintf(fid,M_.endo_names(ivar(i),:),'\n') ;
|
||||
fprintf(fid,M_.endo_names{ivar(i)},'\n') ;
|
||||
fprintf(fid,'\n') ;
|
||||
fprintf(fid,'%15.8g\n',oo_.endo_simul(ivar(i),:)') ;
|
||||
end
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
function dyntable(options_,title,headers,labels,values,label_width,val_width,val_precis,optional_header)
|
||||
% function dyntable(title,headers,labels,values,label_width,val_width,val_precis)
|
||||
% Inputs:
|
||||
% options_ [structure] Dynare options structure
|
||||
% title [string] Table title
|
||||
% headers [n by nchar] character array of labels for header row
|
||||
% labels [n by nchar] character array of labels for label column
|
||||
% values [matrix] matrix of values to display
|
||||
% label_width [scalar] Width of the label
|
||||
% val_width [scalar] Width of value column
|
||||
% val_precis [integer] precision of displayed values
|
||||
function dyntable(options_, title, headers, labels, values, label_width, val_width, val_precis, optional_header)
|
||||
|
||||
% Prints a table of results in main command window.
|
||||
%
|
||||
% INPUTS
|
||||
% - options_ [structure] Dynare options structure
|
||||
% - title [string] Table title
|
||||
% - headers [cell] labels for header row (each element is a row characater array)
|
||||
% - labels [cell] labels for label column (each element is a row characater array)
|
||||
% - values [double] matrix of values to display
|
||||
% - label_width [integer] scalar, width of the label
|
||||
% - val_width [integer] scalar, width of value column
|
||||
% - val_precis [integer] scalar, precision of displayed values
|
||||
%
|
||||
% Copyright (C) 2002-2017 Dynare Team
|
||||
% OUTPUTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2002-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -32,16 +36,16 @@ if options_.noprint
|
|||
return
|
||||
end
|
||||
|
||||
%% get width of label column
|
||||
if ~isempty(label_width)
|
||||
label_width = max(size(deblank(char(headers(1,:),labels)),2)+2, ...
|
||||
label_width);
|
||||
else %use default length
|
||||
label_width = max(size(deblank(char(headers(1,:),labels)),2))+2;
|
||||
% Set width of label column
|
||||
if isempty(label_width)
|
||||
label_width = cellofchararraymaxlength(vertcat(headers{1}, labels))+2;
|
||||
else
|
||||
label_width = max(cellofchararraymaxlength(vertcat(headers{1}, labels))+2, label_width);
|
||||
end
|
||||
label_format_leftbound = sprintf('%%-%ds',label_width);
|
||||
label_format_leftbound = sprintf('%%-%ds', label_width);
|
||||
|
||||
%% get width of label column
|
||||
|
||||
% Set width of other columns
|
||||
if all(~isfinite(values))
|
||||
values_length = 4;
|
||||
else
|
||||
|
@ -50,32 +54,32 @@ end
|
|||
if any(values) < 0 %add one character for minus sign
|
||||
values_length = values_length+1;
|
||||
end
|
||||
|
||||
%% get width of header strings
|
||||
headers_length = max(size(deblank(headers(2:end,:)),2));
|
||||
if ~isempty(val_width)
|
||||
val_width = max(max(headers_length,values_length)+2,val_width);
|
||||
headers_length = cellofchararraymaxlength(headers(2:end));
|
||||
if isempty(val_width)
|
||||
val_width = max(headers_length, values_length)+2;
|
||||
else
|
||||
val_width = max(headers_length,values_length)+2;
|
||||
val_width = max(max(headers_length, values_length)+2, val_width);
|
||||
end
|
||||
value_format = sprintf('%%%d.%df',val_width,val_precis);
|
||||
header_string_format = sprintf('%%%ds',val_width);
|
||||
value_format = sprintf('%%%d.%df', val_width, val_precis);
|
||||
header_string_format = sprintf('%%%ds', val_width);
|
||||
|
||||
if length(title) > 0
|
||||
fprintf('\n\n%s\n',title);
|
||||
end
|
||||
%Create and print header string
|
||||
|
||||
% Create and print header string
|
||||
if nargin==9
|
||||
disp(optional_header)
|
||||
end
|
||||
|
||||
if length(headers) > 0
|
||||
hh = sprintf(label_format_leftbound ,deblank(headers(1,:)));
|
||||
for i=2:size(headers,1)
|
||||
hh = [hh sprintf(header_string_format,deblank(headers(i,:)))];
|
||||
hh = sprintf(label_format_leftbound , headers{1});
|
||||
for i=2:length(headers)
|
||||
hh = [hh sprintf(header_string_format, headers{i})];
|
||||
end
|
||||
disp(hh);
|
||||
disp(hh)
|
||||
end
|
||||
|
||||
for i=1:size(values,1)
|
||||
disp([sprintf(label_format_leftbound ,deblank(labels(i,:))) sprintf(value_format ,values(i,:))]);
|
||||
disp([sprintf(label_format_leftbound, labels{i}) sprintf(value_format, values(i,:))])
|
||||
end
|
|
@ -15,7 +15,7 @@ function [info, info_irf, info_moment, data_irf, data_moment] = endogenous_prior
|
|||
% info_moment [double] array of test checks for all individual moment restrictions
|
||||
%
|
||||
|
||||
% Copyright (C) 2013-2017 Dynare Team
|
||||
% Copyright (C) 2013-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -47,22 +47,22 @@ if ~isempty(endo_prior_restrictions.irf)
|
|||
error('The algorithm for prior (sign) restrictions on irf''s is currently restricted to first-order decision rules')
|
||||
return
|
||||
end
|
||||
varlist=Model.endo_names(DynareResults.dr.order_var,:);
|
||||
varlist = Model.endo_names(DynareResults.dr.order_var);
|
||||
if isempty(T)
|
||||
[T,R,SteadyState,infox,Model,DynareOptions,DynareResults] = dynare_resolve(Model,DynareOptions,DynareResults);
|
||||
else % check if T and R are given in the restricted form!!!
|
||||
if size(T,1)<size(varlist,1)
|
||||
varlist=varlist(DynareResults.dr.restrict_var_list,:);
|
||||
if size(T,1)<length(varlist)
|
||||
varlist = varlist(DynareResults.dr.restrict_var_list);
|
||||
end
|
||||
% check if endo_prior_restrictions.irf{:,1} variables are in varlist
|
||||
varlistok=1;
|
||||
for j=1:size(endo_prior_restrictions.irf,1)
|
||||
if isempty(strmatch(endo_prior_restrictions.irf{j,1},varlist,'exact'))
|
||||
if isempty(strmatch(endo_prior_restrictions.irf{j,1}, varlist, 'exact'))
|
||||
varlistok=0;
|
||||
end
|
||||
end
|
||||
if ~varlistok
|
||||
varlist=Model.endo_names(DynareResults.dr.order_var,:);
|
||||
varlist = Model.endo_names(DynareResults.dr.order_var);
|
||||
[T,R,SteadyState,infox,Model,DynareOptions,DynareResults] = dynare_resolve(Model,DynareOptions,DynareResults);
|
||||
end
|
||||
end
|
||||
|
@ -81,8 +81,8 @@ if ~isempty(endo_prior_restrictions.irf)
|
|||
if endo_prior_restrictions.irf{j,3}~=t
|
||||
continue
|
||||
end
|
||||
iendo=strmatch(endo_prior_restrictions.irf{j,1},varlist,'exact');
|
||||
iexo=strmatch(endo_prior_restrictions.irf{j,2},Model.exo_names,'exact');
|
||||
iendo=strmatch(endo_prior_restrictions.irf{j,1}, varlist, 'exact');
|
||||
iexo=strmatch(endo_prior_restrictions.irf{j,2}, Model.exo_names, 'exact');
|
||||
data_irf{j}=[data_irf{j}; [t RR(iendo,iexo)]];
|
||||
if (RR(iendo,iexo)>endo_prior_restrictions.irf{j,4}(1)) && (RR(iendo,iexo)<endo_prior_restrictions.irf{j,4}(2))
|
||||
info_irf(j,:)=info_irf(j,:).*[0, 0];
|
||||
|
@ -108,7 +108,7 @@ if ~isempty(endo_prior_restrictions.moment)
|
|||
return
|
||||
end
|
||||
data_moment=cell(size(endo_prior_restrictions.moment,1),1);
|
||||
var_list_=endo_prior_restrictions.moment{1,1};
|
||||
var_list_ = endo_prior_restrictions.moment{1,1};
|
||||
for j=1:size(endo_prior_restrictions.moment,1)
|
||||
tmp=endo_prior_restrictions.moment{j,1};
|
||||
if ~ismember(tmp,cellstr(var_list_))
|
||||
|
@ -129,7 +129,7 @@ if ~isempty(endo_prior_restrictions.moment)
|
|||
nvar = size(var_list_,1);
|
||||
ivar=zeros(nvar,1);
|
||||
for i=1:nvar
|
||||
i_tmp = strmatch(var_list_(i,:),Model.endo_names,'exact');
|
||||
i_tmp = strmatch(var_list_(i,:), Model.endo_names, 'exact');
|
||||
if isempty(i_tmp)
|
||||
error (['One of the variable specified does not exist'])
|
||||
else
|
||||
|
|
|
@ -19,7 +19,7 @@ function [ts, DynareResults] = extended_path(initialconditions, samplesize, exog
|
|||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
|
||||
% Copyright (C) 2009-2017 Dynare Team
|
||||
% Copyright (C) 2009-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -98,7 +98,7 @@ if any(isnan(endogenous_variables_paths(:)))
|
|||
nn = size(endogenous_variables_paths, 1);
|
||||
endogenous_variables_paths = reshape(endogenous_variables_paths(sl), nn, length(sl)/nn);
|
||||
end
|
||||
ts = dseries(transpose(endogenous_variables_paths), initial_period, cellstr(DynareModel.endo_names));
|
||||
ts = dseries(transpose(endogenous_variables_paths), initial_period, DynareModel.endo_names);
|
||||
|
||||
DynareResults.endo_simul = transpose(ts.data);
|
||||
assignin('base', 'Simulated_time_series', ts);
|
||||
|
|
|
@ -11,7 +11,7 @@ function planner_objective_value = evaluate_planner_objective(M,options,oo)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2007-2017 Dynare Team
|
||||
% Copyright (C) 2007-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -39,7 +39,7 @@ if nspred > 180
|
|||
planner_objective_value = NaN;
|
||||
return
|
||||
end
|
||||
beta = get_optimal_policy_discount_factor(M.params,M.param_names);
|
||||
beta = get_optimal_policy_discount_factor(M.params, M.param_names);
|
||||
|
||||
Gy = dr.ghx(nstatic+(1:nspred),:);
|
||||
Gu = dr.ghu(nstatic+(1:nspred),:);
|
||||
|
|
|
@ -22,7 +22,7 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -124,14 +124,14 @@ if options.ramsey_policy
|
|||
if ~isempty(infrow)
|
||||
fprintf('\nevaluate_steady_state: The initial values for the steady state of the following variables are Inf:\n');
|
||||
for iter=1:length(infrow)
|
||||
fprintf('%s\n',M.endo_names(infrow(iter),:));
|
||||
fprintf('%s\n',M.endo_names{infrow(iter)});
|
||||
end
|
||||
end
|
||||
nanrow=find(isnan(ys_init));
|
||||
if ~isempty(nanrow)
|
||||
fprintf('\nevaluate_steady_state: The initial values for the steady state of the following variables are NaN:\n');
|
||||
for iter=1:length(nanrow)
|
||||
fprintf('%s\n',M.endo_names(nanrow(iter),:));
|
||||
fprintf('%s\n',M.endo_names{nanrow(iter)});
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ function [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,options,
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -117,19 +117,19 @@ if length(M.aux_vars) > 0 && ~options.ramsey_policy
|
|||
ys3 = ys;
|
||||
idx = find(abs(ys0-ys1)>0);
|
||||
if ~isempty(idx)
|
||||
M.endo_names(idx,:)
|
||||
M.endo_names{idx}
|
||||
else
|
||||
disp('1-invariant')
|
||||
end
|
||||
idx = find(abs(ys2-ys1)>0);
|
||||
if ~isempty(idx)
|
||||
M.endo_names(idx,:)
|
||||
M.endo_names{idx}
|
||||
else
|
||||
disp('2-invariant')
|
||||
end
|
||||
idx = find(abs(ys3-ys3)>0);
|
||||
if ~isempty(idx)
|
||||
M.endo_names(idx,:)
|
||||
M.endo_names{idx}
|
||||
else
|
||||
disp('3-invariant')
|
||||
end
|
||||
|
@ -160,9 +160,7 @@ elseif ~isempty(options.steadystate_partial)
|
|||
nov = length(ssvar);
|
||||
indv = zeros(nov,1);
|
||||
for i = 1:nov
|
||||
indv(i) = strmatch(ssvar(i),M.endo_names,'exact');
|
||||
indv(i) = strmatch(ssvar(i), M.endo_names, 'exact');
|
||||
end
|
||||
[ys,check] = dynare_solve('restricted_steadystate',...
|
||||
ys(indv),...
|
||||
options, exo_ss,indv);
|
||||
[ys,check] = dynare_solve('restricted_steadystate', ys(indv), options, exo_ss,indv);
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ function [yf,int_width,int_width_ME]=forcst(dr,y0,horizon,var_list,M_,oo_,option
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -48,16 +48,16 @@ endo_nbr = M_.endo_nbr;
|
|||
inv_order_var = dr.inv_order_var;
|
||||
[A,B] = kalman_transition_matrix(dr,nstatic+(1:nspred),1:nc,M_.exo_nbr);
|
||||
|
||||
if size(var_list,1) == 0
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr,:);
|
||||
if isempty(var_list)
|
||||
var_list = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
nvar = size(var_list,1);
|
||||
ivar=zeros(nvar,1);
|
||||
nvar = length(var_list);
|
||||
ivar = zeros(nvar, 1);
|
||||
for i=1:nvar
|
||||
i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
|
||||
i_tmp = strmatch(var_list{i}, M_.endo_names, 'exact');
|
||||
if isempty(i_tmp)
|
||||
disp(var_list(i,:));
|
||||
error (['One of the variable specified does not exist']) ;
|
||||
disp(var_list{i});
|
||||
error ('One of the variable specified does not exist') ;
|
||||
else
|
||||
ivar(i) = i_tmp;
|
||||
end
|
||||
|
@ -71,8 +71,8 @@ sigma_u = B*M_.Sigma_e*B';
|
|||
sigma_u1 = ghu1*M_.Sigma_e*ghu1';
|
||||
sigma_y = 0; %no uncertainty about the states
|
||||
|
||||
var_yf=NaN(horizon,nvar); %initialize
|
||||
for i=1:horizon
|
||||
var_yf = NaN(horizon,nvar); %initialize
|
||||
for i = 1:horizon
|
||||
%map uncertainty about states into uncertainty about observables
|
||||
sigma_y1 = ghx1*sigma_y*ghx1'+sigma_u1;
|
||||
var_yf(i,:) = diag(sigma_y1)';
|
||||
|
@ -85,18 +85,18 @@ for i=1:horizon
|
|||
end
|
||||
if nargout==3
|
||||
var_yf_ME=var_yf;
|
||||
[loc_H,loc_varlist]=ismember(options_.varobs',options_.varlist);
|
||||
loc_varlist(loc_varlist==0)=[];
|
||||
[loc_H, loc_varlist] = ismember(options_.varobs', options_.varlist);
|
||||
loc_varlist(loc_varlist==0) = [];
|
||||
if ~isempty(loc_varlist)
|
||||
var_yf_ME(:,loc_varlist)=var_yf(:,loc_varlist)+ repmat(diag(M_.H(loc_H,loc_H))',horizon,1);
|
||||
var_yf_ME(:,loc_varlist) = var_yf(:,loc_varlist)+repmat(diag(M_.H(loc_H,loc_H))', horizon, 1);
|
||||
end
|
||||
int_width_ME = zeros(horizon,nvar);
|
||||
int_width_ME = zeros(horizon, nvar);
|
||||
end
|
||||
|
||||
fact = norminv((1-options_.forecasts.conf_sig)/2,0,1);
|
||||
fact = norminv((1-options_.forecasts.conf_sig)/2, 0, 1);
|
||||
|
||||
int_width = zeros(horizon,nvar);
|
||||
for i=1:nvar
|
||||
int_width = zeros(horizon, nvar);
|
||||
for i = 1:nvar
|
||||
int_width(:,i) = -fact*sqrt(var_yf(:,i));
|
||||
if nargout==3
|
||||
int_width_ME(:,i) = -fact*sqrt(var_yf_ME(:,i));
|
||||
|
|
|
@ -8,7 +8,7 @@ function forecast_graphs(var_list,M_, oo_,options_)
|
|||
% o oo_ outputs structure
|
||||
% o options_ options structure
|
||||
|
||||
% Copyright (C) 2008-2017 Dynare Team
|
||||
% Copyright (C) 2008-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -35,13 +35,13 @@ yf = oo_.forecast.Mean;
|
|||
hpdinf = oo_.forecast.HPDinf;
|
||||
hpdsup = oo_.forecast.HPDsup;
|
||||
if isempty(var_list)
|
||||
var_list = endo_names(1:M_.orig_endo_nbr,:);
|
||||
var_list = endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
i_var = [];
|
||||
for i = 1:size(var_list)
|
||||
tmp = strmatch(var_list(i,:),endo_names,'exact');
|
||||
for i = 1:length(var_list)
|
||||
tmp = strmatch(var_list{i}, endo_names, 'exact');
|
||||
if isempty(tmp)
|
||||
error([var_list(i,:) ' isn''t an endogenous variable'])
|
||||
error([var_list{i} ' isn''t an endogenous variable'])
|
||||
end
|
||||
i_var = [i_var; tmp];
|
||||
end
|
||||
|
@ -55,17 +55,18 @@ if ~exist([dname '/graphs'],'dir')
|
|||
mkdir(dname,'graphs');
|
||||
end
|
||||
|
||||
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fidTeX=write_LaTeX_header([M_.dname '/graphs/',fname,'_forcst.tex']);
|
||||
if options_.TeX && any(strcmp('eps', cellstr(options_.graph_format)))
|
||||
fidTeX = write_LaTeX_header([M_.dname '/graphs/', fname, '_forcst.tex']);
|
||||
end
|
||||
|
||||
m = 1;
|
||||
n_fig = 1;
|
||||
hh=dyn_figure(options_.nodisplay,'Name','Forecasts (I)');
|
||||
hh = dyn_figure(options_.nodisplay, 'Name', 'Forecasts (I)');
|
||||
|
||||
for j= 1:nvar
|
||||
if m > nc*nr
|
||||
dyn_saveas(hh,[ dname '/graphs/forcst' int2str(n_fig)],options_.nodisplay,options_.graph_format);
|
||||
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
dyn_saveas(hh,[ dname '/graphs/forcst' int2str(n_fig)], options_.nodisplay, options_.graph_format);
|
||||
if options_.TeX && any(strcmp('eps', cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/forcst%d}\n',dname,n_fig);
|
||||
|
@ -78,16 +79,9 @@ for j= 1:nvar
|
|||
eval(['hh=dyn_figure(options_.nodisplay,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
|
||||
m = 1;
|
||||
end
|
||||
subplot(nr,nc,m);
|
||||
vn = deblank(endo_names(i_var(j),:));
|
||||
subplot(nr, nc, m);
|
||||
vn = endo_names{i_var(j)};
|
||||
obs = 0;
|
||||
% $$$ k = strmatch(vn,varobs,'exact');
|
||||
% $$$ if ~isempty(k)
|
||||
% $$$ yy = y.(vn)(end-9:end) + repmat(ys(i_var(j)),10,1)+trend(k,:)';
|
||||
% $$$ plot(yy);
|
||||
% $$$ hold on
|
||||
% $$$ obs = 10;
|
||||
% $$$ end
|
||||
plot([NaN(obs,1); yf.(vn)],'b-');
|
||||
hold on
|
||||
plot([NaN(obs,1); hpdinf.(vn)],'b-');
|
||||
|
|
|
@ -11,7 +11,7 @@ function formdata(fname,date)
|
|||
% SPECIAL REQUIREMENT
|
||||
% none
|
||||
|
||||
% Copyright (C) 2007-2017 Dynare Team
|
||||
% Copyright (C) 2007-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -31,11 +31,11 @@ function formdata(fname,date)
|
|||
global M_ oo_
|
||||
|
||||
fid = fopen([fname '_endo.frm'],'w');
|
||||
n=size(oo_.endo_simul,1);
|
||||
t=size(oo_.endo_simul,2);
|
||||
SN=upper(cellstr(M_.endo_names));
|
||||
for i=1:n
|
||||
str=char(SN(i));
|
||||
n = size(oo_.endo_simul, 1);
|
||||
t = size(oo_.endo_simul, 2);
|
||||
SN = upper(M_.endo_names);
|
||||
for i = 1:n
|
||||
str=SN{i};
|
||||
fprintf(fid,'USER: x x DATAFILE: x %s\n',str);
|
||||
fprintf(fid,'PER: 1 YEAR: %s FRAC: 1 NOBS: %d CLINES: 0 DLINES: ???\n',date,t);
|
||||
fprintf(fid,'%10.5f %10.5f %10.5f %10.5f\n',reshape(oo_.endo_simul(i,1:floor(t/4)*4),floor(t/4),4));
|
||||
|
@ -56,9 +56,9 @@ fclose(fid);
|
|||
fid = fopen([fname '_exo.frm'],'w');
|
||||
n=size(oo_.exo_simul,2);
|
||||
t=size(oo_.exo_simul,1);
|
||||
SN=upper(cellstr(M_.exo_names));
|
||||
SN=upper(M_.exo_names);
|
||||
for i=1:n
|
||||
str=char(SN(i));
|
||||
str = SN{i};
|
||||
fprintf(fid,'USER: x x DATAFILE: x %s\n',str);
|
||||
fprintf(fid,'PER: 1 YEAR: %s FRAC: 1 NOBS: %d CLINES: 0 DLINES: ???\n',date,t);
|
||||
fprintf(fid,'%10.5f %10.5f %10.5f %10.5f\n',reshape(oo_.exo_simul(1:floor(t/4)*4,i),floor(t/4),4));
|
||||
|
|
|
@ -11,7 +11,7 @@ function generate_trace_plots(chain_number)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2016 Dynare Team
|
||||
% Copyright (C) 2016-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -32,37 +32,37 @@ global M_ options_ estim_params_
|
|||
|
||||
|
||||
% Get informations about the posterior draws:
|
||||
MetropolisFolder = CheckPath('metropolis',M_.dname);
|
||||
MetropolisFolder = CheckPath('metropolis', M_.dname);
|
||||
load_last_mh_history_file(MetropolisFolder, M_.fname);
|
||||
if chain_number>record.Nblck
|
||||
error('generate_trace_plots:: chain number is bigger than existing number of chains')
|
||||
end
|
||||
|
||||
trace_plot(options_,M_,estim_params_,'PosteriorDensity',chain_number)
|
||||
trace_plot(options_, M_, estim_params_, 'PosteriorDensity', chain_number)
|
||||
|
||||
for ii=1:size(estim_params_.param_vals,1)
|
||||
parameter_name=deblank(M_.param_names(estim_params_.param_vals(ii,1),:));
|
||||
trace_plot(options_,M_,estim_params_,'DeepParameter',chain_number,parameter_name)
|
||||
for ii=1:size(estim_params_.param_vals, 1)
|
||||
parameter_name = M_.param_names{estim_params_.param_vals(ii,1)};
|
||||
trace_plot(options_, M_, estim_params_, 'DeepParameter', chain_number, parameter_name)
|
||||
end
|
||||
|
||||
for ii=1:size(estim_params_.var_exo,1)
|
||||
parameter_name=deblank(M_.exo_names(estim_params_.var_exo(ii,1),:));
|
||||
trace_plot(options_,M_,estim_params_,'StructuralShock',chain_number,parameter_name)
|
||||
for ii=1:size(estim_params_.var_exo, 1)
|
||||
parameter_name = M_.exo_names{estim_params_.var_exo(ii,1)};
|
||||
trace_plot(options_, M_, estim_params_, 'StructuralShock', chain_number, parameter_name)
|
||||
end
|
||||
|
||||
for ii=1:size(estim_params_.var_endo,1)
|
||||
parameter_name=deblank(M_.endo_names(estim_params_.var_endo(ii,1),:));
|
||||
trace_plot(options_,M_,estim_params_,'MeasurementError',chain_number,parameter_name)
|
||||
for ii=1:size(estim_params_.var_endo, 1)
|
||||
parameter_name = M_.endo_names{estim_params_.var_endo(ii,1)};
|
||||
trace_plot(options_, M_, estim_params_, 'MeasurementError', chain_number, parameter_name)
|
||||
end
|
||||
|
||||
for ii=1:size(estim_params_.corrn,1)
|
||||
parameter_name_1=deblank(M_.endo_names(estim_params_.corrn(ii,1),:));
|
||||
parameter_name_2=deblank(M_.endo_names(estim_params_.corrn(ii,2),:));
|
||||
trace_plot(options_,M_,estim_params_,'MeasurementError',chain_number,parameter_name_1,parameter_name_2)
|
||||
for ii=1:size(estim_params_.corrn, 1)
|
||||
parameter_name_1 = M_.endo_names{estim_params_.corrn(ii,1)};
|
||||
parameter_name_2 = M_.endo_names{estim_params_.corrn(ii,2)};
|
||||
trace_plot(options_, M_, estim_params_, 'MeasurementError', chain_number, parameter_name_1, parameter_name_2)
|
||||
end
|
||||
|
||||
for ii=1:size(estim_params_.corrx,1)
|
||||
parameter_name_1=deblank(M_.exo_names(estim_params_.corrx(ii,1),:));
|
||||
parameter_name_2=deblank(M_.exo_names(estim_params_.corrx(ii,2),:));
|
||||
trace_plot(options_,M_,estim_params_,'StructuralShock',chain_number,parameter_name_1,parameter_name_2)
|
||||
for ii=1:size(estim_params_.corrx, 1)
|
||||
parameter_name_1 = M_.exo_names{estim_params_.corrx(ii,1)};
|
||||
parameter_name_2 = M_.exo_names{estim_params_.corrx(ii,2)};
|
||||
trace_plot(options_, M_, estim_params_, 'StructuralShock', chain_number, parameter_name_1, parameter_name_2)
|
||||
end
|
|
@ -8,7 +8,7 @@ function irf_shocks_indx=getIrfShocksIndx()
|
|||
% Outputs:
|
||||
% irf_shocks_indx: [1 by n_irf_shocks] vector storing the indices
|
||||
%
|
||||
% Copyright (C) 2011-2017 Dynare Team
|
||||
% Copyright (C) 2011-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -32,7 +32,7 @@ if (isfield(options_,'irf_shocks')==0)
|
|||
else
|
||||
irf_shocks_indx = zeros(1,size(options_.irf_shocks,1));
|
||||
for i=1:size(options_.irf_shocks,1)
|
||||
irf_shocks_indx(i) = find(strcmp(deblank(options_.irf_shocks(i,:)), cellstr(M_.exo_names)));
|
||||
irf_shocks_indx(i) = find(strcmp(deblank(options_.irf_shocks(i,:)), M_.exo_names));
|
||||
end
|
||||
irf_shocks_indx_unique=unique(irf_shocks_indx);
|
||||
if options_.debug && (length(irf_shocks_indx_unique) ~= length(irf_shocks_indx))
|
||||
|
|
|
@ -13,7 +13,7 @@ function discount_factor=get_optimal_policy_discount_factor(params,param_names)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2007-2017 Dynare Team
|
||||
% Copyright (C) 2007-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -30,4 +30,4 @@ function discount_factor=get_optimal_policy_discount_factor(params,param_names)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
discount_factor = params(find(strcmp('optimal_policy_discount_factor',cellstr(param_names))));
|
||||
discount_factor = params(find(strcmp('optimal_policy_discount_factor', param_names)));
|
||||
|
|
|
@ -15,7 +15,7 @@ function xparam = get_posterior_parameters(type,M_,estim_params_,oo_,options_,fi
|
|||
% SPECIAL REQUIREMENTS
|
||||
% None.
|
||||
|
||||
% Copyright (C) 2006-2017 Dynare Team
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -46,7 +46,7 @@ xparam = zeros(nvx+nvn+ncx+ncn+np,1);
|
|||
m = 1;
|
||||
for i=1:nvx
|
||||
k1 = estim_params_.var_exo(i,1);
|
||||
name1 = deblank(M_.exo_names(k1,:));
|
||||
name1 = M_.exo_names{k1};
|
||||
xparam(m) = oo_.([field1 type]).shocks_std.(name1);
|
||||
m = m+1;
|
||||
end
|
||||
|
@ -61,8 +61,8 @@ end
|
|||
for i=1:ncx
|
||||
k1 = estim_params_.corrx(i,1);
|
||||
k2 = estim_params_.corrx(i,2);
|
||||
name1 = deblank(M_.exo_names(k1,:));
|
||||
name2 = deblank(M_.exo_names(k2,:));
|
||||
name1 = M_.exo_names{k1};
|
||||
name2 = M_.exo_names{k2};
|
||||
xparam(m) = oo_.([field1 type]).shocks_corr.([name1 '_' name2]);
|
||||
m = m+1;
|
||||
end
|
||||
|
@ -79,7 +79,7 @@ end
|
|||
FirstDeep = m;
|
||||
|
||||
for i=1:np
|
||||
name1 = deblank(M_.param_names(estim_params_.param_vals(i,1),:));
|
||||
name1 = M_.param_names{estim_params_.param_vals(i,1)};
|
||||
xparam(m) = oo_.([field1 type]).parameters.(name1);
|
||||
m = m+1;
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
function [nam,texnam] = get_the_name(k,TeX,M_,estim_params_,options_)
|
||||
function [nam, texnam] = get_the_name(k, TeX, M_, estim_params_, options_)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {[@var{nam},@var{texnam}] =} get_the_name (@var{k},@var{TeX},@var{M_},@var{estim_params_},@var{options_})
|
||||
|
@ -40,7 +40,7 @@ function [nam,texnam] = get_the_name(k,TeX,M_,estim_params_,options_)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2004-2013 Dynare Team
|
||||
% Copyright (C) 2004-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -66,44 +66,44 @@ ncx = estim_params_.ncx;
|
|||
ncn = estim_params_.ncn;
|
||||
|
||||
if k <= nvx
|
||||
vname = deblank(M_.exo_names(estim_params_.var_exo(k,1),:));
|
||||
nam = ['SE_',vname];
|
||||
vname = M_.exo_names{estim_params_.var_exo(k,1)};
|
||||
nam = sprintf('SE_%s', vname);
|
||||
if TeX
|
||||
tname = deblank(M_.exo_names_tex(estim_params_.var_exo(k,1),:));
|
||||
texnam = ['$ SE_{' tname '} $'];
|
||||
tname = M_.exo_names_tex{estim_params_.var_exo(k,1)};
|
||||
texnam = sprintf('$ SE_{%s} $', tname);
|
||||
end
|
||||
elseif k <= (nvx+nvn)
|
||||
vname = options_.varobs{estim_params_.nvn_observable_correspondence(k-estim_params_.nvx,1)};
|
||||
nam=['SE_EOBS_',vname];
|
||||
nam = sprintf('SE_EOBS_%s', vname);
|
||||
if TeX
|
||||
tname = deblank(M_.endo_names_tex(estim_params_.var_endo(k-estim_params_.nvx,1),:));
|
||||
texnam = ['$ EOBS SE_{' tname '} $'];
|
||||
tname = M_.endo_names_tex{estim_params_.var_endo(k-estim_params_.nvx,1)};
|
||||
texnam = sprintf('$ EOBS SE_{%s} $', tname);
|
||||
end
|
||||
elseif k <= (nvx+nvn+ncx)
|
||||
jj = k - (nvx+nvn);
|
||||
k1 = estim_params_.corrx(jj,1);
|
||||
k2 = estim_params_.corrx(jj,2);
|
||||
vname = [deblank(M_.exo_names(k1,:)) '_' deblank(M_.exo_names(k2,:))];
|
||||
nam=['CC_',vname];
|
||||
vname = sprintf('%s_%s', M_.exo_names{k1}, M_.exo_names{k2});
|
||||
nam = sprintf('CC_%s', vname);
|
||||
if TeX
|
||||
tname = [deblank(M_.exo_names_tex(k1,:)) ',' deblank(M_.exo_names_tex(k2,:))];
|
||||
texnam = ['$ CC_{' tname '} $'];
|
||||
tname = sprintf('%s,%s', M_.exo_names_tex{k1}, M_.exo_names_tex{k2});
|
||||
texnam = sprintf('$ CC_{%s} $', tname);
|
||||
end
|
||||
elseif k <= (nvx+nvn+ncx+ncn)
|
||||
jj = k - (nvx+nvn+ncx);
|
||||
k1 = estim_params_.corrn(jj,1);
|
||||
k2 = estim_params_.corrn(jj,2);
|
||||
vname = [deblank(M_.endo_names(k1,:)) '_' deblank(M_.endo_names(k2,:))];
|
||||
nam=['CC_EOBS_' vname];
|
||||
vname = sprintf('%s_%s', M_.endo_names{k1}, M_.endo_names{k2});
|
||||
nam = sprintf('CC_EOBS_%s', vname);
|
||||
if TeX
|
||||
tname = [deblank(M_.endo_names_tex(k1,:)) ',' deblank(M_.endo_names_tex(k2,:))];
|
||||
texnam =['$ EOBS CC_{' tname '} $'];
|
||||
tname = sprintf('%s,%s', M_.endo_names_tex{k1}, M_.endo_names_tex{k2});
|
||||
texnam = sprintf('$ EOBS CC_{%s} $', tname);
|
||||
end
|
||||
else
|
||||
jj = k - (nvx+nvn+ncx+ncn);
|
||||
jj1 = estim_params_.param_vals(jj,1);
|
||||
nam = deblank(M_.param_names(jj1,:));
|
||||
nam = M_.param_names{jj1};
|
||||
if TeX
|
||||
texnam = ['$ ' deblank(M_.param_names_tex(jj1,:)) ' $'];
|
||||
texnam = sprintf('$ %s $', M_.param_names_tex{jj1});
|
||||
end
|
||||
end
|
|
@ -1,14 +1,16 @@
|
|||
function [ivar,vartan,options_] = get_variables_list(options_,M_)
|
||||
function [ivar, vartan, options_] = get_variables_list(options_, M_)
|
||||
|
||||
% This function builds a vector of indices in varlist or varobs.
|
||||
%
|
||||
% INPUTS
|
||||
% o options_ [structure] Describes global options.
|
||||
% o M_ [structure] Describes the model.
|
||||
% o options_ [structure] Describes global options.
|
||||
% o M_ [structure] Describes the model.
|
||||
%
|
||||
% OUTPUTS
|
||||
% o ivar [integer] nvar*1 vector of indices (nvar is the number
|
||||
% of variables).
|
||||
% o vartan [char] array of characters (with nvar rows).
|
||||
% o options_ [structure] Describes global options.
|
||||
% o ivar [integer] nvar*1 vector of indices (nvar is the number
|
||||
% of variables).
|
||||
% o vartan [cell of char arrays] array of characters (with nvar rows).
|
||||
% o options_ [structure] Describes global options.
|
||||
%
|
||||
% ALGORITHM
|
||||
% None.
|
||||
|
@ -16,7 +18,7 @@ function [ivar,vartan,options_] = get_variables_list(options_,M_)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% None.
|
||||
|
||||
% Copyright (C) 2007-2017 Dynare Team
|
||||
% Copyright (C) 2007-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -35,13 +37,12 @@ function [ivar,vartan,options_] = get_variables_list(options_,M_)
|
|||
|
||||
varlist = options_.varlist;
|
||||
if isempty(varlist)
|
||||
varlist = char(options_.varobs);
|
||||
varlist = options_.varobs;
|
||||
options_.varlist = varlist;
|
||||
end
|
||||
nvar = rows(varlist);
|
||||
nvar = length(varlist);
|
||||
vartan = varlist;
|
||||
nvar = size(vartan,1);
|
||||
ivar = zeros(nvar,1);
|
||||
for i = 1:nvar
|
||||
ivar(i) = strmatch(deblank(vartan(i,:)),M_.endo_names,'exact');
|
||||
ivar(i) = strmatch(vartan{i}, M_.endo_names, 'exact');
|
||||
end
|
|
@ -11,7 +11,7 @@ function global_initialization()
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -678,7 +678,7 @@ options_.particleswarm = particleswarm;
|
|||
|
||||
% prior analysis
|
||||
options_.prior_mc = 20000;
|
||||
options_.prior_analysis_endo_var_list = [];
|
||||
options_.prior_analysis_endo_var_list = {};
|
||||
|
||||
% did model undergo block decomposition + minimum feedback set computation ?
|
||||
options_.block = 0;
|
||||
|
|
|
@ -11,7 +11,7 @@ function []=graph_decomp(z,shock_names,endo_names,i_var,initial_date,DynareModel
|
|||
% DynareModel [structure] Dynare model structure
|
||||
% DynareOptions [structure] Dynare options structure
|
||||
|
||||
% Copyright (C) 2010-2017 Dynare Team
|
||||
% Copyright (C) 2010-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -109,7 +109,7 @@ for j=1:nvar
|
|||
z1 = squeeze(z(i_var(j),:,:));
|
||||
if screen_shocks
|
||||
[junk, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend');
|
||||
labels = char(char(shock_names(isort(1:16),:)),'Others', 'Initial values');
|
||||
labels = char(char(shock_names(isort(1:16))),'Others', 'Initial values');
|
||||
zres = sum(z1(isort(17:end),:),1);
|
||||
z1 = [z1(isort(1:16),:); zres; z1(comp_nbr0:end,:)];
|
||||
comp_nbr=18;
|
||||
|
@ -128,7 +128,7 @@ for j=1:nvar
|
|||
if ymax-ymin < 1e-6
|
||||
continue
|
||||
end
|
||||
fhandle = dyn_figure(DynareOptions.plot_shock_decomp.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) '.'], 'PaperPositionMode', 'auto','PaperOrientation','landscape','renderermode','auto');
|
||||
fhandle = dyn_figure(DynareOptions.plot_shock_decomp.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' endo_names{i_var(j)} '.'], 'PaperPositionMode', 'auto','PaperOrientation','landscape','renderermode','auto');
|
||||
set(fhandle,'position' ,[50 50 1500 750])
|
||||
ax=axes('Position',[0.1 0.1 0.6 0.8],'box','on');
|
||||
% plot(ax,x(2:end),z1(end,:),'k-','LineWidth',2)
|
||||
|
@ -213,13 +213,13 @@ for j=1:nvar
|
|||
colormap(new_colormap)
|
||||
end
|
||||
hold off
|
||||
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
|
||||
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',endo_names{i_var(j)},fig_mode1,fig_name],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
|
||||
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_name]);
|
||||
fprintf(fidTeX,'\\label{Fig:shock_decomp:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_name]);
|
||||
fprintf(fidTeX,['\\caption{' preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': $ %s $.}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
|
||||
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[endo_names{i_var(j)} fig_mode1 fig_name]);
|
||||
fprintf(fidTeX,'\\label{Fig:shock_decomp:%s}\n',[fig_mode endo_names{i_var(j)} fig_name]);
|
||||
fprintf(fidTeX,['\\caption{' preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': $ %s $.}\n'],DynareModel.endo_names_tex{i_var(j)});
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
fprintf(fidTeX,' \n');
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ function []=graph_decomp_detail(z,shock_names,endo_names,i_var,initial_date,Dyna
|
|||
% DynareModel [structure] Dynare model structure
|
||||
% DynareOptions [structure] Dynare options structure
|
||||
|
||||
% Copyright (C) 2010-2017 Dynare Team
|
||||
% Copyright (C) 2010-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -133,7 +133,7 @@ for j=1:nvar
|
|||
z1 = squeeze(z(i_var(j),:,:));
|
||||
if screen_shocks,
|
||||
[junk, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend');
|
||||
labels = char(char(shock_names(isort(1:16),:)),'Others', 'Initial values');
|
||||
labels = char(char(shock_names(isort(1:16))),'Others', 'Initial values');
|
||||
zres = sum(z1(isort(17:end),:),1);
|
||||
z1 = [z1(isort(1:16),:); zres; z1(comp_nbr0:end,:)];
|
||||
comp_nbr=18;
|
||||
|
@ -151,7 +151,7 @@ for j=1:nvar
|
|||
continue
|
||||
end
|
||||
for jf = 1:nfigs
|
||||
fhandle = dyn_figure(DynareOptions.plot_shock_decomp.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) ' (detail).'],'position',[200 100 650 850], 'PaperPositionMode', 'auto','PaperOrientation','portrait','renderermode','auto');
|
||||
fhandle = dyn_figure(DynareOptions.plot_shock_decomp.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' endo_names{i_var(j)} ' (detail).'],'position',[200 100 650 850], 'PaperPositionMode', 'auto','PaperOrientation','portrait','renderermode','auto');
|
||||
a0=zeros(1,4);
|
||||
a0(3)=inf;
|
||||
a0(4)=-inf;
|
||||
|
@ -183,7 +183,7 @@ for j=1:nvar
|
|||
mydata.use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
|
||||
mydata.shock_group = shock_groups.(shock_ind{ic});
|
||||
mydata.shock_decomp = DynareOptions.plot_shock_decomp;
|
||||
if ~isempty(mydata.shock_group.shocks{1})
|
||||
if ~isempty(mydata.shock_group.shocks)
|
||||
c = uicontextmenu;
|
||||
hax.UIContextMenu=c;
|
||||
browse_menu = uimenu(c,'Label','Browse group');
|
||||
|
@ -224,13 +224,14 @@ for j=1:nvar
|
|||
else
|
||||
suffix = ['_detail'];
|
||||
end
|
||||
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name suffix],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
|
||||
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname, ...
|
||||
'_shock_decomposition_', endo_names{i_var(j)}, fig_mode1,fig_name suffix],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
|
||||
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_name suffix]);
|
||||
fprintf(fidTeX,'\\label{Fig:shock_decomp_detail:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_name suffix]);
|
||||
fprintf(fidTeX,['\\caption{' preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': $ %s $ (detail).}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
|
||||
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[endo_names{i_var(j)} fig_mode1 fig_name suffix]);
|
||||
fprintf(fidTeX,'\\label{Fig:shock_decomp_detail:%s}\n',[fig_mode endo_names{i_var(j)} fig_name suffix]);
|
||||
fprintf(fidTeX,['\\caption{' preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': $ %s $ (detail).}\n'], DynareModel.endo_names_tex{i_var(j)});
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
fprintf(fidTeX,' \n');
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ function [rmse_MC, ixx] = filt_mc_(OutDir,options_gsa_,dataset_,dataset_info)
|
|||
% marco.ratto@ec.europa.eu
|
||||
|
||||
% Copyright (C) 2012-2016 European Commission
|
||||
% Copyright (C) 2012-2017 Dynare Team
|
||||
% Copyright (C) 2012-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -38,12 +38,11 @@ vvarvecm = options_gsa_.var_rmse;
|
|||
if options_.TeX
|
||||
vvarvecm_tex = options_gsa_.var_rmse_tex;
|
||||
else
|
||||
vvarvecm_tex = [];
|
||||
vvarvecm_tex = {};
|
||||
end
|
||||
loadSA = options_gsa_.load_rmse;
|
||||
pfilt = options_gsa_.pfilt_rmse;
|
||||
alpha = options_gsa_.alpha_rmse;
|
||||
% alpha2 = options_gsa_.alpha2_rmse;
|
||||
alpha2 = 0;
|
||||
pvalue = options_gsa_.alpha2_rmse;
|
||||
istart = max(2,options_gsa_.istart_rmse);
|
||||
|
@ -133,7 +132,6 @@ if ~loadSA
|
|||
M_ = set_all_parameters(xparam1_mean,estim_params_,M_);
|
||||
ys_mean=steady_(M_,options_,oo_);
|
||||
end
|
||||
% eval(options_.datafile)
|
||||
Y = transpose(dataset_.data);
|
||||
gend = dataset_.nobs;
|
||||
data_index = dataset_info.missing.aindex;
|
||||
|
@ -141,8 +139,6 @@ if ~loadSA
|
|||
for jx=1:gend
|
||||
data_indx(jx,data_index{jx})=true;
|
||||
end
|
||||
%stock_gend=data_info.gend;
|
||||
%stock_data = data_info.data;
|
||||
load([DirectoryName filesep M_.fname '_data.mat']);
|
||||
filfilt = dir([DirectoryName filesep M_.fname '_filter_step_ahead*.mat']);
|
||||
temp_smooth_file_list = dir([DirectoryName filesep M_.fname '_smooth*.mat']);
|
||||
|
@ -159,7 +155,6 @@ if ~loadSA
|
|||
logpo2=[];
|
||||
sto_ys=[];
|
||||
for j=1:length(filparam)
|
||||
%load([DirectoryName filesep M_.fname '_param',int2str(j),'.mat']);
|
||||
if isempty(strmatch([M_.fname '_param_irf'],filparam(j).name))
|
||||
load([DirectoryName filesep filparam(j).name]);
|
||||
x=[x; stock];
|
||||
|
@ -173,11 +168,10 @@ if ~loadSA
|
|||
if options_.opt_gsa.ppost || (options_.opt_gsa.ppost==0 && options_.opt_gsa.lik_only==0)
|
||||
skipline()
|
||||
disp('Computing RMSE''s...')
|
||||
for i=1:size(vvarvecm,1)
|
||||
vj=deblank(vvarvecm(i,:));
|
||||
|
||||
jxj(i) = strmatch(vj,lgy_(dr_.order_var,:),'exact');
|
||||
js(i) = strmatch(vj,lgy_,'exact');
|
||||
for i = 1:length(vvarvecm)
|
||||
vj = vvarvecm{i};
|
||||
jxj(i) = strmatch(vj, lgy_(dr_.order_var), 'exact');
|
||||
js(i) = strmatch(vj, lgy_, 'exact');
|
||||
yss(i,:,:)=repmat(sto_ys(:,js(i))',[gend,1]);
|
||||
end
|
||||
if exist('xparam1','var')
|
||||
|
@ -213,7 +207,6 @@ if ~loadSA
|
|||
r2_MC(j,:) = 1-mean((yobs(:,istart:end,j)'-y0(:,istart:end,j)').^2)./mean((yobs(:,istart:end,j)').^2);
|
||||
end
|
||||
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,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_);
|
||||
y0 = reshape( squeeze(aK(1,jxj,1:gend)),[gend length(jxj)]);% + kron(ys_mean(js),ones(1,gend)));
|
||||
yobs = transpose( ahat(jxj,:));% + kron(ys_mean(js),ones(1,gend)));
|
||||
|
@ -260,14 +253,14 @@ else
|
|||
nfilt=floor(pfilt*nruns);
|
||||
end
|
||||
% smirnov tests
|
||||
nfilt0=nfilt*ones(size(vvarvecm,1),1);
|
||||
nfilt0 = nfilt*ones(length(vvarvecm), 1);
|
||||
logpo2=logpo2(:);
|
||||
if ~options_.opt_gsa.ppost
|
||||
[dum, ipost]=sort(-logpo2);
|
||||
[dum, ilik]=sort(-likelihood);
|
||||
end
|
||||
|
||||
%% visual scatter analysis!
|
||||
% visual scatter analysis!
|
||||
if options_.opt_gsa.ppost
|
||||
tmp_title='R2 Posterior:';
|
||||
atitle='R2 Posterior:';
|
||||
|
@ -291,8 +284,7 @@ options_scatter.amcf_name = asname;
|
|||
options_scatter.amcf_title = atitle;
|
||||
options_scatter.title = tmp_title;
|
||||
scatter_analysis(r2_MC, x,options_scatter, options_);
|
||||
%% end of visual scatter analysis
|
||||
|
||||
% end of visual scatter analysis
|
||||
|
||||
if ~options_.opt_gsa.ppost && options_.opt_gsa.lik_only
|
||||
if options_.opt_gsa.pprior
|
||||
|
@ -307,12 +299,12 @@ if ~options_.opt_gsa.ppost && options_.opt_gsa.lik_only
|
|||
options_mcf.alpha2 = alpha2;
|
||||
if options_.TeX
|
||||
[pnames,pnames_tex]=get_LaTeX_parameter_names(M_,options_,estim_params_,bayestopt_);
|
||||
options_mcf.param_names = char(pnames);
|
||||
options_mcf.param_names_tex = char(pnames_tex);
|
||||
options_mcf.param_names = pnames;
|
||||
options_mcf.param_names_tex = pnames_tex;
|
||||
else
|
||||
[pnames]=get_LaTeX_parameter_names(M_,options_,estim_params_,bayestopt_);
|
||||
options_mcf.param_names = char(pnames);
|
||||
options_mcf.param_names_tex = [];
|
||||
options_mcf.param_names = pnames;
|
||||
options_mcf.param_names_tex = {};
|
||||
end
|
||||
options_mcf.fname_ = fname_;
|
||||
options_mcf.OutputDirectoryName = OutDir;
|
||||
|
@ -322,7 +314,6 @@ if ~options_.opt_gsa.ppost && options_.opt_gsa.lik_only
|
|||
options_mcf.beha_title = 'better posterior kernel';
|
||||
options_mcf.nobeha_title = 'worse posterior kernel';
|
||||
mcf_analysis(x, ipost(1:nfilt), ipost(nfilt+1:end), options_mcf, options_);
|
||||
|
||||
if options_.opt_gsa.pprior
|
||||
anam = 'rmse_prior_lik';
|
||||
atitle = 'RMSE prior: Log Likelihood Kernel';
|
||||
|
@ -351,22 +342,21 @@ else
|
|||
r2_txt=NaN(1,size(r2_MC,2));
|
||||
end
|
||||
else
|
||||
%nfilt0(i)=length(find(rmse_MC(:,i)<rmse_pmean(i)));
|
||||
rmse_txt=rmse_pmean;
|
||||
r2_txt=r2_pmean;
|
||||
end
|
||||
end
|
||||
for i=1:size(vvarvecm,1)
|
||||
[dum, ixx(:,i)]=sort(rmse_MC(:,i));
|
||||
for i = 1:length(vvarvecm)
|
||||
[dum, ixx(:,i)] = sort(rmse_MC(:,i));
|
||||
end
|
||||
PP=ones(npar+nshock,size(vvarvecm,1));
|
||||
PPV=ones(size(vvarvecm,1),size(vvarvecm,1),npar+nshock);
|
||||
SS=zeros(npar+nshock,size(vvarvecm,1));
|
||||
for j=1:npar+nshock
|
||||
for i=1:size(vvarvecm,1)
|
||||
[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);
|
||||
PP = ones(npar+nshock, length(vvarvecm));
|
||||
PPV = ones(length(vvarvecm), length(vvarvecm), npar+nshock);
|
||||
SS = zeros(npar+nshock, length(vvarvecm));
|
||||
for j = 1:npar+nshock
|
||||
for i = 1:length(vvarvecm)
|
||||
[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);
|
||||
if H1 & H2==0
|
||||
SS(j,i)=1;
|
||||
elseif H1==0
|
||||
|
@ -376,17 +366,11 @@ else
|
|||
end
|
||||
PP(j,i)=P;
|
||||
end
|
||||
for i=1:size(vvarvecm,1)
|
||||
for l=1:size(vvarvecm,1)
|
||||
for i = 1:length(vvarvecm)
|
||||
for l = 1:length(vvarvecm)
|
||||
if l~=i && PP(j,i)<alpha && PP(j,l)<alpha
|
||||
[H,P,KSSTAT] = smirnov(x(ixx(1:nfilt0(i),i),j),x(ixx(1:nfilt0(l),l),j), alpha);
|
||||
%[H1,P1,KSSTAT1] = smirnov(x(ixx(1:nfilt0(i),i),j),x(:,j), alpha);
|
||||
% PP(j,i)=min(P,PP(j,i));
|
||||
% PP(j,l)=min(P,PP(j,l));
|
||||
%if P<P1
|
||||
% if SS(j,i)*SS(j,l)
|
||||
PPV(i,l,j) = P;
|
||||
% end
|
||||
elseif l==i
|
||||
PPV(i,l,j) = PP(j,i);
|
||||
end
|
||||
|
@ -395,7 +379,7 @@ else
|
|||
end
|
||||
if ~options_.nograph
|
||||
ifig=0;
|
||||
for i=1:size(vvarvecm,1)
|
||||
for i=1:length(vvarvecm)
|
||||
if options_.opt_gsa.ppost
|
||||
temp_name='RMSE Posterior: Log Prior';
|
||||
else
|
||||
|
@ -416,8 +400,8 @@ else
|
|||
set(h,'color','k','linewidth',1)
|
||||
h=cumplot(lnprior(ixx(nfilt0(i)+1:end,i)));
|
||||
set(h,'color','red','linewidth',2)
|
||||
title(vvarvecm(i,:),'interpreter','none')
|
||||
if mod(i,9)==0 || i==size(vvarvecm,1)
|
||||
title(vvarvecm{i},'interpreter','none')
|
||||
if mod(i,9)==0 || i==length(vvarvecm)
|
||||
if ~isoctave
|
||||
annotation('textbox', [0.1,0,0.35,0.05],'String', 'Log-prior for BETTER R2','Color','Blue','horizontalalignment','center');
|
||||
annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-prior for WORSE R2', 'Color','Red','horizontalalignment','center');
|
||||
|
@ -443,7 +427,7 @@ else
|
|||
end
|
||||
end
|
||||
ifig=0;
|
||||
for i=1:size(vvarvecm,1)
|
||||
for i=1:length(vvarvecm)
|
||||
if options_.opt_gsa.ppost
|
||||
temp_name='RMSE Posterior: Log Likelihood';
|
||||
else
|
||||
|
@ -464,11 +448,11 @@ else
|
|||
set(h,'color','k','linewidth',1)
|
||||
h=cumplot(likelihood(ixx(nfilt0(i)+1:end,i)));
|
||||
set(h,'color','red','linewidth',2)
|
||||
title(vvarvecm(i,:),'interpreter','none')
|
||||
title(vvarvecm{i},'interpreter','none')
|
||||
if options_.opt_gsa.ppost==0
|
||||
set(gca,'xlim',[min( likelihood(ixx(1:nfilt0(i),i)) ) max( likelihood(ixx(1:nfilt0(i),i)) )])
|
||||
end
|
||||
if mod(i,9)==0 || i==size(vvarvecm,1)
|
||||
if mod(i,9)==0 || i==length(vvarvecm)
|
||||
if ~isoctave
|
||||
annotation('textbox', [0.1,0,0.35,0.05],'String', 'Log-likelihood for BETTER R2','Color','Blue','horizontalalignment','center');
|
||||
annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-likelihood for WORSE R2', 'Color','Red','horizontalalignment','center');
|
||||
|
@ -494,7 +478,7 @@ else
|
|||
end
|
||||
end
|
||||
ifig=0;
|
||||
for i=1:size(vvarvecm,1)
|
||||
for i=1:length(vvarvecm)
|
||||
if options_.opt_gsa.ppost
|
||||
temp_name='RMSE Posterior: Log Posterior';
|
||||
else
|
||||
|
@ -515,11 +499,11 @@ else
|
|||
set(h,'color','k','linewidth',1)
|
||||
h=cumplot(logpo2(ixx(nfilt0(i)+1:end,i)));
|
||||
set(h,'color','red','linewidth',2)
|
||||
title(vvarvecm(i,:),'interpreter','none')
|
||||
title(vvarvecm{i},'interpreter','none')
|
||||
if options_.opt_gsa.ppost==0
|
||||
set(gca,'xlim',[min( logpo2(ixx(1:nfilt0(i),i)) ) max( logpo2(ixx(1:nfilt0(i),i)) )])
|
||||
end
|
||||
if mod(i,9)==0 || i==size(vvarvecm,1)
|
||||
if mod(i,9)==0 || i==length(vvarvecm)
|
||||
if ~isoctave
|
||||
annotation('textbox', [0.1,0,0.35,0.05],'String', 'Log-posterior for BETTER R2','Color','Blue','horizontalalignment','center');
|
||||
annotation('textbox', [0.55,0,0.35,0.05],'String', 'Log-posterior for WORSE R2', 'Color','Red','horizontalalignment','center');
|
||||
|
@ -545,64 +529,50 @@ else
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
if options_.TeX
|
||||
[pnames,pnames_tex]=get_LaTeX_parameter_names(M_,options_,estim_params_,bayestopt_);
|
||||
param_names = char(pnames);
|
||||
param_names_tex = char(pnames_tex);
|
||||
param_names = pnames;
|
||||
param_names_tex = pnames_tex;
|
||||
else
|
||||
[pnames]=get_LaTeX_parameter_names(M_,options_,estim_params_,bayestopt_);
|
||||
param_names = char(pnames);
|
||||
param_names_tex = [];
|
||||
param_names = pnames;
|
||||
param_names_tex = {};
|
||||
end
|
||||
|
||||
|
||||
skipline()
|
||||
title_string='RMSE over the MC sample:';
|
||||
data_mat=[min(rmse_MC)' max(rmse_MC)'];
|
||||
headers=strvcat('Variable','min yr RMSE','max yr RMSE');
|
||||
dyntable(options_,title_string,headers,vvarvecm,data_mat, 0, 15, 5);
|
||||
headers={'Variable'; 'min yr RMSE'; 'max yr RMSE'};
|
||||
dyntable(options_, title_string, headers, vvarvecm, data_mat, 0, 15, 5);
|
||||
if options_.TeX
|
||||
headers_tex=strvcat('\text{Variable}','\text{min yr RMSE}','\text{max yr RMSE}');
|
||||
dyn_latex_table(M_,options_,title_string,'RMSE_MC',headers_tex,vvarvecm_tex,data_mat,0,15,5);
|
||||
headers_tex = {'\text{Variable}'; '\text{min yr RMSE}'; '\text{max yr RMSE}'};
|
||||
dyn_latex_table(M_, options_, title_string, 'RMSE_MC', headers_tex, vvarvecm_tex, data_mat, 0, 15, 5);
|
||||
end
|
||||
|
||||
invar = find( std(rmse_MC)./mean(rmse_MC)<=0.0001 );
|
||||
if ~isempty(invar)
|
||||
skipline(2)
|
||||
disp('RMSE is not varying significantly over the MC sample for the following variables:')
|
||||
disp(vvarvecm(invar,:))
|
||||
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
|
||||
vvarvecm0=vvarvecm;
|
||||
|
||||
ivar = find( std(rmse_MC)./mean(rmse_MC)>0.0001 );
|
||||
vvarvecm=vvarvecm(ivar,:);
|
||||
rmse_MC=rmse_MC(:,ivar);
|
||||
|
||||
vvarvecm = vvarvecm(ivar);
|
||||
rmse_MC = rmse_MC(:,ivar);
|
||||
skipline()
|
||||
% if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior,
|
||||
disp(['Sample filtered the ',num2str(pfilt*100),'% best RMSE''s for each observed series ...' ])
|
||||
% else
|
||||
% disp(['Sample filtered the best RMSE''s smaller than RMSE at the posterior mean ...' ])
|
||||
% end
|
||||
% figure, boxplot(rmse_MC)
|
||||
% set(gca,'xticklabel',vvarvecm)
|
||||
% saveas(gcf,[fname_,'_SA_RMSE'])
|
||||
|
||||
skipline(2)
|
||||
disp('RMSE ranges after filtering:')
|
||||
title_string='RMSE ranges after filtering:';
|
||||
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
|
||||
headers=strvcat('Variable','min','max','min','max','posterior mode');
|
||||
headers_tex=strvcat('\text{Variable}','\text{min}','\text{max}','\text{min}','\text{max}','\text{posterior mode}');
|
||||
headers = {'Variable'; 'min'; 'max'; 'min'; 'max'; 'posterior mode'};
|
||||
headers_tex = {'\text{Variable}'; '\text{min}'; '\text{max}'; '\text{min}'; '\text{max}'; '\text{posterior mode}'};
|
||||
else
|
||||
headers=strvcat('Variable','min','max','min','max','posterior mean');
|
||||
headers_tex=strvcat('\text{Variable}','\text{min}','\text{max}','\text{min}','\text{max}','\text{posterior mean}');
|
||||
headers = {'Variable'; 'min'; 'max'; 'min'; 'max'; 'posterior mean'};
|
||||
headers_tex = {'\text{Variable}'; '\text{min}'; '\text{max}'; '\text{min}'; '\text{max}'; '\text{posterior mean}'};
|
||||
end
|
||||
data_mat=NaN(size(vvarvecm,1),5);
|
||||
for j=1:size(vvarvecm,1)
|
||||
data_mat=NaN(length(vvarvecm),5);
|
||||
for j = 1:length(vvarvecm)
|
||||
data_mat(j,:)=[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)) ...
|
||||
|
@ -610,10 +580,10 @@ else
|
|||
rmse_txt(j)];
|
||||
end
|
||||
%get formatting for additional header line
|
||||
val_width=15;
|
||||
val_precis=5;
|
||||
label_width = max(size(deblank(char(headers(1,:),vvarvecm)),2)+2,0);
|
||||
label_format_leftbound = sprintf('%%-%ds',label_width);
|
||||
val_width = 15;
|
||||
val_precis = 5;
|
||||
label_width = max(cellofchararraymaxlength(vertcat(headers{1}, vvarvecm))+2, 0);
|
||||
label_format_leftbound = sprintf('%%-%ds', label_width);
|
||||
if all(~isfinite(data_mat))
|
||||
values_length = 4;
|
||||
else
|
||||
|
@ -622,61 +592,55 @@ else
|
|||
if any(data_mat) < 0 %add one character for minus sign
|
||||
values_length = values_length+1;
|
||||
end
|
||||
|
||||
headers_length = max(size(deblank(headers(2:end,:)),2));
|
||||
headers_length = cellofchararraymaxlength(headers(2:end));
|
||||
if ~isempty(val_width)
|
||||
val_width = max(max(headers_length,values_length)+2,val_width);
|
||||
val_width = max(max(headers_length,values_length)+2, val_width);
|
||||
else
|
||||
val_width = max(headers_length,values_length)+2;
|
||||
val_width = max(headers_length, values_length)+2;
|
||||
end
|
||||
value_format = sprintf('%%%d.%df',val_width,val_precis);
|
||||
header_string_format = sprintf('%%%ds',val_width);
|
||||
|
||||
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
|
||||
optional_header=sprintf([label_format_leftbound,header_string_format,header_string_format,header_string_format,header_string_format],'','',['best ',num2str(pfilt*100),'% filtered'],'','remaining 90%');
|
||||
else
|
||||
optional_header=sprintf([label_format_leftbound,header_string_format,header_string_format,header_string_format,header_string_format],'','','best filtered','','remaining');
|
||||
end
|
||||
dyntable(options_,title_string,headers,vvarvecm,data_mat, 0, val_width, val_precis,optional_header);
|
||||
dyntable(options_, title_string, headers, vvarvecm, data_mat, 0, val_width, val_precis,optional_header);
|
||||
if options_.TeX
|
||||
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
|
||||
optional_header={[' & \multicolumn{2}{c}{best ',num2str(pfilt*100),' filtered} & \multicolumn{2}{c}{remaining 90\%}\\']};
|
||||
else
|
||||
optional_header={[' & \multicolumn{2}{c}{best filtered} & \multicolumn{2}{c}{remaining}\\']};
|
||||
end
|
||||
dyn_latex_table(M_,options_,title_string,'RMSE_ranges_after_filtering',headers_tex,vvarvecm_tex,data_mat,0,val_width,val_precis,optional_header);
|
||||
dyn_latex_table(M_, options_, title_string, 'RMSE_ranges_after_filtering', headers_tex, vvarvecm_tex, data_mat, 0, val_width, val_precis, optional_header);
|
||||
end
|
||||
|
||||
%%%%% R2 table
|
||||
% R2 table
|
||||
vvarvecm=vvarvecm0;
|
||||
skipline()
|
||||
title_string='R2 over the MC sample:';
|
||||
data_mat=[min(r2_MC)' max(r2_MC)'];
|
||||
headers=strvcat('Variable','min yr R2','max yr R2');
|
||||
dyntable(options_,title_string,headers,vvarvecm,data_mat, 0, 15, 5);
|
||||
headers = {'Variable'; 'min yr R2'; 'max yr R2'};
|
||||
dyntable(options_, title_string, headers, vvarvecm, data_mat, 0, 15, 5);
|
||||
if options_.TeX
|
||||
headers_tex=strvcat('\text{Variable}','\text{min yr R2}','\text{max yr R2}');
|
||||
dyn_latex_table(M_,options_,title_string,'R2_MC',headers_tex,vvarvecm_tex,data_mat,0,15,5);
|
||||
headers_tex = {'\text{Variable}'; '\text{min yr R2}'; '\text{max yr R2}'};
|
||||
dyn_latex_table(M_, options_, title_string, 'R2_MC', headers_tex, vvarvecm_tex, data_mat, 0, 15, 5);
|
||||
end
|
||||
|
||||
r2_MC=r2_MC(:,ivar);
|
||||
vvarvecm=vvarvecm(ivar,:);
|
||||
|
||||
vvarvecm=vvarvecm(ivar);
|
||||
skipline()
|
||||
disp(['Sample filtered the ',num2str(pfilt*100),'% best R2''s for each observed series ...' ])
|
||||
|
||||
skipline()
|
||||
disp('R2 ranges after filtering:')
|
||||
title_string='R2 ranges after filtering:';
|
||||
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
|
||||
headers=strvcat('Variable','min','max','min','max','posterior mode');
|
||||
headers_tex=strvcat('\text{Variable}','\text{min}','\text{max}','\text{min}','\text{max}','\text{posterior mode}');
|
||||
headers = {'Variable'; 'min'; 'max'; 'min'; 'max'; 'posterior mode'};
|
||||
headers_tex = {'\text{Variable}'; '\text{min}'; '\text{max}'; '\text{min}'; '\text{max}'; '\text{posterior mode}'};
|
||||
else
|
||||
headers=strvcat('Variable','min','max','min','max','posterior mean');
|
||||
headers_tex=strvcat('\text{Variable}','\text{min}','\text{max}','\text{min}','\text{max}','\text{posterior mean}');
|
||||
headers = {'Variable'; 'min'; 'max'; 'min'; 'max'; 'posterior mean'};
|
||||
headers_tex = {'\text{Variable}'; '\text{min}'; '\text{max}'; '\text{min}'; '\text{max}'; '\text{posterior mean}'};
|
||||
end
|
||||
data_mat=NaN(size(vvarvecm,1),5);
|
||||
for j=1:size(vvarvecm,1)
|
||||
data_mat=NaN(length(vvarvecm),5);
|
||||
for j = 1:length(vvarvecm)
|
||||
data_mat(j,:)=[min(r2_MC(ixx(1:nfilt0(j),j),j)) ...
|
||||
max(r2_MC(ixx(1:nfilt0(j),j),j)) ...
|
||||
min(r2_MC(ixx(nfilt0(j)+1:end,j),j)) ...
|
||||
|
@ -684,10 +648,10 @@ else
|
|||
r2_txt(j)];
|
||||
end
|
||||
%get formatting for additional header line
|
||||
val_width=15;
|
||||
val_precis=5;
|
||||
label_width = max(size(deblank(char(headers(1,:),vvarvecm)),2)+2,0);
|
||||
label_format_leftbound = sprintf('%%-%ds',label_width);
|
||||
val_width = 15;
|
||||
val_precis = 5;
|
||||
label_width = max(cellofchararraymaxlength(vertcat(headers{1}, vvarvecm))+2, 0);
|
||||
label_format_leftbound = sprintf('%%-%ds', label_width);
|
||||
if all(~isfinite(data_mat))
|
||||
values_length = 4;
|
||||
else
|
||||
|
@ -696,35 +660,32 @@ else
|
|||
if any(data_mat) < 0 %add one character for minus sign
|
||||
values_length = values_length+1;
|
||||
end
|
||||
|
||||
headers_length = max(size(deblank(headers(2:end,:)),2));
|
||||
headers_length = cellofchararraymaxlength(headers(2:end));
|
||||
if ~isempty(val_width)
|
||||
val_width = max(max(headers_length,values_length)+2,val_width);
|
||||
val_width = max(max(headers_length, values_length)+2, val_width);
|
||||
else
|
||||
val_width = max(headers_length,values_length)+2;
|
||||
val_width = max(headers_length, values_length)+2;
|
||||
end
|
||||
value_format = sprintf('%%%d.%df',val_width,val_precis);
|
||||
header_string_format = sprintf('%%%ds',val_width);
|
||||
|
||||
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
|
||||
optional_header=sprintf([label_format_leftbound,header_string_format,header_string_format,header_string_format,header_string_format],'','',['best ',num2str(pfilt*100),'% filtered'],'','remaining 90%');
|
||||
optional_header = sprintf([label_format_leftbound,header_string_format,header_string_format,header_string_format,header_string_format],'','',['best ',num2str(pfilt*100),'% filtered'],'','remaining 90%');
|
||||
else
|
||||
optional_header=sprintf([label_format_leftbound,header_string_format,header_string_format,header_string_format,header_string_format],'','','best filtered','','remaining');
|
||||
optional_header = sprintf([label_format_leftbound,header_string_format,header_string_format,header_string_format,header_string_format],'','','best filtered','','remaining');
|
||||
end
|
||||
dyntable(options_,title_string,headers,vvarvecm,data_mat, 0, val_width, val_precis,optional_header);
|
||||
dyntable(options_, title_string, headers, vvarvecm, data_mat, 0, val_width, val_precis, optional_header);
|
||||
if options_.TeX
|
||||
if options_.opt_gsa.ppost==0 && options_.opt_gsa.pprior
|
||||
optional_header={[' & \multicolumn{2}{c}{best ',num2str(pfilt*100),' filtered} & \multicolumn{2}{c}{remaining 90\%}\\']};
|
||||
if ~options_.opt_gsa.ppost && options_.opt_gsa.pprior
|
||||
optional_header = {[' & \multicolumn{2}{c}{best ',num2str(pfilt*100),' filtered} & \multicolumn{2}{c}{remaining 90\%}\\']};
|
||||
else
|
||||
optional_header={[' & \multicolumn{2}{c}{best filtered} & \multicolumn{2}{c}{remaining}\\']};
|
||||
optional_header = {[' & \multicolumn{2}{c}{best filtered} & \multicolumn{2}{c}{remaining}\\']};
|
||||
end
|
||||
dyn_latex_table(M_,options_,title_string,'R2_ranges_after_filtering',headers_tex,vvarvecm_tex,data_mat,0,val_width,val_precis,optional_header);
|
||||
dyn_latex_table(M_, options_, title_string, 'R2_ranges_after_filtering', headers_tex, vvarvecm_tex, data_mat, 0, val_width, val_precis, optional_header);
|
||||
end
|
||||
|
||||
|
||||
%%%% R2 table
|
||||
SP=zeros(npar+nshock,size(vvarvecm,1));
|
||||
for j=1:size(vvarvecm,1)
|
||||
% R2 table
|
||||
SP = zeros(npar+nshock, length(vvarvecm));
|
||||
for j = 1:length(vvarvecm)
|
||||
ns=find(PP(:,j)<alpha);
|
||||
SP(ns,j)=ones(size(ns));
|
||||
SS(:,j)=SS(:,j).*SP(:,j);
|
||||
|
@ -733,33 +694,24 @@ else
|
|||
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));
|
||||
snam0=param_names(find(nsp==0));
|
||||
snam1=param_names(find(nsp==1));
|
||||
snam2=param_names(find(nsp>1));
|
||||
snam=param_names(find(nsp>0));
|
||||
nsnam=(find(nsp>1));
|
||||
|
||||
skipline(2)
|
||||
disp('These parameters do not affect significantly the fit of ANY observed series:')
|
||||
disp(snam0)
|
||||
disp(char(snam0))
|
||||
skipline()
|
||||
disp('These parameters affect ONE single observed series:')
|
||||
disp(snam1)
|
||||
disp(char(snam1))
|
||||
skipline()
|
||||
disp('These parameters affect MORE THAN ONE observed series: trade off exists!')
|
||||
disp(snam2)
|
||||
|
||||
|
||||
%pnam=bayestopt_.name(end-estim_params_.np+1:end);
|
||||
disp(char(snam2))
|
||||
pnam=bayestopt_.name;
|
||||
|
||||
% plot trade-offs
|
||||
if ~options_.nograph
|
||||
a00=jet(size(vvarvecm,1));
|
||||
a00=jet(length(vvarvecm));
|
||||
if options_.opt_gsa.ppost
|
||||
temp_name='RMSE Posterior Tradeoffs:';
|
||||
atitle='RMSE Posterior Map:';
|
||||
|
@ -783,33 +735,30 @@ else
|
|||
options_mcf.param_names_tex = param_names_tex;
|
||||
options_mcf.fname_ = fname_;
|
||||
options_mcf.OutputDirectoryName = OutDir;
|
||||
for iy=1:size(vvarvecm,1)
|
||||
options_mcf.amcf_name = [asname '_' deblank(vvarvecm(iy,:)) '_map' ];
|
||||
options_mcf.amcf_title = [atitle ' ' deblank(vvarvecm(iy,:))];
|
||||
options_mcf.beha_title = ['better fit of ' deblank(vvarvecm(iy,:))];
|
||||
options_mcf.nobeha_title = ['worse fit of ' deblank(vvarvecm(iy,:))];
|
||||
options_mcf.title = ['the fit of ' deblank(vvarvecm(iy,:))];
|
||||
for iy = 1:length(vvarvecm)
|
||||
options_mcf.amcf_name = [asname '_' vvarvecm{iy} '_map' ];
|
||||
options_mcf.amcf_title = [atitle ' ' vvarvecm{iy}];
|
||||
options_mcf.beha_title = ['better fit of ' vvarvecm{iy}];
|
||||
options_mcf.nobeha_title = ['worse fit of ' vvarvecm{iy}];
|
||||
options_mcf.title = ['the fit of ' vvarvecm{iy}];
|
||||
mcf_analysis(x, ixx(1:nfilt0(iy),iy), ixx(nfilt0(iy)+1:end,iy), options_mcf, options_);
|
||||
end
|
||||
for iy=1:size(vvarvecm,1)
|
||||
for iy = 1:length(vvarvecm)
|
||||
ipar = find(any(squeeze(PPV(iy,:,:))<alpha));
|
||||
for ix=1:ceil(length(ipar)/5)
|
||||
hh = dyn_figure(options_.nodisplay,'name',[temp_name,' observed variable ',deblank(vvarvecm(iy,:))]);
|
||||
hh = dyn_figure(options_.nodisplay,'name',[temp_name,' observed variable ', vvarvecm{iy}]);
|
||||
for j=1+5*(ix-1):min(length(ipar),5*ix)
|
||||
subplot(2,3,j-5*(ix-1))
|
||||
%h0=cumplot(x(:,nsnam(j)+nshock));
|
||||
h0=cumplot(x(:,ipar(j)));
|
||||
set(h0,'color',[0 0 0])
|
||||
hold on,
|
||||
iobs=find(squeeze(PPV(iy,:,ipar(j)))<alpha);
|
||||
for i=1:size(vvarvecm,1)
|
||||
%h0=cumplot(x(ixx(1:nfilt,np(i)),nsnam(j)+nshock));
|
||||
% h0=cumplot(x(ixx(1:nfilt0(np(i)),np(i)),nsnam(j)));
|
||||
for i = 1:length(vvarvecm)
|
||||
if any(iobs==i) || i==iy
|
||||
h0=cumplot(x(ixx(1:nfilt0(i),i),ipar(j)));
|
||||
if ~isoctave
|
||||
hcmenu = uicontextmenu;
|
||||
uimenu(hcmenu,'Label',deblank(vvarvecm(i,:)));
|
||||
uimenu(hcmenu,'Label',vvarvecm{i});
|
||||
set(h0,'uicontextmenu',hcmenu)
|
||||
end
|
||||
else
|
||||
|
@ -818,7 +767,6 @@ else
|
|||
set(h0,'color',a00(i,:),'linewidth',2)
|
||||
end
|
||||
ydum=get(gca,'ylim');
|
||||
%xdum=xparam1(nshock+nsnam(j));
|
||||
if exist('xparam1')
|
||||
xdum=xparam1(ipar(j));
|
||||
h1=plot([xdum xdum],ydum);
|
||||
|
@ -827,65 +775,55 @@ else
|
|||
xlabel('')
|
||||
title([pnam{ipar(j)}],'interpreter','none')
|
||||
end
|
||||
%subplot(3,2,6)
|
||||
if isoctave
|
||||
legend(char('base',vvarvecm),'location','eastoutside');
|
||||
legend(vertcat('base',vvarvecm),'location','eastoutside');
|
||||
else
|
||||
h0=legend(char('base',vvarvecm));
|
||||
h0=legend(vertcat('base',vvarvecm));
|
||||
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none');
|
||||
end
|
||||
%h0=legend({'base',vnam{np}}',0);
|
||||
%set(findobj(get(h0,'children'),'type','text'),'interpreter','none')
|
||||
if options_.opt_gsa.ppost
|
||||
dyn_saveas(hh,[ OutDir filesep fname_ '_rmse_post_' deblank(vvarvecm(iy,:)) '_' int2str(ix)],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(hh,[ OutDir filesep fname_ '_rmse_post_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
|
||||
if options_.TeX
|
||||
create_TeX_loader(options_,[ OutDir filesep fname_ '_rmse_post_' deblank(vvarvecm(iy,:)) '_' int2str(ix)],ix,[temp_name,' observed variable $',deblank(vvarvecm_tex(iy,:)) '$'],['rmse_post_' deblank(vvarvecm(iy,:))],1)
|
||||
create_TeX_loader(options_,[ OutDir filesep fname_ '_rmse_post_' vvarvecm{iy} '_' int2str(ix)],ix,[temp_name,' observed variable $',vvarvecm_tex{iy} '$'],['rmse_post_' vvarvecm{iy}],1)
|
||||
end
|
||||
else
|
||||
if options_.opt_gsa.pprior
|
||||
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_' deblank(vvarvecm(iy,:)) '_' int2str(ix) ],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_prior_' vvarvecm{iy} '_' int2str(ix) ],options_.nodisplay,options_.graph_format);
|
||||
if options_.TeX
|
||||
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_' deblank(vvarvecm(iy,:)) '_' int2str(ix) ],ix,[temp_name,' observed variable $',deblank(vvarvecm_tex(iy,:)) '$'],['rmse_prior_' deblank(vvarvecm(iy,:))],1)
|
||||
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_prior_' vvarvecm{iy} '_' int2str(ix) ],ix,[temp_name,' observed variable $',vvarvecm_tex{iy} '$'],['rmse_prior_' vvarvecm{iy}],1)
|
||||
end
|
||||
else
|
||||
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_' deblank(vvarvecm(iy,:)) '_' int2str(ix)],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(hh,[OutDir filesep fname_ '_rmse_mc_' vvarvecm{iy} '_' int2str(ix)],options_.nodisplay,options_.graph_format);
|
||||
if options_.TeX
|
||||
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_' deblank(vvarvecm(iy,:)) '_' int2str(ix)],ix,[temp_name,' observed variable $',deblank(vvarvecm_tex(iy,:)) '$'],['rmse_mc_' deblank(vvarvecm(iy,:))],1)
|
||||
create_TeX_loader(options_,[OutDir filesep fname_ '_rmse_mc_' vvarvecm{iy} '_' int2str(ix)],ix,[temp_name,' observed variable $',vvarvecm_tex{iy} '$'],['rmse_mc_' vvarvecm{iy}],1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% now I plot by individual parameters
|
||||
for ix=1:ceil(length(nsnam)/5)
|
||||
hh = dyn_figure(options_.nodisplay,'name',[temp_name,' estimated params and shocks ',int2str(ix)]);
|
||||
for j=1+5*(ix-1):min(size(snam2,1),5*ix)
|
||||
subplot(2,3,j-5*(ix-1))
|
||||
%h0=cumplot(x(:,nsnam(j)+nshock));
|
||||
h0=cumplot(x(:,nsnam(j)));
|
||||
set(h0,'color',[0 0 0])
|
||||
hold on,
|
||||
npx=find(SP(nsnam(j),:)==0);
|
||||
%a0=jet(nsp(nsnam(j)));
|
||||
% a0=a00(np,:);
|
||||
for i=1:size(vvarvecm,1)
|
||||
%h0=cumplot(x(ixx(1:nfilt,np(i)),nsnam(j)+nshock));
|
||||
% h0=cumplot(x(ixx(1:nfilt0(np(i)),np(i)),nsnam(j)));
|
||||
for i = 1:length(vvarvecm)
|
||||
if any(npx==i)
|
||||
h0=cumplot(x(ixx(1:nfilt0(i),i),nsnam(j))*NaN);
|
||||
else
|
||||
h0=cumplot(x(ixx(1:nfilt0(i),i),nsnam(j)));
|
||||
if ~isoctave
|
||||
hcmenu = uicontextmenu;
|
||||
uimenu(hcmenu,'Label',deblank(vvarvecm(i,:)));
|
||||
uimenu(hcmenu,'Label', vvarvecm{i});
|
||||
set(h0,'uicontextmenu',hcmenu)
|
||||
end
|
||||
end
|
||||
set(h0,'color',a00(i,:),'linewidth',2)
|
||||
end
|
||||
ydum=get(gca,'ylim');
|
||||
%xdum=xparam1(nshock+nsnam(j));
|
||||
if exist('xparam1')
|
||||
xdum=xparam1(nsnam(j));
|
||||
h1=plot([xdum xdum],ydum);
|
||||
|
@ -896,13 +834,11 @@ else
|
|||
end
|
||||
%subplot(3,2,6)
|
||||
if isoctave
|
||||
legend(char('base',vvarvecm),'location','eastoutside');
|
||||
legend(vertcat('base',vvarvecm),'location','eastoutside');
|
||||
else
|
||||
h0=legend(char('base',vvarvecm));
|
||||
h0=legend(vertcat('base',vvarvecm));
|
||||
set(h0,'fontsize',6,'position',[0.7 0.1 0.2 0.3],'interpreter','none');
|
||||
end
|
||||
%h0=legend({'base',vnam{np}}',0);
|
||||
%set(findobj(get(h0,'children'),'type','text'),'interpreter','none')
|
||||
if options_.opt_gsa.ppost
|
||||
dyn_saveas(hh,[ OutDir filesep fname_ '_rmse_post_params_' int2str(ix)],options_.nodisplay,options_.graph_format);
|
||||
if options_.TeX
|
||||
|
@ -923,66 +859,6 @@ else
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
% for j=1:size(SP,2),
|
||||
% nsx(j)=length(find(SP(:,j)));
|
||||
% end
|
||||
|
||||
% skipline(2)
|
||||
% 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
|
||||
|
||||
|
||||
% skipline()
|
||||
% disp('Starting bivariate analysis:')
|
||||
%
|
||||
% for i=1:size(vvarvecm,1)
|
||||
% if options_.opt_gsa.ppost
|
||||
% fnam = ['rmse_post_',deblank(vvarvecm(i,:))];
|
||||
% else
|
||||
% if options_.opt_gsa.pprior
|
||||
% fnam = ['rmse_prior_',deblank(vvarvecm(i,:))];
|
||||
% else
|
||||
% fnam = ['rmse_mc_',deblank(vvarvecm(i,:))];
|
||||
% end
|
||||
% end
|
||||
% stab_map_2(x(ixx(1:nfilt0(i),i),:),alpha2,pvalue,fnam, OutDir,[],[temp_name ' observed variable ' deblank(vvarvecm(i,:))]);
|
||||
%
|
||||
% % [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
|
||||
|
||||
end
|
||||
|
||||
function []=create_TeX_loader(options_,figpath,label_number,caption,label_name,scale_factor)
|
||||
|
|
|
@ -5,7 +5,7 @@ function map_calibration(OutputDirectoryName, Model, DynareOptions, DynareResult
|
|||
% marco.ratto@ec.europa.eu
|
||||
|
||||
% Copyright (C) 2014-2016 European Commission
|
||||
% Copyright (C) 2014-2017 Dynare Team
|
||||
% Copyright (C) 2014-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -48,9 +48,9 @@ init = ~DynareOptions.opt_gsa.load_stab;
|
|||
options_mcf.pvalue_ks = DynareOptions.opt_gsa.pvalue_ks;
|
||||
options_mcf.pvalue_corr = DynareOptions.opt_gsa.pvalue_corr;
|
||||
options_mcf.alpha2 = DynareOptions.opt_gsa.alpha2_stab;
|
||||
options_mcf.param_names = char(pnames);
|
||||
options_mcf.param_names = pnames;
|
||||
if DynareOptions.TeX
|
||||
options_mcf.param_names_tex=char(pnames_tex);
|
||||
options_mcf.param_names_tex = pnames_tex;
|
||||
end
|
||||
options_mcf.fname_ = fname_;
|
||||
options_mcf.OutputDirectoryName = OutputDirectoryName;
|
||||
|
@ -375,11 +375,11 @@ if ~isempty(indx_moment)
|
|||
name{jj,1} = param_name_temp;
|
||||
end
|
||||
end
|
||||
options_mcf.param_names = char(name);
|
||||
options_mcf.param_names = name;
|
||||
if DynareOptions.TeX
|
||||
options_mcf.param_names_tex = char(name_tex);
|
||||
options_mcf.param_names_tex = name_tex;
|
||||
end
|
||||
options_mcf.param_names = char(BayesInfo.name);
|
||||
options_mcf.param_names = BayesInfo.name;
|
||||
all_moment_couples = cellstr([char(endo_prior_restrictions.moment(:,1)) char(endo_prior_restrictions.moment(:,2))]);
|
||||
moment_couples = unique(all_moment_couples);
|
||||
nbr_moment_couples = size(moment_couples,1);
|
||||
|
|
|
@ -5,7 +5,7 @@ function map_ident_(OutputDirectoryName,opt_gsa)
|
|||
% marco.ratto@ec.europa.eu
|
||||
|
||||
% Copyright (C) 2012-2016 European Commission
|
||||
% Copyright (C) 2012-2017 Dynare Team
|
||||
% Copyright (C) 2012-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -37,7 +37,7 @@ else
|
|||
gsa_flag=-2;
|
||||
end
|
||||
|
||||
pnames = M_.param_names(estim_params_.param_vals(:,1),:);
|
||||
pnames = M_.param_names(estim_params_.param_vals(:,1));
|
||||
if opt_gsa.pprior
|
||||
|
||||
filetoload=[OutputDirectoryName '/' fname_ '_prior'];
|
||||
|
@ -106,7 +106,7 @@ if opt_gsa.load_ident_files==0
|
|||
end
|
||||
xlabel(' ')
|
||||
ylabel(' ')
|
||||
title(M_.exo_names(j,:),'interpreter','none')
|
||||
title(M_.exo_names{j},'interpreter','none')
|
||||
if mod(j,6)==0 | j==M_.exo_nbr
|
||||
dyn_saveas(hh,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],options_.nodisplay,options_.graph_format);
|
||||
create_TeX_loader(options_,[OutputDirectoryName,'/',fname_,'_vdec_exo_',int2str(ifig)],ifig,['Variance decomposition shocks'],'vdec_exo',options_.figures.textwidth*min(iplo/3,1))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function [vdec, cc, ac] = mc_moments(mm, ss, dr)
|
||||
|
||||
% Copyright (C) 2012-2017 Dynare Team
|
||||
% Copyright (C) 2012-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -20,7 +20,7 @@ function [vdec, cc, ac] = mc_moments(mm, ss, dr)
|
|||
global options_ M_ estim_params_ oo_
|
||||
|
||||
[nr1, nc1, nsam] = size(mm);
|
||||
nobs=size(options_.varobs,2);
|
||||
nobs=length(options_.varobs);
|
||||
disp('Computing theoretical moments ...')
|
||||
h = dyn_waitbar(0,'Theoretical moments ...');
|
||||
vdec = zeros(nobs,M_.exo_nbr,nsam);
|
||||
|
|
|
@ -6,7 +6,7 @@ function indmcf = mcf_analysis(lpmat, ibeha, inobeha, options_mcf, DynareOptions
|
|||
%
|
||||
|
||||
% Copyright (C) 2014 European Commission
|
||||
% Copyright (C) 2016-2017 Dynare Team
|
||||
% Copyright (C) 2016-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -53,13 +53,13 @@ indmcf=find(proba<pvalue_ks);
|
|||
indmcf = indmcf(jtmp);
|
||||
if ~isempty(indmcf)
|
||||
skipline()
|
||||
headers=char('Parameter','d-stat','p-value');
|
||||
labels=char(param_names(indmcf,:));
|
||||
headers = {'Parameter','d-stat','p-value'};
|
||||
labels = param_names(indmcf);
|
||||
data_mat=[dproba(indmcf)' proba(indmcf)'];
|
||||
options_temp.noprint=0;
|
||||
dyntable(options_temp,['Smirnov statistics in driving ', title],headers,labels,data_mat,size(labels,2)+2,16,3);
|
||||
if DynareOptions.TeX
|
||||
labels_TeX=param_names_tex(indmcf,:);
|
||||
labels_TeX=param_names_tex(indmcf);
|
||||
M_temp.dname=OutputDirectoryName ;
|
||||
M_temp.fname=fname_;
|
||||
dyn_latex_table(M_temp,options_temp,['Smirnov statistics in driving ', strrep(title,'_','\\_')],amcf_name,headers,labels_TeX,data_mat,size(labels,2)+2,16,6);
|
||||
|
@ -78,7 +78,7 @@ 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,:), ...
|
||||
scatter_mcf(lpmat(ibeha,indmcf),lpmat(inobeha,indmcf), param_names(indmcf), ...
|
||||
'.', [fname_,'_',amcf_name], OutputDirectoryName, amcf_title,xx, DynareOptions, ...
|
||||
beha_title, nobeha_title)
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ function redform_map(dirname,options_gsa_)
|
|||
% marco.ratto@ec.europa.eu
|
||||
|
||||
% Copyright (C) 2012-2016 European Commission
|
||||
% Copyright (C) 2012-2017 Dynare Team
|
||||
% Copyright (C) 2012-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -86,9 +86,9 @@ end
|
|||
options_mcf.pvalue_ks = options_gsa_.ksstat_redform;
|
||||
options_mcf.pvalue_corr = options_gsa_.alpha2_redform;
|
||||
options_mcf.alpha2 = options_gsa_.alpha2_redform;
|
||||
options_mcf.param_names = char(pnames);
|
||||
options_mcf.param_names = pnames;
|
||||
if options_.TeX
|
||||
options_mcf.param_names_tex=char(pnames_tex);
|
||||
options_mcf.param_names_tex = pnames_tex;
|
||||
end
|
||||
options_mcf.fname_ = M_.fname;
|
||||
options_mcf.OutputDirectoryName = adir;
|
||||
|
@ -147,14 +147,14 @@ nsok = length(find(M_.lead_lag_incidence(M_.maximum_lag,:)));
|
|||
lpmat=[];
|
||||
lpmat0=[];
|
||||
js=0;
|
||||
for j=1:size(anamendo,1)
|
||||
namendo=deblank(anamendo(j,:));
|
||||
iendo=strmatch(namendo,M_.endo_names(oo_.dr.order_var,:),'exact');
|
||||
ifig=0;
|
||||
iplo=0;
|
||||
for jx=1:size(anamexo,1)
|
||||
namexo=deblank(anamexo(jx,:));
|
||||
iexo=strmatch(namexo,M_.exo_names,'exact');
|
||||
for j = 1:length(anamendo)
|
||||
namendo = anamendo{j};
|
||||
iendo = strmatch(namendo, M_.endo_names(oo_.dr.order_var), 'exact');
|
||||
ifig = 0;
|
||||
iplo = 0;
|
||||
for jx = 1:length(anamexo)
|
||||
namexo = anamexo{jx};
|
||||
iexo=strmatch(namexo, M_.exo_names, 'exact');
|
||||
skipline()
|
||||
disp(['[', namendo,' vs ',namexo,']'])
|
||||
|
||||
|
@ -289,9 +289,9 @@ for j=1:size(anamendo,1)
|
|||
end
|
||||
ifig=0;
|
||||
iplo=0;
|
||||
for je=1:size(anamlagendo,1)
|
||||
namlagendo=deblank(anamlagendo(je,:));
|
||||
ilagendo=strmatch(namlagendo,M_.endo_names(oo_.dr.order_var(M_.nstatic+1:M_.nstatic+nsok),:),'exact');
|
||||
for je=1:length(anamlagendo)
|
||||
namlagendo = anamlagendo{je};
|
||||
ilagendo=strmatch(namlagendo, M_.endo_names(oo_.dr.order_var(M_.nstatic+1:M_.nstatic+nsok)), 'exact');
|
||||
skipline()
|
||||
disp(['[', namendo,' vs lagged ',namlagendo,']'])
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ function redform_screen(dirname, options_gsa_)
|
|||
% marco.ratto@ec.europa.eu
|
||||
|
||||
% Copyright (C) 2012-2016 European Commission
|
||||
% Copyright (C) 2012-2017 Dynare Team
|
||||
% Copyright (C) 2012-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -38,7 +38,7 @@ anamexo = options_gsa_.namexo;
|
|||
iload = options_gsa_.load_redform;
|
||||
nliv = options_gsa_.morris_nliv;
|
||||
|
||||
pnames = M_.param_names(estim_params_.param_vals(:,1),:);
|
||||
pnames = M_.param_names(estim_params_.param_vals(:,1));
|
||||
if nargin==0
|
||||
dirname='';
|
||||
end
|
||||
|
@ -54,36 +54,33 @@ nsok = length(find(M_.lead_lag_incidence(M_.maximum_lag,:)));
|
|||
|
||||
js=0;
|
||||
for j=1:size(anamendo,1)
|
||||
namendo=deblank(anamendo(j,:));
|
||||
iendo=strmatch(namendo,M_.endo_names(oo_.dr.order_var,:),'exact');
|
||||
|
||||
namendo = deblank(anamendo(j,:));
|
||||
iendo = strmatch(namendo, M_.endo_names(oo_.dr.order_var), 'exact');
|
||||
iplo=0;
|
||||
ifig=0;
|
||||
for jx=1:size(anamexo,1)
|
||||
namexo=deblank(anamexo(jx,:));
|
||||
iexo=strmatch(namexo,M_.exo_names,'exact');
|
||||
|
||||
namexo = deblank(anamexo(jx,:));
|
||||
iexo = strmatch(namexo, M_.exo_names, 'exact');
|
||||
if ~isempty(iexo)
|
||||
y0=teff(T(iendo,iexo+nspred,:),kn,istable);
|
||||
y0=teff(T(iendo,iexo+nspred,:), kn, istable);
|
||||
if ~isempty(y0)
|
||||
if mod(iplo,9)==0
|
||||
ifig=ifig+1;
|
||||
hh=dyn_figure(options_.nodisplay,'name',[namendo,' vs. shocks ',int2str(ifig)]);
|
||||
iplo=0;
|
||||
ifig = ifig+1;
|
||||
hh = dyn_figure(options_.nodisplay, 'name', [namendo,[' vs. shocks '], int2str(ifig)]);
|
||||
iplo = 0;
|
||||
end
|
||||
iplo=iplo+1;
|
||||
js=js+1;
|
||||
subplot(3,3,iplo),
|
||||
[SAmeas, SAMorris] = Morris_Measure_Groups(np+nshock, [lpmat0 lpmat], y0,nliv);
|
||||
iplo = iplo+1;
|
||||
js = js+1;
|
||||
subplot(3, 3, iplo)
|
||||
[SAmeas, SAMorris] = Morris_Measure_Groups(np+nshock, [lpmat0 lpmat], y0, nliv);
|
||||
SAM = squeeze(SAMorris(nshock+1:end,1));
|
||||
SA(:,js)=SAM./(max(SAM)+eps);
|
||||
SA(:,js) = SAM./(max(SAM)+eps);
|
||||
[saso, iso] = sort(-SA(:,js));
|
||||
bar(SA(iso(1:min(np,10)),js))
|
||||
%set(gca,'xticklabel',pnames(iso(1:min(np,10)),:),'fontsize',8)
|
||||
set(gca,'xticklabel',' ','fontsize',10)
|
||||
set(gca,'xlim',[0.5 10.5])
|
||||
for ip=1:min(np,10)
|
||||
text(ip,-0.02,deblank(pnames(iso(ip),:)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
|
||||
text(ip,-0.02,pnames(iso(ip)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
|
||||
end
|
||||
title([namendo,' vs. ',namexo],'interpreter','none')
|
||||
if iplo==9
|
||||
|
@ -103,7 +100,7 @@ for j=1:size(anamendo,1)
|
|||
ifig=0;
|
||||
for je=1:size(anamlagendo,1)
|
||||
namlagendo=deblank(anamlagendo(je,:));
|
||||
ilagendo=strmatch(namlagendo,M_.endo_names(oo_.dr.order_var(M_.nstatic+1:M_.nstatic+nsok),:),'exact');
|
||||
ilagendo=strmatch(namlagendo, M_.endo_names(oo_.dr.order_var(M_.nstatic+1:M_.nstatic+nsok)), 'exact');
|
||||
|
||||
if ~isempty(ilagendo)
|
||||
y0=teff(T(iendo,ilagendo,:),kn,istable);
|
||||
|
|
|
@ -6,7 +6,7 @@ function scatter_callback(K, type)
|
|||
%
|
||||
|
||||
% Copyright (C) 2017 European Commission
|
||||
% Copyright (C) 2017 Dynare Team
|
||||
% Copyright (C) 2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -34,9 +34,7 @@ xparam1=x(K,:)';
|
|||
switch type
|
||||
case 'save'
|
||||
save(['my_params_' int2str(K)],'xparam1')
|
||||
|
||||
case 'eval'
|
||||
disp('Evaluating smoother ...')
|
||||
[oo_, M_]=evaluate_smoother(xparam1,M_.endo_names,M_,oo_,options_,bayestopt_,estim_params_);
|
||||
% [rmse, lnam, r2,vv] = plot_fit(obsname{:});
|
||||
[oo_, M_]=evaluate_smoother(xparam1, M_.endo_names, M_, oo_, options_, bayestopt_, estim_params_);
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ function x0 = stab_map_(OutputDirectoryName,opt_gsa)
|
|||
% marco.ratto@ec.europa.eu
|
||||
|
||||
% Copyright (C) 2012-2016 European Commission
|
||||
% Copyright (C) 2012-2017 Dynare Team
|
||||
% Copyright (C) 2012-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -130,9 +130,9 @@ for jj=1:np
|
|||
end
|
||||
end
|
||||
if options_.TeX
|
||||
options_mcf.param_names_tex=char(name_tex);
|
||||
options_mcf.param_names_tex = name_tex;
|
||||
end
|
||||
options_mcf.param_names = char(name);
|
||||
options_mcf.param_names = name;
|
||||
|
||||
options_mcf.fname_ = fname_;
|
||||
options_mcf.OutputDirectoryName = OutputDirectoryName;
|
||||
|
@ -663,9 +663,9 @@ if length(iunstable)>0 || length(iwrong)>0
|
|||
end
|
||||
end
|
||||
if options_.TeX
|
||||
options_mcf.param_names_tex = char(name_tex);
|
||||
options_mcf.param_names_tex = name_tex;
|
||||
end
|
||||
options_mcf.param_names = char(name);
|
||||
options_mcf.param_names = name;
|
||||
options_mcf.amcf_name = acalibname;
|
||||
options_mcf.amcf_title = acalibtitle;
|
||||
options_mcf.beha_title = 'prior IRF/moment calibration';
|
||||
|
|
|
@ -6,7 +6,7 @@ function indcorr = stab_map_2(x,alpha2, pvalue_crit, fnam, dirname,xparam1,figti
|
|||
% marco.ratto@ec.europa.eu
|
||||
|
||||
% Copyright (C) 2011-2016 European Commission
|
||||
% Copyright (C) 2011-2017 Dynare Team
|
||||
% Copyright (C) 2011-2018 Dynare Team
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
|
@ -183,10 +183,10 @@ end
|
|||
if j2==0
|
||||
disp(['No correlation term with pvalue <', num2str(pvalue_crit),' and |corr. coef.| >',num2str(alpha2),' found for ',fnam])
|
||||
else
|
||||
headers=strvcat('Parameters','corrcoef');
|
||||
dyntable(options_,title_string,headers,char(name),data_mat, 0, 7, 3);
|
||||
headers={'Parameters'; 'corrcoef'};
|
||||
dyntable(options_,title_string,headers, name, data_mat, 0, 7, 3);
|
||||
if options_.TeX
|
||||
dyn_latex_table(M_,options_,title_string_tex,fig_nam_tex_table,headers,char(name_tex),data_mat,0,7,3);
|
||||
dyn_latex_table(M_, options_, title_string_tex, fig_nam_tex_table, headers, name_tex, data_mat, 0, 7, 3);
|
||||
end
|
||||
end
|
||||
%close all
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function [vdec, corr, autocorr, z, zz] = th_moments(dr,var_list)
|
||||
% [vdec, corr, autocorr, z, zz] = th_moments(dr,var_list)
|
||||
|
||||
% Copyright (C) 2012-2017 Dynare Team
|
||||
% Copyright (C) 2012-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -20,14 +20,14 @@ function [vdec, corr, autocorr, z, zz] = th_moments(dr,var_list)
|
|||
|
||||
global M_ oo_ options_
|
||||
|
||||
nvar = size(var_list,2);
|
||||
nvar = length(var_list);
|
||||
if nvar == 0
|
||||
nvar = length(dr.order_var);
|
||||
ivar = [1:nvar]';
|
||||
else
|
||||
ivar=zeros(nvar,1);
|
||||
for i=1:nvar
|
||||
i_tmp = strmatch(var_list{:,i},M_.endo_names,'exact');
|
||||
i_tmp = strmatch(var_list{i}, M_.endo_names, 'exact');
|
||||
if isempty(i_tmp)
|
||||
error(['One of the variables specified does not exist']) ;
|
||||
else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function histvalf(fname)
|
||||
|
||||
% Copyright (C) 2014-2017 Dynare Team
|
||||
% Copyright (C) 2014-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -61,10 +61,10 @@ for i = 1:length(outvars)
|
|||
end
|
||||
if M_.aux_vars(i).type == 1
|
||||
% Endogenous
|
||||
orig_var = deblank(M_.endo_names(M_.aux_vars(i).orig_index, :));
|
||||
orig_var = M_.endo_names{M_.aux_vars(i).orig_index};
|
||||
else
|
||||
% Exogenous
|
||||
orig_var = deblank(M_.exo_names(M_.aux_vars(i).orig_index, :));
|
||||
orig_var = M_.exo_names{M_.aux_vars(i).orig_index};
|
||||
end
|
||||
if strcmp(orig_var, ov) && M_.aux_vars(i).orig_lead_lag == lead_lag
|
||||
j = M_.aux_vars(i).endo_index;
|
||||
|
|
|
@ -25,7 +25,7 @@ function homotopy2(values, step_nbr)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2008-2017 Dynare Team
|
||||
% Copyright (C) 2008-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -82,11 +82,11 @@ end
|
|||
for i = 1:nv
|
||||
switch values(i,1)
|
||||
case 1
|
||||
varname = M_.exo_names(values(i,2), :);
|
||||
varname = M_.exo_names{values(i,2)};
|
||||
case 2
|
||||
varname = M_.exo_det_names(values(i,2), :);
|
||||
varname = M_.exo_det_names{values(i,2)};
|
||||
case 4
|
||||
varname = M_.param_names(values(i,2), :);
|
||||
varname = M_.param_names{values(i,2)};
|
||||
end
|
||||
for v = oldvalues(i):(values(i,4)-oldvalues(i))/step_nbr:values(i,4)
|
||||
switch values(i,1)
|
||||
|
@ -98,7 +98,7 @@ for i = 1:nv
|
|||
M_.params(values(i,2)) = v;
|
||||
end
|
||||
|
||||
disp([ 'HOMOTOPY mode 2: lauching solver with ' deblank(varname) ' = ' num2str(v) ' ...'])
|
||||
disp([ 'HOMOTOPY mode 2: lauching solver with ' varname ' = ' num2str(v) ' ...'])
|
||||
|
||||
oo_.steady_state = steady_(M_,options_,oo_);
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ function [pars, cosnJ] = ident_bruteforce(J,n,TeX, pnames_TeX,tittxt)
|
|||
% pars : cell array with groupf of params for each column of J for 1 to n
|
||||
% cosnJ : the cosn of each column with the selected group of columns
|
||||
|
||||
% Copyright (C) 2009-2017 Dynare Team
|
||||
% Copyright (C) 2009-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -105,13 +105,13 @@ for ll = 1:n
|
|||
plist='';
|
||||
for ii=1:ll
|
||||
if ~isnan(pars{i,ll}(ii))
|
||||
plist = [plist ' $' pnames_TeX(pars{i,ll}(ii),:) '\;\; $ '];
|
||||
plist = [plist ' $' pnames_TeX{pars{i,ll}(ii)} '\;\; $ '];
|
||||
else
|
||||
plist = [plist ' ---- '];
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,'$%s$ & [%s] & %7.3f \\\\ \n',...
|
||||
pnames_TeX(i,:),...
|
||||
pnames_TeX{i},...
|
||||
plist,...
|
||||
cosnJ(i,ll));
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ function imcforecast(constrained_paths, constrained_vars, options_cond_fcst)
|
|||
% [1] Results are stored in a structure which is saved in a mat file called conditional_forecasts.mat.
|
||||
% [2] Use the function plot_icforecast to plot the results.
|
||||
|
||||
% Copyright (C) 2006-2017 Dynare Team
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -146,8 +146,8 @@ if estimated_model
|
|||
end
|
||||
% add trend to constant
|
||||
for obs_iter=1:length(options_.varobs)
|
||||
j = strmatch(options_.varobs{obs_iter},M_.endo_names,'exact');
|
||||
constant(j,:) = constant(j,:)+trend_addition(obs_iter,:);
|
||||
j = strmatch(options_.varobs{obs_iter}, M_.endo_names, 'exact');
|
||||
constant(j,:) = constant(j,:) + trend_addition(obs_iter,:);
|
||||
end
|
||||
trend = constant(oo_.dr.order_var,:);
|
||||
InitState(:,1) = atT(:,end);
|
||||
|
@ -226,7 +226,7 @@ jdx = [];
|
|||
for i = 1:n1
|
||||
idx = [idx ; constrained_vars(i,:)];
|
||||
% idx = [idx ; oo_.dr.inv_order_var(constrained_vars(i,:))];
|
||||
jdx = [jdx ; strmatch(deblank(options_cond_fcst.controlled_varexo(i,:)),M_.exo_names,'exact')];
|
||||
jdx = [jdx ; strmatch(options_cond_fcst.controlled_varexo{i},M_.exo_names,'exact')];
|
||||
end
|
||||
mv = zeros(n1,NumberOfStates);
|
||||
mu = zeros(ExoSize,n2);
|
||||
|
@ -265,15 +265,15 @@ forecasts.controlled_variables = constrained_vars;
|
|||
forecasts.instruments = options_cond_fcst.controlled_varexo;
|
||||
|
||||
for i = 1:EndoSize
|
||||
forecasts.cond.Mean.(deblank(M_.endo_names(oo_.dr.order_var(i),:)))= mFORCS1(i,:)';
|
||||
forecasts.cond.Mean.(M_.endo_names{oo_.dr.order_var(i)}) = mFORCS1(i,:)';
|
||||
tmp = sort(squeeze(FORCS1(i,:,:))');
|
||||
forecasts.cond.ci.(deblank(M_.endo_names(oo_.dr.order_var(i),:))) = [tmp(t1,:)' ,tmp(t2,:)' ]';
|
||||
forecasts.cond.ci.(M_.endo_names{oo_.dr.order_var(i)}) = [tmp(t1,:)' ,tmp(t2,:)' ]';
|
||||
end
|
||||
|
||||
for i = 1:n1
|
||||
forecasts.controlled_exo_variables.Mean.(deblank(options_cond_fcst.controlled_varexo(i,:))) = mFORCS1_shocks(i,:)';
|
||||
forecasts.controlled_exo_variables.Mean.(options_cond_fcst.controlled_varexo{i}) = mFORCS1_shocks(i,:)';
|
||||
tmp = sort(squeeze(FORCS1_shocks(i,:,:))');
|
||||
forecasts.controlled_exo_variables.ci.(deblank(options_cond_fcst.controlled_varexo(i,:))) = [tmp(t1,:)' ,tmp(t2,:)' ]';
|
||||
forecasts.controlled_exo_variables.ci.(options_cond_fcst.controlled_varexo{i}) = [tmp(t1,:)' ,tmp(t2,:)' ]';
|
||||
end
|
||||
|
||||
clear FORCS1 mFORCS1_shocks;
|
||||
|
@ -292,9 +292,9 @@ end
|
|||
mFORCS2 = mean(FORCS2,3);
|
||||
|
||||
for i = 1:EndoSize
|
||||
forecasts.uncond.Mean.(deblank(M_.endo_names(oo_.dr.order_var(i),:)))= mFORCS2(i,:)';
|
||||
forecasts.uncond.Mean.(M_.endo_names{oo_.dr.order_var(i)})= mFORCS2(i,:)';
|
||||
tmp = sort(squeeze(FORCS2(i,:,:))');
|
||||
forecasts.uncond.ci.(deblank(M_.endo_names(oo_.dr.order_var(i),:))) = [tmp(t1,:)' ,tmp(t2,:)' ]';
|
||||
forecasts.uncond.ci.(M_.endo_names{oo_.dr.order_var(i)}) = [tmp(t1,:)' ,tmp(t2,:)' ]';
|
||||
end
|
||||
forecasts.graph.title=graph_title;
|
||||
forecasts.graph.fname=M_.fname;
|
||||
|
|
|
@ -9,7 +9,7 @@ function plan = init_plan(date)
|
|||
% plan [structure] Returns a structure containing a new forecast scenario
|
||||
%
|
||||
%
|
||||
% Copyright (C) 2013-2017 Dynare Team
|
||||
% Copyright (C) 2013-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -29,10 +29,8 @@ global M_
|
|||
plan = struct();
|
||||
plan.date = date;
|
||||
plan.date_str = strings(date);
|
||||
endo_names_length = size(M_.endo_names,2);
|
||||
plan.endo_names = deblank(mat2cell(M_.endo_names(1:M_.orig_endo_nbr,:),ones(1,M_.orig_endo_nbr),endo_names_length));
|
||||
exo_names_length = size(M_.exo_names,2);
|
||||
plan.exo_names = deblank(mat2cell(M_.exo_names(1:M_.exo_nbr,:),ones(1,M_.exo_nbr),exo_names_length));
|
||||
plan.endo_names = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
plan.exo_names = M_.exo_names(1:M_.exo_nbr);
|
||||
plan.constrained_vars_ = [];
|
||||
plan.constrained_paths_ = [];
|
||||
plan.constrained_date_ = [];
|
||||
|
|
|
@ -8,20 +8,20 @@ function oo_ = initial_condition_decomposition(M_,oo_,options_,varlist,bayestopt
|
|||
% in the order of declaration, i.e. M_.endo_names.
|
||||
%
|
||||
% INPUTS
|
||||
% M_: [structure] Definition of the model
|
||||
% oo_: [structure] Storage of results
|
||||
% options_: [structure] Options
|
||||
% varlist: [char] List of variables
|
||||
% bayestopt_: [structure] describing the priors
|
||||
% estim_params_: [structure] characterizing parameters to be estimated
|
||||
% M_: [structure] Definition of the model
|
||||
% oo_: [structure] Storage of results
|
||||
% options_: [structure] Options
|
||||
% varlist: [cell of char array] List of variables
|
||||
% bayestopt_: [structure] Description of the priors
|
||||
% estim_params_: [structure] Estimated parameters
|
||||
%
|
||||
% OUTPUTS
|
||||
% oo_: [structure] Storage of results
|
||||
% oo_: [structure] Storage of results
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2017 Dynare Team
|
||||
% Copyright (C) 2017-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -46,12 +46,12 @@ options_.plot_shock_decomp.plot_init_date = options_.initial_condition_decomp.pl
|
|||
options_.plot_shock_decomp.plot_end_date = options_.initial_condition_decomp.plot_end_date;
|
||||
|
||||
% indices of endogenous variables
|
||||
if size(varlist,1) == 0
|
||||
varlist = M_.endo_names(1:M_.orig_endo_nbr,:);
|
||||
if isempty(varlist)
|
||||
varlist = M_.endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
|
||||
[i_var,nvar,index_uniques] = varlist_indices(varlist,M_.endo_names);
|
||||
varlist=varlist(index_uniques,:);
|
||||
[i_var, nvar, index_uniques] = varlist_indices(varlist, M_.endo_names);
|
||||
varlist = varlist(index_uniques);
|
||||
|
||||
% number of variables
|
||||
endo_nbr = M_.endo_nbr;
|
||||
|
@ -89,7 +89,7 @@ if ~isfield(oo_,'initval_decomposition')
|
|||
B = dr.ghu;
|
||||
|
||||
% initialization
|
||||
gend = size(oo.SmoothedShocks.(deblank(M_.exo_names(1,:))),1); %+options_.forecast;
|
||||
gend = length(oo.SmoothedShocks.(M_.exo_names{1})); %+options_.forecast;
|
||||
z = zeros(endo_nbr,endo_nbr+2,gend);
|
||||
z(:,end,:) = Smoothed_Variables_deviation_from_mean;
|
||||
|
||||
|
@ -128,5 +128,5 @@ M_.exo_nbr = M_.endo_nbr;
|
|||
options_.plot_shock_decomp.screen_shocks=1;
|
||||
options_.plot_shock_decomp.use_shock_groups = '';
|
||||
options_.plot_shock_decomp.fig_names='initval';
|
||||
plot_shock_decomposition(M_,oo,options_,varlist);
|
||||
plot_shock_decomposition(M_, oo, options_, varlist);
|
||||
% end
|
|
@ -20,7 +20,7 @@ function DynareResults = initial_estimation_checks(objective_function,xparam1,Dy
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -73,7 +73,7 @@ if isfield(EstimatedParameters,'param_vals') && ~isempty(EstimatedParameters.par
|
|||
|
||||
if ~isempty(changed_par_indices)
|
||||
fprintf('\nThe steady state file internally changed the values of the following estimated parameters:\n')
|
||||
disp(Model.param_names(EstimatedParameters.param_vals(changed_par_indices,1),:));
|
||||
disp(char(Model.param_names(EstimatedParameters.param_vals(changed_par_indices,1))))
|
||||
fprintf('This will override the parameter values drawn from the proposal density and may lead to wrong results.\n')
|
||||
fprintf('Check whether this is really intended.\n')
|
||||
warning('The steady state file internally changes the values of the estimated parameters.')
|
||||
|
|
|
@ -14,7 +14,7 @@ function estim_params_ = initialize_from_mode(fname,M_,estim_params_)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -44,7 +44,7 @@ corrx = estim_params_.corrx;
|
|||
corrn = estim_params_.corrn;
|
||||
for i=1:length(parameter_names)
|
||||
name = parameter_names{i};
|
||||
k1 = strmatch(name,param_names,'exact');
|
||||
k1 = strmatch(name, param_names, 'exact');
|
||||
if ~isempty(k1)
|
||||
k2 = find(param_vals(:,1) == k1);
|
||||
if ~isempty(k2)
|
||||
|
@ -64,7 +64,7 @@ for i=1:length(parameter_names)
|
|||
M_.Sigma_e(k1,k1) = xparam1(i)^2;
|
||||
continue
|
||||
end
|
||||
k1 = strmatch(name,endo_names,'exact');
|
||||
k1 = strmatch(name, endo_names, 'exact');
|
||||
if ~isempty(k1)
|
||||
k2 = find(var_endo(:,1) == k1);
|
||||
if ~isempty(k2)
|
||||
|
@ -85,8 +85,8 @@ for i=1:length(parameter_names)
|
|||
M_.Sigma_e(k1a,k1) = M_.Sigma_e(k1,k1a);
|
||||
continue
|
||||
end
|
||||
k1 = strmatch(name(1:k3-1),endo_names,'exact');
|
||||
k1a = strmatch(name(k3+1:end),endo_names,'exact');
|
||||
k1 = strmatch(name(1:k3-1), endo_names, 'exact');
|
||||
k1a = strmatch(name(k3+1:end), endo_names, 'exact');
|
||||
if ~isempty(k1) && ~isempty(k1a)
|
||||
k2 = find(corrn(:,1) == k1 & corrn(:,2) == k1a);
|
||||
if ~isempty(k2)
|
||||
|
|
|
@ -13,7 +13,7 @@ function initvalf(fname_)
|
|||
% All variables local to this function have an underscore appended to
|
||||
% their name, to minimize clashes with model variables loaded by this function.
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -73,36 +73,36 @@ options_.initval_file = 1;
|
|||
oo_.endo_simul = [];
|
||||
oo_.exo_simul = [];
|
||||
|
||||
for i_=1:size(M_.endo_names,1)
|
||||
for i_=1:length(M_.endo_names)
|
||||
if series_ == 1
|
||||
x_ = eval(M_.endo_names(i_,:));
|
||||
x_ = eval(M_.endo_names{i_});
|
||||
if size(x_,2)>size(x_,1) %oo_.endo_simul must be collection of row vectors
|
||||
oo_.endo_simul = [oo_.endo_simul; x_];
|
||||
else %transpose if column vector
|
||||
oo_.endo_simul = [oo_.endo_simul; x_'];
|
||||
end
|
||||
else
|
||||
k_ = strmatch(deblank(M_.endo_names(i_,:)),names_v_,'exact');
|
||||
k_ = strmatch(M_.endo_names{i_}, names_v_, 'exact');
|
||||
if isempty(k_)
|
||||
error(['INITVAL_FILE: ' deblank(M_.endo_names(i_,:)) ' not found'])
|
||||
error(['INITVAL_FILE: ' M_.endo_names{i_} ' not found'])
|
||||
end
|
||||
x_ = data_(:,k_);
|
||||
oo_.endo_simul = [oo_.endo_simul; x_'];
|
||||
end
|
||||
end
|
||||
|
||||
for i_=1:size(M_.exo_names,1)
|
||||
for i_=1:length(M_.exo_names)
|
||||
if series_ == 1
|
||||
x_ = eval(M_.exo_names(i_,:) );
|
||||
x_ = eval(M_.exo_names{i_});
|
||||
if size(x_,2)>size(x_,1) %oo_.endo_simul must be collection of row vectors
|
||||
oo_.exo_simul = [oo_.exo_simul x_'];
|
||||
else %if column vector
|
||||
oo_.exo_simul = [oo_.exo_simul x_];
|
||||
end
|
||||
else
|
||||
k_ = strmatch(deblank(M_.exo_names(i_,:)),names_v_,'exact');
|
||||
k_ = strmatch(M_.exo_names{i_}, names_v_, 'exact');
|
||||
if isempty(k_)
|
||||
error(['INITVAL_FILE: ' deblank(M_.exo_names(i_,:)) ' not found'])
|
||||
error(['INITVAL_FILE: ' M_.exo_names{i_} ' not found'])
|
||||
end
|
||||
x_ = data_(:,k_);
|
||||
oo_.exo_simul = [oo_.exo_simul x_];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function [dr,info] = k_order_pert(dr,M,options)
|
||||
% Compute decision rules using the k-order DLL from Dynare++
|
||||
|
||||
% Copyright (C) 2009-2017 Dynare Team
|
||||
% Copyright (C) 2009-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -20,7 +20,12 @@ function [dr,info] = k_order_pert(dr,M,options)
|
|||
|
||||
info = 0;
|
||||
|
||||
M.var_order_endo_names = M.endo_names(dr.order_var,:);
|
||||
M.var_order_endo_names = M.endo_names(dr.order_var);
|
||||
|
||||
% k_order_perturbation expects char array for the names of endogenous and
|
||||
% exogenous variables (not cells). The mex needs to be fixed...
|
||||
M.var_order_endo_names = char(M.var_order_endo_names);
|
||||
M.exo_names = char(M.exo_names);
|
||||
|
||||
order = options.order;
|
||||
endo_nbr = M.endo_nbr;
|
||||
|
|
|
@ -12,7 +12,7 @@ function [lb,ub,eq_index] = get_complementarity_conditions(M,ramsey_policy)
|
|||
% from complementarity setup used in
|
||||
% perfect_foresight_mcp_problem.m
|
||||
|
||||
% Copyright (C) 2014-2017 Dynare Team
|
||||
% Copyright (C) 2014-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -58,7 +58,7 @@ for i=1:size(etags,1)
|
|||
str = etags{i,3};
|
||||
kop = strfind(etags{i,3},'<');
|
||||
if ~isempty(kop)
|
||||
k = find(strcmp(strtrim(str(1:kop-1)),cellstr(M.endo_names))); %get variable index with restriction
|
||||
k = find(strcmp(strtrim(str(1:kop-1)), M.endo_names)); %get variable index with restriction
|
||||
if isempty(k)
|
||||
error(sprintf(['Complementarity condition %s: variable %s is ' ...
|
||||
'not recognized'],etags{i,3},strtrim(str(1:kop-1))))
|
||||
|
@ -69,7 +69,7 @@ for i=1:size(etags,1)
|
|||
else
|
||||
kop = strfind(etags{i,3},'>');
|
||||
if ~isempty(kop)
|
||||
k = find(strcmp(strtrim(str(1:kop-1)),cellstr(M.endo_names))); %get variable index with restriction
|
||||
k = find(strcmp(strtrim(str(1:kop-1)), M.endo_names)); %get variable index with restriction
|
||||
if isempty(k)
|
||||
error(sprintf(['Complementarity condition %s: variable %s is ' ...
|
||||
'not recognized'],etags{i,3},strtrim(str(1:kop-1))))
|
||||
|
|
|
@ -24,7 +24,7 @@ function [x,f,fvec,check]=lnsrch1(xold, fold, g, p, stpmax, func, j1, j2, tolx,
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2001-2017 Dynare Team
|
||||
% Copyright (C) 2001-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -58,14 +58,14 @@ if ~isfinite(summ)
|
|||
var_string=[];
|
||||
Model=evalin('base','M_');
|
||||
for ii=1:length(j2)-1
|
||||
var_string=[var_string, deblank(Model.endo_names(j2(ii),:)), ', '];
|
||||
var_string=[var_string, Model.endo_names{j2(ii)}, ', '];
|
||||
end
|
||||
var_string=[var_string, deblank(Model.endo_names(j2(end),:))];
|
||||
var_string=[var_string, Model.endo_names{j2(end)}];
|
||||
fprintf('\nAn infinite element was encountered when trying to solve equation(s) %s \n',eq_number_string)
|
||||
fprintf('with respect to the variable(s): %s.\n',var_string)
|
||||
fprintf('The values of the endogenous variables when the problem was encountered were:\n')
|
||||
for ii=1:length(xold)
|
||||
fprintf('%-s % 8.4g \n',Model.endo_names(ii,:),xold(ii));
|
||||
fprintf('%-s % 8.4g \n', Model.endo_names{ii}, xold(ii));
|
||||
end
|
||||
skipline();
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function data = load_mat_file_data_legacy(datafile, varobs)
|
||||
|
||||
% Copyright (C) 2017 Dynare Team
|
||||
% Copyright (C) 2017-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -32,9 +32,9 @@ else
|
|||
data_mat=[];
|
||||
for var_iter=1:length(varobs)
|
||||
try
|
||||
data_mat=[data_mat vec(data_file.(varobs{1,var_iter}))];
|
||||
data_mat=[data_mat vec(data_file.(varobs{var_iter}))];
|
||||
catch
|
||||
error('makedataset: The variable %s does not have dimensions conformable with the previous one',varobs{1,var_iter});
|
||||
error(['makedataset: The variable %s does not have dimensions conformable with the previous one'], varobs{var_iter});
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ function [marginal,oo_] = marginal_density(M_, options_, estim_params_, oo_, bay
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2005-2017 Dynare Team
|
||||
% Copyright (C) 2005-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -167,7 +167,7 @@ if nvx
|
|||
ip = 1;
|
||||
for i=1:nvx
|
||||
k = estim_params_.var_exo(i,1);
|
||||
name = deblank(M_.exo_names(k,:));
|
||||
name = M_.exo_names{k};
|
||||
eval(['oo_.' field_name '_mode.shocks_std.' name ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.shocks_std.' name ' = stdh(ip);']);
|
||||
ip = ip+1;
|
||||
|
@ -188,7 +188,7 @@ if ncx
|
|||
for i=1:ncx
|
||||
k1 = estim_params_.corrx(i,1);
|
||||
k2 = estim_params_.corrx(i,2);
|
||||
NAME = [deblank(M_.exo_names(k1,:)) '_' deblank(M_.exo_names(k2,:))];
|
||||
NAME = [M_.exo_names{k1} '_' M_.exo_names{k2}];
|
||||
eval(['oo_.' field_name '_mode.shocks_corr.' NAME ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.shocks_corr.' NAME ' = stdh(ip);']);
|
||||
ip = ip+1;
|
||||
|
@ -200,7 +200,7 @@ if ncn
|
|||
for i=1:ncn
|
||||
k1 = estim_params_.corrn(i,1);
|
||||
k2 = estim_params_.corrn(i,2);
|
||||
NAME = [deblank(M_.endo_names(k1,:)) '_' deblank(M_.endo_names(k2,:))];
|
||||
NAME = [M_.endo_names{k1} '_' M_.endo_names{k2}];
|
||||
eval(['oo_.' field_name '_mode.measurement_errors_corr.' NAME ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.measurement_errors_corr.' NAME ' = stdh(ip);']);
|
||||
ip = ip+1;
|
||||
|
|
|
@ -20,7 +20,7 @@ function oo = model_comparison(ModelNames,ModelPriors,oo,options_,fname)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2007-2017 Dynare Team
|
||||
% Copyright (C) 2007-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -114,42 +114,36 @@ lmpd = log(ModelPriors)+MarginalLogDensity;
|
|||
elmpd = exp(lmpd-maxval);
|
||||
|
||||
% Now I display the posterior probabilities.
|
||||
headers = char('Model',ShortModelNames{:});
|
||||
headers = vertcat('Model', ShortModelNames);
|
||||
if prior_flag
|
||||
labels = char('Priors','Log Marginal Density','Bayes Ratio', ...
|
||||
'Posterior Model Probability');
|
||||
field_labels={'Prior','Log_Marginal_Density','Bayes_Ratio', ...
|
||||
'Posterior_Model_Probability'};
|
||||
values = [ModelPriors';MarginalLogDensity';exp(lmpd-lmpd(1))'; ...
|
||||
elmpd'/sum(elmpd)];
|
||||
labels = {'Priors'; 'Log Marginal Density'; 'Bayes Ratio'; 'Posterior Model Probability'};
|
||||
field_labels={'Prior','Log_Marginal_Density','Bayes_Ratio', 'Posterior_Model_Probability'};
|
||||
values = [ModelPriors';MarginalLogDensity';exp(lmpd-lmpd(1))'; elmpd'/sum(elmpd)];
|
||||
else
|
||||
labels = char('Priors','Log Marginal Density','Bayes Ratio','Posterior Odds Ratio', ...
|
||||
'Posterior Model Probability');
|
||||
labels = {'Priors'; 'Log Marginal Density'; 'Bayes Ratio'; 'Posterior Odds Ratio'; 'Posterior Model Probability'};
|
||||
field_labels={'Prior','Log_Marginal_Density','Bayes_Ratio','Posterior_Odds_Ratio','Posterior_Model_Probability'};
|
||||
values = [ModelPriors';MarginalLogDensity'; exp(MarginalLogDensity-MarginalLogDensity(1))'; ...
|
||||
exp(lmpd-lmpd(1))'; elmpd'/sum(elmpd)];
|
||||
values = [ModelPriors';MarginalLogDensity'; exp(MarginalLogDensity-MarginalLogDensity(1))'; exp(lmpd-lmpd(1))'; elmpd'/sum(elmpd)];
|
||||
end
|
||||
|
||||
for model_iter=1:NumberOfModels
|
||||
for var_iter=1:size(labels,1)
|
||||
oo.Model_Comparison.(deblank(headers(1+model_iter,:))).(field_labels{var_iter})=values(var_iter,model_iter);
|
||||
for model_iter = 1:NumberOfModels
|
||||
for var_iter = 1:length(labels)
|
||||
oo.Model_Comparison.(headers{1+model_iter}).(field_labels{var_iter}) = values(var_iter, model_iter);
|
||||
end
|
||||
end
|
||||
|
||||
dyntable(options_,title,headers,labels,values, 0, 15, 6);
|
||||
dyntable(options_, title, headers, labels, values, 0, 15, 6);
|
||||
if options_.TeX
|
||||
M_temp.fname=fname;
|
||||
M_temp.dname=fname;
|
||||
headers_tex='';
|
||||
for ii=1:size(headers,1)
|
||||
headers_tex=strvcat(headers_tex,strrep(headers(ii,:),'_', '\_'));
|
||||
M_temp.fname = fname;
|
||||
M_temp.dname = fname;
|
||||
headers_tex = {};
|
||||
for ii = 1:length(headers)
|
||||
headers_tex = vertcat(headers_tex, strrep(headers{ii}, '_', '\_'));
|
||||
end
|
||||
labels_tex='';
|
||||
for ii=1:size(labels,1)
|
||||
labels_tex=strvcat(labels_tex,strrep(labels(ii,:),' ', '\ '));
|
||||
labels_tex = {};
|
||||
for ii = 1:length(labels)
|
||||
labels_tex = vertcat(labels_tex, strrep(labels{ii},' ', '\ '));
|
||||
end
|
||||
|
||||
dyn_latex_table(M_temp,options_,title,['model_comparison',type],headers_tex,labels_tex,values,0,16,6);
|
||||
dyn_latex_table(M_temp, options_, title, ['model_comparison', type], headers_tex, labels_tex, values, 0, 16, 6);
|
||||
end
|
||||
|
||||
function name = get_model_name_without_path(modelname)
|
||||
|
@ -178,9 +172,9 @@ name = modelname(1:end-4);
|
|||
|
||||
function modellist = get_short_names(modelnames)
|
||||
n = length(modelnames);
|
||||
modellist = {};
|
||||
modellist = cell(n, 1);
|
||||
for i=1:n
|
||||
name = get_model_name_without_extension(modelnames{i});
|
||||
name = get_model_name_without_path(name);
|
||||
modellist = {modellist{:} name};
|
||||
modellist(i) = {name};
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ function model_diagnostics(M,options,oo)
|
|||
% none.
|
||||
%
|
||||
|
||||
% Copyright (C) 1996-2017 Dynare Team
|
||||
% Copyright (C) 1996-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -50,7 +50,7 @@ if ~isempty(k)
|
|||
disp(['MODEL_DIAGNOSTICS: The following endogenous variables aren''t present at ' ...
|
||||
'the current period in the model:'])
|
||||
for i=1:length(k)
|
||||
disp(endo_names(k(i),:))
|
||||
disp(endo_names{k(i)})
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -154,7 +154,7 @@ for b=1:nb
|
|||
break
|
||||
end
|
||||
end
|
||||
disp(endo_names(k,:))
|
||||
disp(endo_names{k})
|
||||
end
|
||||
neq = null(jacob');
|
||||
n_rel = size(neq,2);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function model_info(varargin)
|
||||
%function model_info;
|
||||
|
||||
% Copyright (C) 2008-2017 Dynare Team
|
||||
% Copyright (C) 2008-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -57,9 +57,9 @@ if(isfield(M_,block_structre_str))
|
|||
end
|
||||
for j=1:size_block
|
||||
if(j==1)
|
||||
fprintf('| %10d | %10d | %30s | %14d | %-6d %24s |\n',i,size_block,Sym_type(block_structure.block(i).Simulation_Type),block_structure.block(i).equation(j),block_structure.block(i).variable(j),M_.endo_names(block_structure.block(i).variable(j),:));
|
||||
fprintf('| %10d | %10d | %30s | %14d | %-6d %24s |\n',i,size_block,Sym_type(block_structure.block(i).Simulation_Type),block_structure.block(i).equation(j),block_structure.block(i).variable(j),M_.endo_names{block_structure.block(i).variable(j)});
|
||||
else
|
||||
fprintf('| %10s | %10s | %30s | %14d | %-6d %24s |\n','','','',block_structure.block(i).equation(j),block_structure.block(i).variable(j),M_.endo_names(block_structure.block(i).variable(j),:));
|
||||
fprintf('| %10s | %10s | %30s | %14d | %-6d %24s |\n','','','',block_structure.block(i).equation(j),block_structure.block(i).variable(j),M_.endo_names{block_structure.block(i).variable(j)});
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -76,7 +76,7 @@ if(isfield(M_,block_structre_str))
|
|||
last=99999999;
|
||||
for i=1:size_IM
|
||||
if(last~=IM(i,2))
|
||||
fprintf('\n%-30s',M_.endo_names(IM(i,2),:));
|
||||
fprintf('\n%-30s',M_.endo_names{IM(i,2)});
|
||||
end
|
||||
fprintf(' %5d',IM(i,1));
|
||||
last=IM(i,2);
|
||||
|
@ -100,7 +100,7 @@ if(isfield(M_,block_structre_str))
|
|||
last=99999999;
|
||||
for i=1:size_IM
|
||||
if(last~=IM(i,2))
|
||||
fprintf('\n%-30s',M_.endo_names(IM(i,2),:));
|
||||
fprintf('\n%-30s',M_.endo_names{IM(i,2)});
|
||||
end
|
||||
fprintf(' %5d',IM(i,1));
|
||||
last=IM(i,2);
|
||||
|
@ -122,16 +122,16 @@ if(isfield(M_,block_structre_str))
|
|||
end
|
||||
end
|
||||
seq = 1: M_.endo_nbr;
|
||||
blank = [ blanks(size(M_.endo_names,2)); blanks(size(M_.endo_names,2))];
|
||||
blank = [ blanks(cellofchararraymaxlength(M_.endo_names)); blanks(cellofchararraymaxlength(M_.endo_names))];
|
||||
for i = 1:M_.endo_nbr
|
||||
if i == 1
|
||||
var_names = [blank; M_.endo_names(i,:)];
|
||||
var_names = char(blank, M_.endo_names{i});
|
||||
else
|
||||
var_names = [var_names; blank; M_.endo_names(i,:)];
|
||||
var_names = char(var_names, blank, M_.endo_names{i});
|
||||
end
|
||||
end
|
||||
if incidence
|
||||
topp = [char(kron(double(blanks(ceil(log10(M_.endo_nbr)))),ones(size(M_.endo_names,2),1))) var_names' ];
|
||||
topp = [char(kron(double(blanks(ceil(log10(M_.endo_nbr)))),ones(cellofchararraymaxlength(M_.endo_names),1))) var_names' ];
|
||||
bott = [int2str(seq') blanks(M_.endo_nbr)' blanks(M_.endo_nbr)' IM_star];
|
||||
fprintf('\n Gross incidence matrix\n');
|
||||
fprintf(' =======================\n');
|
||||
|
@ -141,7 +141,7 @@ if(isfield(M_,block_structre_str))
|
|||
IM_star_reordered = char([kron(ones(M_.endo_nbr, M_.endo_nbr-1), double(blanks(3))) double(blanks(M_.endo_nbr)')]);
|
||||
eq(block_structure.equation_reordered) = seq;
|
||||
va(block_structure.variable_reordered) = seq;
|
||||
barre_blank = [ barre(size(M_.endo_names,2)); blanks(size(M_.endo_names,2))];
|
||||
barre_blank = [ barre(cellofchararraymaxlength(M_.endo_names)); blanks(cellofchararraymaxlength(M_.endo_names))];
|
||||
cur_block = 1;
|
||||
for i = 1:M_.endo_nbr
|
||||
past_block = cur_block;
|
||||
|
@ -149,16 +149,16 @@ if(isfield(M_,block_structre_str))
|
|||
cur_block = cur_block + 1;
|
||||
end
|
||||
if i == 1
|
||||
var_names = [blank; M_.endo_names(block_structure.variable_reordered(i),:)];
|
||||
var_names = [blank; M_.endo_names{block_structure.variable_reordered(i)}];
|
||||
else
|
||||
if past_block ~= cur_block
|
||||
var_names = [var_names; barre_blank; M_.endo_names(block_structure.variable_reordered(i),:)];
|
||||
var_names = [var_names; barre_blank; M_.endo_names{block_structure.variable_reordered(i)}];
|
||||
else
|
||||
var_names = [var_names; blank; M_.endo_names(block_structure.variable_reordered(i),:)];
|
||||
var_names = [var_names; blank; M_.endo_names{block_structure.variable_reordered(i)}];
|
||||
end
|
||||
end
|
||||
end
|
||||
topp = [char(kron(double(blanks(ceil(log10(M_.endo_nbr)))),ones(size(M_.endo_names,2),1))) var_names' ];
|
||||
topp = [char(kron(double(blanks(ceil(log10(M_.endo_nbr)))),ones(cellofchararraymaxlength(M_.endo_names),1))) var_names' ];
|
||||
n_state_var = length(M_.state_var);
|
||||
IM_state_var = zeros(n_state_var, n_state_var);
|
||||
inv_variable_reordered(block_structure.variable_reordered) = 1:M_.endo_nbr;
|
||||
|
|
|
@ -15,7 +15,7 @@ function [endogenousvariables, exogenousvariables] = model_inversion(constraints
|
|||
%
|
||||
% REMARKS
|
||||
|
||||
% Copyright (C) 2017 Dynare Team
|
||||
% Copyright (C) 2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -69,8 +69,8 @@ if exogenousvariables.vobs>constraints.vobs
|
|||
end
|
||||
|
||||
% Get the list of endogenous and exogenous variables.
|
||||
endo_names = cellstr(DynareModel.endo_names);
|
||||
exo_names = cellstr(DynareModel.exo_names);
|
||||
endo_names = DynareModel.endo_names;
|
||||
exo_names = DynareModel.exo_names;
|
||||
|
||||
% Use specidalized routine if the model is backward looking.
|
||||
if ~DynareModel.maximum_lead
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit dfa40f0b7506cfdee02c69c33eeb26180a22e76f
|
||||
Subproject commit 53d1e479c4e568ce1fda6b52efa202fa32fedefa
|
|
@ -15,7 +15,7 @@ function plot_ms_forecast(M_, options_, forecast, figure_name)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011-2017 Dynare Team
|
||||
% Copyright (C) 2011-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -36,18 +36,18 @@ nc = 2;
|
|||
nr = 2;
|
||||
nvars = M_.endo_nbr;
|
||||
endo_names = M_.endo_names;
|
||||
var_list = endo_names(1:M_.orig_endo_nbr,:);
|
||||
var_list = endo_names(1:M_.orig_endo_nbr);
|
||||
names = {};
|
||||
tex_names = {};
|
||||
m = 1;
|
||||
for i = 1:size(var_list)
|
||||
tmp = strmatch(var_list(i,:),endo_names,'exact');
|
||||
for i = 1:length(var_list)
|
||||
tmp = strmatch(var_list{i}, endo_names, 'exact');
|
||||
if isempty(tmp)
|
||||
error([var_list(i,:) ' isn''t and endogenous variable'])
|
||||
error([var_list{i} ' isn''t and endogenous variable'])
|
||||
end
|
||||
tex_name = deblank(M_.endo_names_tex(i,:));
|
||||
tex_name = M_.endo_names_tex{i};
|
||||
if ~isempty(tex_name)
|
||||
names{m} = deblank(var_list(i,:));
|
||||
names{m} = var_list{i};
|
||||
tex_names{m} = tex_name;
|
||||
m = m + 1;
|
||||
end
|
||||
|
@ -98,7 +98,7 @@ for j=1:nvars
|
|||
m = 1;
|
||||
end
|
||||
subplot(nr,nc,m);
|
||||
vn = deblank(endo_names(j,:));
|
||||
vn = endo_names{j};
|
||||
plot(forecast(:,j))
|
||||
title(vn,'Interpreter','none');
|
||||
grid on;
|
||||
|
@ -130,7 +130,7 @@ for j=1:nvars
|
|||
m = 1;
|
||||
end
|
||||
subplot(nr,nc,m);
|
||||
vn = deblank(endo_names(j,:));
|
||||
vn = endo_names{j};
|
||||
for k=1:num_percentiles
|
||||
if ceil(num_percentiles/2) == k
|
||||
plot(forecast(k,:,j),'LineWidth',1.5)
|
||||
|
|
|
@ -15,7 +15,7 @@ function plot_ms_irf(M_, options_, irf, figure_name, varlist)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011-2017 Dynare Team
|
||||
% Copyright (C) 2011-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -40,29 +40,29 @@ nvars = M_.endo_nbr;
|
|||
endo_names = M_.endo_names;
|
||||
|
||||
if isempty(varlist)
|
||||
var_list = endo_names(1:M_.orig_endo_nbr,:);
|
||||
var_list = endo_names(1:M_.orig_endo_nbr);
|
||||
end
|
||||
|
||||
names = {};
|
||||
tex_names = {};
|
||||
m = 1;
|
||||
for i = 1:size(var_list)
|
||||
tmp = strmatch(var_list(i,:),endo_names,'exact');
|
||||
for i = 1:length(var_list)
|
||||
tmp = strmatch(var_list{i}, endo_names, 'exact');
|
||||
if isempty(tmp)
|
||||
error([var_list(i,:) ' isn''t and endogenous variable'])
|
||||
error([var_list{i} ' isn''t and endogenous variable'])
|
||||
end
|
||||
tex_name = deblank(M_.endo_names_tex(tmp,:));
|
||||
tex_name = M_.endo_names_tex{tmp};
|
||||
if ~isempty(tex_name)
|
||||
names{m} = deblank(var_list(i,:));
|
||||
names{m} = var_list{i};
|
||||
tex_names{m} = tex_name;
|
||||
m = m + 1;
|
||||
end
|
||||
end
|
||||
|
||||
for i=1:M_.exo_nbr
|
||||
tex_name = deblank(M_.exo_names_tex(i,:));
|
||||
tex_name = M_.exo_names_tex{i};
|
||||
if ~isempty(tex_name)
|
||||
names{m} = deblank(M_.exo_names(i,:));
|
||||
names{m} = M_.exo_names{i};
|
||||
tex_names{m} = tex_name;
|
||||
m = m + 1;
|
||||
end
|
||||
|
@ -81,7 +81,7 @@ else
|
|||
error('The impulse response matrix passed to be plotted does not appear to be the correct size');
|
||||
end
|
||||
|
||||
if size(endo_names,1) ~= nvars
|
||||
if length(endo_names) ~= nvars
|
||||
error('The names passed are not the same length as the number of variables');
|
||||
end
|
||||
|
||||
|
@ -92,7 +92,7 @@ if num_percentiles == 1
|
|||
for i=1:nvars
|
||||
shock(:,i) = irf(:,((i-1) + ((s-1)*nvars)+1));
|
||||
end
|
||||
plot_point_irf_for_shock(shock, nvars,endo_names, deblank(endo_names(s,:)), ...
|
||||
plot_point_irf_for_shock(shock, nvars,endo_names, endo_names{s}, ...
|
||||
figure_name, [options_.ms.output_file_tag filesep 'Output' filesep 'IRF'], options_, names, tex_names);
|
||||
end
|
||||
else
|
||||
|
@ -103,7 +103,7 @@ else
|
|||
shock(:,i,n) = irf(n,:,((i-1) + ((s-1)*nvars)+1));
|
||||
end
|
||||
end
|
||||
plot_banded_irf_for_shock(shock, nvars,endo_names, deblank(endo_names(s,:)), ...
|
||||
plot_banded_irf_for_shock(shock, nvars,endo_names, endo_names{s}, ...
|
||||
figure_name, [options_.ms.output_file_tag filesep 'Output' filesep 'IRF'], options_, names, tex_names);
|
||||
end
|
||||
end
|
||||
|
@ -114,8 +114,8 @@ fig = figure('Name',figure_name);
|
|||
for k=1:nvars
|
||||
subplot(ceil(sqrt(nvars)), ceil(sqrt(nvars)),k);
|
||||
plot(irf(:,k))
|
||||
disp([endo_names(k,:) ' shock from ' shock_name]);
|
||||
title([endo_names(k,:) ' shock from ' shock_name]);
|
||||
disp([endo_names{k} ' shock from ' shock_name]);
|
||||
title([endo_names{k} ' shock from ' shock_name]);
|
||||
end
|
||||
dyn_save_graph(dirname,[figure_name ' ' shock_name],options_.graph_save_formats, ...
|
||||
options_.TeX,names,tex_names,[figure_name ' ' shock_name]);
|
||||
|
@ -131,8 +131,8 @@ for k=1:nvars
|
|||
hold on
|
||||
end
|
||||
hold off
|
||||
disp([endo_names(k,:) ' shock from ' shock_name]);
|
||||
title([endo_names(k,:) ' shock from ' shock_name]);
|
||||
disp([endo_names{k} ' shock from ' shock_name]);
|
||||
title([endo_names{k} ' shock from ' shock_name]);
|
||||
end
|
||||
dyn_save_graph(dirname,[figure_name ' ' shock_name],options_.graph_save_formats, ...
|
||||
options_.TeX,names,tex_names,[figure_name ' ' shock_name]);
|
||||
|
|
|
@ -22,7 +22,7 @@ function plot_ms_variance_decomposition(M_, options_, vd, figure_name, varargin)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011-2017 Dynare Team
|
||||
% Copyright (C) 2011-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -51,9 +51,9 @@ names = {};
|
|||
tex_names = {};
|
||||
m = 1;
|
||||
for i=1:M_.orig_endo_nbr
|
||||
tex_name = deblank(M_.endo_names_tex(i,:));
|
||||
tex_name = M_.endo_names_tex{i};
|
||||
if ~isempty(tex_name)
|
||||
names{m} = deblank(endo_names(i,:));
|
||||
names{m} = endo_names{i};
|
||||
tex_names{m} = tex_name;
|
||||
m = m + 1;
|
||||
end
|
||||
|
@ -79,8 +79,8 @@ else
|
|||
end
|
||||
|
||||
for i=1:nvars
|
||||
shock_names{i} = endo_names(i,:);
|
||||
series_names{i} = endo_names(i,:);
|
||||
shock_names{i} = endo_names{i};
|
||||
series_names{i} = endo_names{i};
|
||||
end
|
||||
|
||||
x = [1:T];
|
||||
|
|
|
@ -15,7 +15,7 @@ function plot_ms_variance_decomposition_error_bands(M_, options_, vddata, figure
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011-2017 Dynare Team
|
||||
% Copyright (C) 2011-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -34,28 +34,28 @@ function plot_ms_variance_decomposition_error_bands(M_, options_, vddata, figure
|
|||
|
||||
nvars = M_.endo_nbr;
|
||||
endo_names = M_.endo_names;
|
||||
var_list = endo_names(1:M_.orig_endo_nbr,:);
|
||||
var_list = endo_names(1:M_.orig_endo_nbr);
|
||||
|
||||
names = {};
|
||||
tex_names = {};
|
||||
m = 1;
|
||||
for i = 1:size(var_list)
|
||||
tmp = strmatch(var_list(i,:), endo_names, 'exact');
|
||||
for i = 1:length(var_list)
|
||||
tmp = strmatch(var_list{i}, endo_names, 'exact');
|
||||
if isempty(tmp)
|
||||
error([var_list(i,:) ' isn''t an endogenous variable'])
|
||||
error([var_list{i} ' isn''t an endogenous variable'])
|
||||
end
|
||||
tex_name = deblank(M_.endo_names_tex(tmp,:));
|
||||
tex_name = M_.endo_names_tex{tmp};
|
||||
if ~isempty(tex_name)
|
||||
names{m} = deblank(var_list(i,:));
|
||||
names{m} = var_list{i};
|
||||
tex_names{m} = tex_name;
|
||||
m = m + 1;
|
||||
end
|
||||
end
|
||||
|
||||
for i=1:M_.exo_nbr
|
||||
tex_name = deblank(M_.exo_names_tex(i,:));
|
||||
tex_name = M_.exo_names_tex{i};
|
||||
if ~isempty(tex_name)
|
||||
names{m} = deblank(M_.exo_names(i,:));
|
||||
names{m} = M_.exo_names{i};
|
||||
tex_names{m} = tex_name;
|
||||
m = m + 1;
|
||||
end
|
||||
|
@ -67,7 +67,7 @@ if length(dims) ~= 3
|
|||
end
|
||||
num_percentiles = dims(1);
|
||||
|
||||
if size(endo_names, 1) ~= nvars
|
||||
if length(endo_names) ~= nvars
|
||||
error('The names passed are not the same length as the number of variables')
|
||||
end
|
||||
|
||||
|
@ -79,7 +79,7 @@ for s=1:nvars
|
|||
end
|
||||
end
|
||||
plot_banded_vddata_for_shock(shock, nvars, endo_names, ...
|
||||
deblank(endo_names(s,:)), figure_name, ...
|
||||
endo_names{s}, figure_name, ...
|
||||
[options_.ms.output_file_tag filesep 'Output' filesep 'Variance_Decomposition'], ...
|
||||
options_, names, tex_names);
|
||||
end
|
||||
|
@ -96,8 +96,8 @@ for k=1:nvars
|
|||
hold on
|
||||
end
|
||||
hold off
|
||||
disp([endo_names(k,:) ' contribution to ' shock_name]);
|
||||
title([endo_names(k,:) ' contribution to ' shock_name]);
|
||||
disp([endo_names{k} ' contribution to ' shock_name]);
|
||||
title([endo_names{k} ' contribution to ' shock_name]);
|
||||
end
|
||||
dyn_save_graph(dirname, [figure_name ' ' shock_name], ...
|
||||
options_.graph_save_formats, options_.TeX, names, tex_names, ...
|
||||
|
|
|
@ -12,7 +12,7 @@ function dr=mult_elimination(varlist,M_, options_, oo_)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
% Copyright (C) 2003-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -34,7 +34,7 @@ dr = oo_.dr;
|
|||
nstatic = M_.nstatic;
|
||||
nspred = M_.nspred;
|
||||
order_var = dr.order_var;
|
||||
nstates = M_.endo_names(order_var(nstatic+(1:nspred)),:);
|
||||
nstates = M_.endo_names(order_var(nstatic+(1:nspred)));
|
||||
|
||||
il = strmatch('MULT_',nstates);
|
||||
nil = setdiff(1:nspred,il);
|
||||
|
@ -103,10 +103,10 @@ nvar = length(varlist);
|
|||
|
||||
if nvar > 0 && options_.noprint == 0
|
||||
res_table = zeros(2*(nm_nbr+M_.exo_nbr),nvar);
|
||||
headers = 'Variables';
|
||||
headers = {'Variables'};
|
||||
for i=1:length(varlist)
|
||||
k = strmatch(varlist{i},M_.endo_names(dr.order_var,:),'exact');
|
||||
headers = char(headers,varlist{i});
|
||||
k = strmatch(varlist{i}, M_.endo_names(dr.order_var), 'exact');
|
||||
headers = vertcat(headers, varlist{i});
|
||||
|
||||
res_table(1:nm_nbr,i) = M1(k,:)';
|
||||
res_table(nm_nbr+(1:nm_nbr),i) = M2(k,:)';
|
||||
|
@ -115,19 +115,12 @@ if nvar > 0 && options_.noprint == 0
|
|||
end
|
||||
|
||||
my_title='ELIMINATION OF THE MULTIPLIERS';
|
||||
lab = nstates(nil,:);
|
||||
labels = strcat(deblank(lab(i,:)),'(-1)');
|
||||
for i = 2:size(lab,1)
|
||||
labels = char(labels,strcat(deblank(lab(i,:)),'(-1)'));
|
||||
end
|
||||
for i = 1:size(lab,1)
|
||||
labels = char(labels,strcat(deblank(lab(i,:)),'(-2)'));
|
||||
end
|
||||
labels = char(labels,M_.exo_names);
|
||||
for i = 1:M_.exo_nbr
|
||||
labels = char(labels,strcat(deblank(M_.exo_names(i,:)),'(-1)'));
|
||||
end
|
||||
lab = nstates(nil);
|
||||
labels = cellfun(@(x) horzcat(x, '(-1)'), nstates(nil), 'UniformOutput', false);
|
||||
labels = vertcat(labels, cellfun(@(x) horzcat(x, '(-2)'), nstates(nil), 'UniformOutput', false));
|
||||
labels = vertcat(labels, M_.exo_names);
|
||||
labels = vertcat(labels, cellfun(@(x) horzcat(x, '(-1)'), M_.exo_names, 'UniformOutput', false));
|
||||
lh = size(labels,2)+2;
|
||||
dyntable(options_,my_title,headers,labels,res_table,lh,10,6);
|
||||
dyntable(options_, my_title, headers, labels, res_table, lh, 10, 6);
|
||||
skipline()
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ function i = name2index(options_, M_, estim_params_, type, name1, name2 )
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2008-2017 Dynare Team
|
||||
% Copyright (C) 2008-2018 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -44,7 +44,7 @@ i = [];
|
|||
|
||||
if strcmpi(type,'DeepParameter')
|
||||
i = nvx + nvn + ncx + ncn + ...
|
||||
strmatch(name1,M_.param_names(estim_params_.param_vals(:,1),:),'exact');
|
||||
strmatch(name1, M_.param_names(estim_params_.param_vals(:,1)), 'exact');
|
||||
if nargin>5
|
||||
disp('The last input argument is useless!')
|
||||
end
|
||||
|
@ -56,7 +56,7 @@ end
|
|||
|
||||
if strcmpi(type,'StructuralShock')
|
||||
if nargin<6% Covariance matrix diagonal term.
|
||||
i = strmatch(name1,M_.exo_names(estim_params_.var_exo(:,1),:),'exact');
|
||||
i = strmatch(name1, M_.exo_names(estim_params_.var_exo(:,1)), 'exact');
|
||||
if isempty(i)
|
||||
disp(['The standard deviation of ' name1 ' is not an estimated parameter!'])
|
||||
return
|
||||
|
@ -64,14 +64,14 @@ if strcmpi(type,'StructuralShock')
|
|||
else% Covariance matrix off-diagonal term
|
||||
offset = nvx+nvn;
|
||||
try
|
||||
list_of_structural_shocks = { M_.exo_names(estim_params_.corrx(:,1),:) , M_.exo_names(estim_params_.corrx(:,2),:) };
|
||||
k1 = strmatch(name1,list_of_structural_shocks(:,1),'exact');
|
||||
k2 = strmatch(name2,list_of_structural_shocks(:,2),'exact');
|
||||
list_of_structural_shocks = [ M_.exo_names(estim_params_.corrx(:,1)) , M_.exo_names(estim_params_.corrx(:,2)) ];
|
||||
k1 = strmatch(name1, list_of_structural_shocks(:,1), 'exact');
|
||||
k2 = strmatch(name2, list_of_structural_shocks(:,2), 'exact');
|
||||
i = offset+intersect(k1,k2);
|
||||
if isempty(i)
|
||||
k1 = strmatch(name1,list_of_structural_shocks(:,2),'exact');
|
||||
k2 = strmatch(name2,list_of_structural_shocks(:,1),'exact');
|
||||
i = offset+intersect(k1,k2);
|
||||
k1 = strmatch(name1, list_of_structural_shocks(:,2), 'exact');
|
||||
k2 = strmatch(name2, list_of_structural_shocks(:,1), 'exact');
|
||||
i = offset+intersect(k1, k2);
|
||||
end
|
||||
if isempty(i)
|
||||
if isempty(i)
|
||||
|
@ -87,7 +87,7 @@ end
|
|||
|
||||
if strcmpi(type,'MeasurementError')
|
||||
if nargin<6% Covariance matrix diagonal term
|
||||
i = nvx + strmatch(name1,M_.endo_names(estim_params_.var_endo(:,1),:),'exact');
|
||||
i = nvx + strmatch(name1, M_.endo_names{estim_params_.var_endo(:,1)}, 'exact');
|
||||
if isempty(i)
|
||||
disp(['The standard deviation of the measurement error on ' name1 ' is not an estimated parameter!'])
|
||||
return
|
||||
|
@ -95,7 +95,7 @@ if strcmpi(type,'MeasurementError')
|
|||
else% Covariance matrix off-diagonal term
|
||||
offset = nvx+nvn+ncx;
|
||||
try
|
||||
list_of_measurement_errors = { M_.endo_names(estim_params_.corrn(:,1),:) , M_.endo_names(estim_params_.corrn(:,2),:) };
|
||||
list_of_measurement_errors = { M_.endo_names{estim_params_.corrn(:,1)} , M_.endo_names{estim_params_.corrn(:,2)} };
|
||||
k1 = strmatch(name1,list_of_measurement_errors(:,1),'exact');
|
||||
k2 = strmatch(name2,list_of_measurement_errors(:,2),'exact');
|
||||
i = offset+intersect(k1,k2);
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
|
||||
% unpack the IRFs
|
||||
for i=1:Mbase_.endo_nbr
|
||||
eval([deblank(Mbase_.endo_names(i,:)),'_uncdifference=zdatalinear(:,i);']);
|
||||
eval([deblank(Mbase_.endo_names(i,:)),'_difference=zdatapiecewise(:,i);']);
|
||||
eval([deblank(Mbase_.endo_names(i,:)),'_ss=zdatass(i);']);
|
||||
eval([Mbase_.endo_names{i}, '_uncdifference=zdatalinear(:,i);']);
|
||||
eval([Mbase_.endo_names{i}, '_difference=zdatapiecewise(:,i);']);
|
||||
eval([Mbase_.endo_names{i}, '_ss=zdatass(i);']);
|
||||
end
|
||||
|
||||
|
||||
nparams = size(Mbase_.param_names,1);
|
||||
nparams = length(Mbase_.param_names);
|
||||
|
||||
for i = 1:nparams
|
||||
eval([Mbase_.param_names(i,:),'= Mbase_.params(i);']);
|
||||
eval([Mbase_.param_names{i}, '= Mbase_.params(i);']);
|
||||
end
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
|
||||
|
||||
for i=1:Mbase_.endo_nbr
|
||||
eval([deblank(Mbase_.endo_names(i,:)),'_uncdifference=zdatalinear(:,i);']);
|
||||
eval([deblank(Mbase_.endo_names(i,:)),'_difference=zdatapiecewise(:,i);']);
|
||||
eval([deblank(Mbase_.endo_names(i,:)),'_ss=zdatass(i);']);
|
||||
eval([Mbase_.endo_names{i}, '_uncdifference=zdatalinear(:,i);']);
|
||||
eval([Mbase_.endo_names{i}, '_difference=zdatapiecewise(:,i);']);
|
||||
eval([Mbase_.endo_names{i}, '_ss=zdatass(i);']);
|
||||
end
|
||||
|
||||
constraint1_difference = process_constraint(constraint1,'_difference',Mbase_.endo_names,0);
|
||||
constraint2_difference = process_constraint(constraint2,'_difference',Mbase_.endo_names,0);
|
||||
constraint1_difference = process_constraint(constraint1, '_difference', Mbase_.endo_names,0);
|
||||
constraint2_difference = process_constraint(constraint2, '_difference', Mbase_.endo_names,0);
|
||||
|
||||
nparams = size(Mbase_.param_names,1);
|
||||
nparams = length(Mbase_.param_names);
|
||||
|
||||
for i = 1:nparams
|
||||
eval([Mbase_.param_names(i,:),'= Mbase_.params(i);']);
|
||||
eval([Mbase_.param_names{i}, '= Mbase_.params(i);']);
|
||||
end
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue