added dname as argument to CheckPath function and changed all calls to
this function. Suppressed use of globals in CheckPath.time-shift
parent
d0e458eb79
commit
7408714ea1
|
@ -1,8 +1,9 @@
|
||||||
function DirectoryName = CheckPath(type)
|
function DirectoryName = CheckPath(type,dname)
|
||||||
% Creates the subfolder "./M_.dname/type" if it does not exist yet.
|
% Creates the subfolder "./M_.dname/type" if it does not exist yet.
|
||||||
%
|
%
|
||||||
% INPUTS
|
% INPUTS
|
||||||
% type [string] Name of the subfolder.
|
% type [string] Name of the subfolder.
|
||||||
|
% dname [string] Name of the directory
|
||||||
%
|
%
|
||||||
% OUTPUTS
|
% OUTPUTS
|
||||||
% none.
|
% none.
|
||||||
|
@ -27,14 +28,12 @@ function DirectoryName = CheckPath(type)
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
global M_
|
DirectoryName = [ dname '/' type ];
|
||||||
|
|
||||||
DirectoryName = [ M_.dname '/' type ];
|
if ~isdir(dname)
|
||||||
|
|
||||||
if ~isdir(M_.dname)
|
|
||||||
% Make sure there isn't a file with the same name, see trac ticket #47
|
% Make sure there isn't a file with the same name, see trac ticket #47
|
||||||
delete(M_.dname)
|
delete(dname)
|
||||||
mkdir('.', M_.dname);
|
mkdir('.', dname);
|
||||||
end
|
end
|
||||||
|
|
||||||
if ~isdir(DirectoryName)
|
if ~isdir(DirectoryName)
|
||||||
|
|
|
@ -33,7 +33,7 @@ function CutSample(M_, options_, estim_params_)
|
||||||
|
|
||||||
npar = estim_params_.np+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.nvx;
|
npar = estim_params_.np+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.nvx;
|
||||||
|
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
file = dir([ DirectoryName ,filesep, M_.fname '_mh_history.mat']);
|
file = dir([ DirectoryName ,filesep, M_.fname '_mh_history.mat']);
|
||||||
files = dir([ DirectoryName ,filesep, M_.fname '_mh*.mat' ]);
|
files = dir([ DirectoryName ,filesep, M_.fname '_mh*.mat' ]);
|
||||||
if ~length(files)
|
if ~length(files)
|
||||||
|
|
|
@ -39,7 +39,7 @@ nblck = options_.mh_nblck;
|
||||||
|
|
||||||
iline = FirstLine;
|
iline = FirstLine;
|
||||||
linee = 1;
|
linee = 1;
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
|
|
||||||
if nblck>1 && nargin<6
|
if nblck>1 && nargin<6
|
||||||
Draws = zeros(NumberOfDraws*nblck,1);
|
Draws = zeros(NumberOfDraws*nblck,1);
|
||||||
|
|
|
@ -45,8 +45,8 @@ ncn = estim_params_.ncn;
|
||||||
np = estim_params_.np ;
|
np = estim_params_.np ;
|
||||||
nx = nvx+nvn+ncx+ncn+np;
|
nx = nvx+nvn+ncx+ncn+np;
|
||||||
|
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
OutputDirectoryName = CheckPath('Output');
|
OutputDirectoryName = CheckPath('Output',M_.dname);
|
||||||
|
|
||||||
load([ DirectoryName '/' M_.fname '_mh_history'])
|
load([ DirectoryName '/' M_.fname '_mh_history'])
|
||||||
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
||||||
|
|
|
@ -33,8 +33,8 @@ function McMCDiagnostics(options_, estim_params_, M_)
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
DirectoryName = CheckPath('Output');
|
DirectoryName = CheckPath('Output',M_.dname);
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
|
|
||||||
TeX = options_.TeX;
|
TeX = options_.TeX;
|
||||||
nblck = options_.mh_nblck;
|
nblck = options_.mh_nblck;
|
||||||
|
|
|
@ -56,7 +56,7 @@ if whoiam
|
||||||
Parallel=myinputs.Parallel;
|
Parallel=myinputs.Parallel;
|
||||||
end
|
end
|
||||||
if ~exist('MhDirectoryName'),
|
if ~exist('MhDirectoryName'),
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
end
|
end
|
||||||
|
|
||||||
ALPHA = 0.2; % increase too much with the number of simulations.
|
ALPHA = 0.2; % increase too much with the number of simulations.
|
||||||
|
|
|
@ -33,7 +33,7 @@ function oo_ = PlotPosteriorDistributions(estim_params_, M_, options_, bayestopt
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
OutputDirectoryName = CheckPath('Output');
|
OutputDirectoryName = CheckPath('Output',M_.dname);
|
||||||
|
|
||||||
TeX = options_.TeX;
|
TeX = options_.TeX;
|
||||||
nblck = options_.mh_nblck;
|
nblck = options_.mh_nblck;
|
||||||
|
|
|
@ -55,8 +55,8 @@ i_last_obs = gend+(1-M_.maximum_endo_lag:0);
|
||||||
horizon = options_.forecast;
|
horizon = options_.forecast;
|
||||||
maxlag = M_.maximum_endo_lag;
|
maxlag = M_.maximum_endo_lag;
|
||||||
%%
|
%%
|
||||||
CheckPath('Plots/');
|
CheckPath('Plots/',M_.dname);
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
load([ DirectoryName '/' M_.fname '_mh_history.mat'])
|
load([ DirectoryName '/' M_.fname '_mh_history.mat'])
|
||||||
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
||||||
FirstLine = record.KeepedDraws.FirstLine;
|
FirstLine = record.KeepedDraws.FirstLine;
|
||||||
|
|
|
@ -76,17 +76,17 @@ else
|
||||||
MAX_nirfs_dsgevar = 0;
|
MAX_nirfs_dsgevar = 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
DirectoryName = CheckPath('Output');
|
DirectoryName = CheckPath('Output',M_.dname);
|
||||||
if strcmpi(type,'posterior')
|
if strcmpi(type,'posterior')
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
elseif strcmpi(type,'gsa')
|
elseif strcmpi(type,'gsa')
|
||||||
if options_.opt_gsa.pprior
|
if options_.opt_gsa.pprior
|
||||||
MhDirectoryName = CheckPath(['GSA' filesep 'prior']);
|
MhDirectoryName = CheckPath(['GSA' filesep 'prior'],M_.dname);
|
||||||
else
|
else
|
||||||
MhDirectoryName = CheckPath(['GSA' filesep 'mc']);
|
MhDirectoryName = CheckPath(['GSA' filesep 'mc'],M_.dname);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
MhDirectoryName = CheckPath('prior');
|
MhDirectoryName = CheckPath('prior',M_.dname);
|
||||||
end
|
end
|
||||||
delete([MhDirectoryName filesep M_.fname '_IRF_DSGEs*.mat']);
|
delete([MhDirectoryName filesep M_.fname '_IRF_DSGEs*.mat']);
|
||||||
delete([MhDirectoryName filesep M_.fname '_IRF_BVARDSGEs*.mat']);
|
delete([MhDirectoryName filesep M_.fname '_IRF_BVARDSGEs*.mat']);
|
||||||
|
@ -95,7 +95,7 @@ if strcmpi(type,'posterior')
|
||||||
TotalNumberOfMhDraws = sum(record.MhDraws(:,1));
|
TotalNumberOfMhDraws = sum(record.MhDraws(:,1));
|
||||||
NumberOfDraws = TotalNumberOfMhDraws-floor(options_.mh_drop*TotalNumberOfMhDraws);
|
NumberOfDraws = TotalNumberOfMhDraws-floor(options_.mh_drop*TotalNumberOfMhDraws);
|
||||||
elseif strcmpi(type,'gsa')
|
elseif strcmpi(type,'gsa')
|
||||||
RootDirectoryName = CheckPath('gsa');
|
RootDirectoryName = CheckPath('gsa',M_.dname);
|
||||||
if options_.opt_gsa.pprior
|
if options_.opt_gsa.pprior
|
||||||
load([ RootDirectoryName filesep M_.fname '_prior.mat'],'lpmat0','lpmat','istable')
|
load([ RootDirectoryName filesep M_.fname '_prior.mat'],'lpmat0','lpmat','istable')
|
||||||
else
|
else
|
||||||
|
|
|
@ -84,15 +84,15 @@ end
|
||||||
|
|
||||||
% MhDirectoryName = myinputs.MhDirectoryName;
|
% MhDirectoryName = myinputs.MhDirectoryName;
|
||||||
if strcmpi(type,'posterior')
|
if strcmpi(type,'posterior')
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
elseif strcmpi(type,'gsa')
|
elseif strcmpi(type,'gsa')
|
||||||
if options_.opt_gsa.pprior
|
if options_.opt_gsa.pprior
|
||||||
MhDirectoryName = CheckPath(['gsa' filesep 'prior']);
|
MhDirectoryName = CheckPath(['gsa' filesep 'prior'],M_.dname);
|
||||||
else
|
else
|
||||||
MhDirectoryName = CheckPath(['gsa' filesep 'mc']);
|
MhDirectoryName = CheckPath(['gsa' filesep 'mc'],M_.dname);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
MhDirectoryName = CheckPath('prior');
|
MhDirectoryName = CheckPath('prior',M_.dname);
|
||||||
end
|
end
|
||||||
|
|
||||||
RemoteFlag = 0;
|
RemoteFlag = 0;
|
||||||
|
|
|
@ -69,7 +69,7 @@ end
|
||||||
|
|
||||||
% To save the figures where the function is computed!
|
% To save the figures where the function is computed!
|
||||||
|
|
||||||
DirectoryName = CheckPath('Output');
|
DirectoryName = CheckPath('Output',M_.dname);
|
||||||
|
|
||||||
RemoteFlag = 0;
|
RemoteFlag = 0;
|
||||||
if whoiam,
|
if whoiam,
|
||||||
|
|
|
@ -45,22 +45,22 @@ function ReshapeMatFiles(type, type2)
|
||||||
global M_ options_
|
global M_ options_
|
||||||
|
|
||||||
if nargin==1,
|
if nargin==1,
|
||||||
MhDirectoryName = [ CheckPath('metropolis') filesep ];
|
MhDirectoryName = [ CheckPath('metropolis',M_.dname) filesep ];
|
||||||
else
|
else
|
||||||
if strcmpi(type2,'posterior')
|
if strcmpi(type2,'posterior')
|
||||||
MhDirectoryName = [CheckPath('metropolis') filesep ];
|
MhDirectoryName = [CheckPath('metropolis',M_.dname) filesep ];
|
||||||
elseif strcmpi(type2,'gsa')
|
elseif strcmpi(type2,'gsa')
|
||||||
if options_.opt_gsa.morris==1,
|
if options_.opt_gsa.morris==1,
|
||||||
MhDirectoryName = [CheckPath('gsa/screen') filesep ];
|
MhDirectoryName = [CheckPath('gsa/screen',M_.dname) filesep ];
|
||||||
elseif options_.opt_gsa.morris==2,
|
elseif options_.opt_gsa.morris==2,
|
||||||
MhDirectoryName = [CheckPath('gsa/identif') filesep ];
|
MhDirectoryName = [CheckPath('gsa/identif',M_.dname) filesep ];
|
||||||
elseif options_.opt_gsa.pprior
|
elseif options_.opt_gsa.pprior
|
||||||
MhDirectoryName = [CheckPath(['gsa' filesep 'prior']) filesep ];
|
MhDirectoryName = [CheckPath(['gsa' filesep 'prior'],M_.dname) filesep ];
|
||||||
else
|
else
|
||||||
MhDirectoryName = [CheckPath(['gsa' filesep 'mc']) filesep ];
|
MhDirectoryName = [CheckPath(['gsa' filesep 'mc'],M_.dname) filesep ];
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
MhDirectoryName = [CheckPath('prior') filesep ];
|
MhDirectoryName = [CheckPath('prior',M_.dname) filesep ];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
switch type
|
switch type
|
||||||
|
|
|
@ -68,7 +68,7 @@ switch type
|
||||||
otherwise
|
otherwise
|
||||||
disp(['This feature is not yet implemented!'])
|
disp(['This feature is not yet implemented!'])
|
||||||
end
|
end
|
||||||
CheckPath('prior/moments');
|
CheckPath('prior/moments',M_.dname);
|
||||||
pdfinfo = dir([ M_.dname '/prior/' generic_prior_data_file_name '*']);
|
pdfinfo = dir([ M_.dname '/prior/' generic_prior_data_file_name '*']);
|
||||||
if isempty(pdfinfo)
|
if isempty(pdfinfo)
|
||||||
info = 4;
|
info = 4;
|
||||||
|
|
|
@ -42,7 +42,7 @@ n = estim_params_.np + ...
|
||||||
estim_params_.nvx;
|
estim_params_.nvx;
|
||||||
nblck = options_.mh_nblck;
|
nblck = options_.mh_nblck;
|
||||||
|
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
load([ MhDirectoryName '/' M_.fname '_mh_history.mat'])
|
load([ MhDirectoryName '/' M_.fname '_mh_history.mat'])
|
||||||
|
|
||||||
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
||||||
|
|
|
@ -40,7 +40,7 @@ if strcmpi(type,'posterior')
|
||||||
posterior = 1;
|
posterior = 1;
|
||||||
elseif strcmpi(type,'prior')
|
elseif strcmpi(type,'prior')
|
||||||
DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
|
DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
|
||||||
CheckPath('prior/moments');
|
CheckPath('prior/moments',M_.dname);
|
||||||
posterior = 0;
|
posterior = 0;
|
||||||
else
|
else
|
||||||
disp('dsge_simulated_theoretical_conditional_variance_decomposition:: Unknown type!')
|
disp('dsge_simulated_theoretical_conditional_variance_decomposition:: Unknown type!')
|
||||||
|
|
|
@ -40,7 +40,7 @@ if strcmpi(type,'posterior')
|
||||||
posterior = 1;
|
posterior = 1;
|
||||||
elseif strcmpi(type,'prior')
|
elseif strcmpi(type,'prior')
|
||||||
DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
|
DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
|
||||||
CheckPath('prior/moments');
|
CheckPath('prior/moments',M_.dname);
|
||||||
posterior = 0;
|
posterior = 0;
|
||||||
else
|
else
|
||||||
disp('dsge_simulated_theoretical_correlation:: Unknown type!');
|
disp('dsge_simulated_theoretical_correlation:: Unknown type!');
|
||||||
|
|
|
@ -40,7 +40,7 @@ if strcmpi(type,'posterior')
|
||||||
posterior = 1;
|
posterior = 1;
|
||||||
elseif strcmpi(type,'prior')
|
elseif strcmpi(type,'prior')
|
||||||
DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
|
DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
|
||||||
CheckPath('prior/moments');
|
CheckPath('prior/moments',M_.dname);
|
||||||
posterior = 0;
|
posterior = 0;
|
||||||
else
|
else
|
||||||
disp('dsge_simulated_theoretical_covariance:: Unknown type!')
|
disp('dsge_simulated_theoretical_covariance:: Unknown type!')
|
||||||
|
|
|
@ -41,7 +41,7 @@ if strcmpi(type,'posterior')
|
||||||
posterior = 1;
|
posterior = 1;
|
||||||
elseif strcmpi(type,'prior')
|
elseif strcmpi(type,'prior')
|
||||||
DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
|
DrawsFiles = dir([M_.dname '/prior/draws/' type '_draws*' ]);
|
||||||
CheckPath('prior/moments');
|
CheckPath('prior/moments',M_.dname);
|
||||||
posterior = 0;
|
posterior = 0;
|
||||||
else
|
else
|
||||||
disp('dsge_simulated_theoretical_variance_decomposition:: Unknown type!')
|
disp('dsge_simulated_theoretical_variance_decomposition:: Unknown type!')
|
||||||
|
|
|
@ -567,7 +567,7 @@ elseif ~any(bayestopt_.pshape > 0) && options_.mh_posterior_mode_estimation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
OutputDirectoryName = CheckPath('Output');
|
OutputDirectoryName = CheckPath('Output',M_.dname);
|
||||||
|
|
||||||
if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior mode) Latex output
|
if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior mode) Latex output
|
||||||
if np
|
if np
|
||||||
|
|
|
@ -158,7 +158,7 @@ if ~(exist('sylvester3mr','file')==2),
|
||||||
addpath([dynareroot 'gensylv'])
|
addpath([dynareroot 'gensylv'])
|
||||||
end
|
end
|
||||||
|
|
||||||
IdentifDirectoryName = CheckPath('identification');
|
IdentifDirectoryName = CheckPath('identification',M_.dname);
|
||||||
if prior_exist,
|
if prior_exist,
|
||||||
|
|
||||||
indx = [];
|
indx = [];
|
||||||
|
|
|
@ -136,12 +136,12 @@ if options_gsa.morris==1 || options_gsa.morris==3,
|
||||||
options_gsa.ksstat=1;
|
options_gsa.ksstat=1;
|
||||||
if options_gsa.morris==3,
|
if options_gsa.morris==3,
|
||||||
options_gsa = set_default_option(options_gsa,'Nsam',256);
|
options_gsa = set_default_option(options_gsa,'Nsam',256);
|
||||||
OutputDirectoryName = CheckPath('gsa/identif');
|
OutputDirectoryName = CheckPath('gsa/identif',M_.dname);
|
||||||
else
|
else
|
||||||
OutputDirectoryName = CheckPath('gsa/screen');
|
OutputDirectoryName = CheckPath('gsa/screen',M_.dname);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
OutputDirectoryName = CheckPath('gsa');
|
OutputDirectoryName = CheckPath('gsa',M_.dname);
|
||||||
end
|
end
|
||||||
|
|
||||||
options_.opt_gsa = options_gsa;
|
options_.opt_gsa = options_gsa;
|
||||||
|
@ -281,7 +281,7 @@ if options_gsa.glue,
|
||||||
dr_ = oo_.dr;
|
dr_ = oo_.dr;
|
||||||
if options_gsa.ppost
|
if options_gsa.ppost
|
||||||
load([OutputDirectoryName,'/',fname_,'_post']);
|
load([OutputDirectoryName,'/',fname_,'_post']);
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
else
|
else
|
||||||
if options_gsa.pprior
|
if options_gsa.pprior
|
||||||
load([OutputDirectoryName,'/',fname_,'_prior']);
|
load([OutputDirectoryName,'/',fname_,'_prior']);
|
||||||
|
|
|
@ -31,7 +31,7 @@ function [mhname,info] = get_name_of_the_last_mh_file(M_)
|
||||||
mhname = [];
|
mhname = [];
|
||||||
info = 1;
|
info = 1;
|
||||||
|
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
|
|
||||||
load([ MhDirectoryName '/' M_.fname '_mh_history.mat']) ;
|
load([ MhDirectoryName '/' M_.fname '_mh_history.mat']) ;
|
||||||
mh_number = record.LastFileNumber ;
|
mh_number = record.LastFileNumber ;
|
||||||
|
|
|
@ -93,14 +93,14 @@ end
|
||||||
|
|
||||||
if options_.opt_gsa.ppost,
|
if options_.opt_gsa.ppost,
|
||||||
fnamtmp=[fname_,'_post'];
|
fnamtmp=[fname_,'_post'];
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
else
|
else
|
||||||
if options_.opt_gsa.pprior
|
if options_.opt_gsa.pprior
|
||||||
fnamtmp=[fname_,'_prior'];
|
fnamtmp=[fname_,'_prior'];
|
||||||
DirectoryName = CheckPath(['gsa' filesep 'prior']);
|
DirectoryName = CheckPath(['gsa' filesep 'prior'],M_.dname);
|
||||||
else
|
else
|
||||||
fnamtmp=[fname_,'_mc'];
|
fnamtmp=[fname_,'_mc'];
|
||||||
DirectoryName = CheckPath(['gsa' filesep 'mc']);
|
DirectoryName = CheckPath(['gsa' filesep 'mc'],M_.dname);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if ~loadSA,
|
if ~loadSA,
|
||||||
|
|
|
@ -21,7 +21,7 @@ function gsa_plotmatrix(type,varargin)
|
||||||
|
|
||||||
global bayestopt_ options_ M_
|
global bayestopt_ options_ M_
|
||||||
|
|
||||||
RootDirectoryName = CheckPath('gsa');
|
RootDirectoryName = CheckPath('gsa',M_.dname);
|
||||||
|
|
||||||
if options_.opt_gsa.pprior
|
if options_.opt_gsa.pprior
|
||||||
load([ RootDirectoryName filesep M_.fname '_prior.mat'],'lpmat0','lpmat','istable','iunstable','iindeterm','iwrong')
|
load([ RootDirectoryName filesep M_.fname '_prior.mat'],'lpmat0','lpmat','istable','iunstable','iindeterm','iwrong')
|
||||||
|
|
|
@ -27,7 +27,7 @@ function [pars, cosnJ] = ident_bruteforce(J,n,TeX, pnames_TeX)
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licen
|
% along with Dynare. If not, see <http://www.gnu.org/licen
|
||||||
global M_ options_
|
global M_ options_
|
||||||
|
|
||||||
OutputDirectoryName = CheckPath('Identification');
|
OutputDirectoryName = CheckPath('Identification',M_.dname);
|
||||||
|
|
||||||
k = size(J,2); % number of parameters
|
k = size(J,2); % number of parameters
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ end
|
||||||
% (re)Set the penalty.
|
% (re)Set the penalty.
|
||||||
bayestopt_.penalty = Inf;
|
bayestopt_.penalty = Inf;
|
||||||
|
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
|
|
||||||
OpenOldFile = ones(nblck,1);
|
OpenOldFile = ones(nblck,1);
|
||||||
if strcmpi(ProposalFun,'rand_multivariate_normal')
|
if strcmpi(ProposalFun,'rand_multivariate_normal')
|
||||||
|
|
|
@ -36,7 +36,7 @@ function [marginal,oo_] = marginal_density(M_, options_, estim_params_, oo_)
|
||||||
npar = estim_params_.np+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.nvx;
|
npar = estim_params_.np+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.nvx;
|
||||||
nblck = options_.mh_nblck;
|
nblck = options_.mh_nblck;
|
||||||
|
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
load([ MhDirectoryName '/' M_.fname '_mh_history.mat'])
|
load([ MhDirectoryName '/' M_.fname '_mh_history.mat'])
|
||||||
|
|
||||||
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
||||||
|
|
|
@ -39,7 +39,7 @@ if init
|
||||||
ncn = estim_params_.ncn;
|
ncn = estim_params_.ncn;
|
||||||
np = estim_params_.np ;
|
np = estim_params_.np ;
|
||||||
npar = nvx+nvn+ncx+ncn+np;
|
npar = nvx+nvn+ncx+ncn+np;
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
fname = [ MhDirectoryName '/' M_.fname];
|
fname = [ MhDirectoryName '/' M_.fname];
|
||||||
load([ fname '_mh_history']);
|
load([ fname '_mh_history']);
|
||||||
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
||||||
|
|
|
@ -56,7 +56,7 @@ end
|
||||||
|
|
||||||
bayestopt_.penalty = 1e8;
|
bayestopt_.penalty = 1e8;
|
||||||
|
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
|
|
||||||
nblck = options_.mh_nblck;
|
nblck = options_.mh_nblck;
|
||||||
nruns = ones(nblck,1)*options_.mh_replic;
|
nruns = ones(nblck,1)*options_.mh_replic;
|
||||||
|
|
|
@ -47,7 +47,7 @@ if isempty(column)
|
||||||
end
|
end
|
||||||
|
|
||||||
% Get informations about the posterior draws:
|
% Get informations about the posterior draws:
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
try
|
try
|
||||||
load([DirectoryName '/' M_.fname '_mh_history.mat']);
|
load([DirectoryName '/' M_.fname '_mh_history.mat']);
|
||||||
catch
|
catch
|
||||||
|
|
|
@ -96,7 +96,7 @@ for i=fpar:nvar
|
||||||
|
|
||||||
if whoiam,
|
if whoiam,
|
||||||
if Parallel(ThisMatlab).Local==0
|
if Parallel(ThisMatlab).Local==0
|
||||||
DirectoryName = CheckPath('Output');
|
DirectoryName = CheckPath('Output',M_.dname);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ end
|
||||||
maxlag = M_.maximum_endo_lag;
|
maxlag = M_.maximum_endo_lag;
|
||||||
%%
|
%%
|
||||||
if strcmpi(type,'posterior')
|
if strcmpi(type,'posterior')
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
load([ DirectoryName '/' M_.fname '_mh_history'])
|
load([ DirectoryName '/' M_.fname '_mh_history'])
|
||||||
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
||||||
FirstLine = record.KeepedDraws.FirstLine;
|
FirstLine = record.KeepedDraws.FirstLine;
|
||||||
|
@ -86,12 +86,12 @@ if strcmpi(type,'posterior')
|
||||||
B = min(1200, round(0.25*NumberOfDraws));
|
B = min(1200, round(0.25*NumberOfDraws));
|
||||||
end
|
end
|
||||||
elseif strcmpi(type,'gsa')
|
elseif strcmpi(type,'gsa')
|
||||||
RootDirectoryName = CheckPath('gsa');
|
RootDirectoryName = CheckPath('gsa',M_.dname);
|
||||||
if options_.opt_gsa.pprior
|
if options_.opt_gsa.pprior
|
||||||
DirectoryName = CheckPath(['gsa',filesep,'prior']);
|
DirectoryName = CheckPath(['gsa',filesep,'prior'],M_.dname);
|
||||||
load([ RootDirectoryName filesep M_.fname '_prior.mat'],'lpmat0','lpmat','istable')
|
load([ RootDirectoryName filesep M_.fname '_prior.mat'],'lpmat0','lpmat','istable')
|
||||||
else
|
else
|
||||||
DirectoryName = CheckPath(['gsa',filesep,'mc']);
|
DirectoryName = CheckPath(['gsa',filesep,'mc'],M_.dname);
|
||||||
load([ RootDirectoryName filesep M_.fname '_mc.mat'],'lpmat0','lpmat','istable')
|
load([ RootDirectoryName filesep M_.fname '_mc.mat'],'lpmat0','lpmat','istable')
|
||||||
end
|
end
|
||||||
x=[lpmat0(istable,:) lpmat(istable,:)];
|
x=[lpmat0(istable,:) lpmat(istable,:)];
|
||||||
|
@ -99,7 +99,7 @@ elseif strcmpi(type,'gsa')
|
||||||
NumberOfDraws=size(x,1);
|
NumberOfDraws=size(x,1);
|
||||||
B=NumberOfDraws;
|
B=NumberOfDraws;
|
||||||
elseif strcmpi(type,'prior')
|
elseif strcmpi(type,'prior')
|
||||||
DirectoryName = CheckPath('prior');
|
DirectoryName = CheckPath('prior',M_.dname);
|
||||||
if ~isempty(options_.subdraws)
|
if ~isempty(options_.subdraws)
|
||||||
B = options_.subdraws;
|
B = options_.subdraws;
|
||||||
else
|
else
|
||||||
|
|
|
@ -97,15 +97,15 @@ end
|
||||||
|
|
||||||
% DirectoryName = myinputs.DirectoryName;
|
% DirectoryName = myinputs.DirectoryName;
|
||||||
if strcmpi(type,'posterior')
|
if strcmpi(type,'posterior')
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
elseif strcmpi(type,'gsa')
|
elseif strcmpi(type,'gsa')
|
||||||
if options_.opt_gsa.pprior
|
if options_.opt_gsa.pprior
|
||||||
DirectoryName = CheckPath(['gsa',filesep,'prior']);
|
DirectoryName = CheckPath(['gsa',filesep,'prior'],M_.dname);
|
||||||
else
|
else
|
||||||
DirectoryName = CheckPath(['gsa',filesep,'mc']);
|
DirectoryName = CheckPath(['gsa',filesep,'mc'],M_.dname);
|
||||||
end
|
end
|
||||||
elseif strcmpi(type,'prior')
|
elseif strcmpi(type,'prior')
|
||||||
DirectoryName = CheckPath('prior');
|
DirectoryName = CheckPath('prior',M_.dname);
|
||||||
end
|
end
|
||||||
|
|
||||||
RemoteFlag = 0;
|
RemoteFlag = 0;
|
||||||
|
|
|
@ -32,7 +32,7 @@ function results = prior_sampler(drsave,M_,bayestopt_,options_,oo_)
|
||||||
|
|
||||||
% Initialization.
|
% Initialization.
|
||||||
prior_draw(1);
|
prior_draw(1);
|
||||||
PriorDirectoryName = CheckPath('prior/draws');
|
PriorDirectoryName = CheckPath('prior/draws',M_.dname);
|
||||||
work = ~drsave;
|
work = ~drsave;
|
||||||
iteration = 0;
|
iteration = 0;
|
||||||
loop_indx = 0;
|
loop_indx = 0;
|
||||||
|
|
|
@ -103,7 +103,7 @@ end
|
||||||
% (re)Set the penalty
|
% (re)Set the penalty
|
||||||
bayestopt_.penalty = Inf;
|
bayestopt_.penalty = Inf;
|
||||||
|
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
|
|
||||||
options_.lik_algo = 1;
|
options_.lik_algo = 1;
|
||||||
OpenOldFile = ones(nblck,1);
|
OpenOldFile = ones(nblck,1);
|
||||||
|
|
|
@ -63,7 +63,7 @@ switch nargin
|
||||||
end
|
end
|
||||||
|
|
||||||
% Get informations about the mcmc:
|
% Get informations about the mcmc:
|
||||||
MhDirectoryName = CheckPath('metropolis');
|
MhDirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
fname = [ MhDirectoryName '/' M_.fname];
|
fname = [ MhDirectoryName '/' M_.fname];
|
||||||
load([ fname '_mh_history.mat']);
|
load([ fname '_mh_history.mat']);
|
||||||
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
FirstMhFile = record.KeepedDraws.FirstMhFile;
|
||||||
|
|
|
@ -263,7 +263,7 @@ if options_.initialize_estimated_parameters_with_the_prior_mode
|
||||||
end
|
end
|
||||||
|
|
||||||
% I create subfolder M_.dname/prior if needed.
|
% I create subfolder M_.dname/prior if needed.
|
||||||
CheckPath('prior');
|
CheckPath('prior',M_.dname);
|
||||||
|
|
||||||
% I save the prior definition if the prior has changed.
|
% I save the prior definition if the prior has changed.
|
||||||
if exist([ M_.dname '/prior/definition.mat'])
|
if exist([ M_.dname '/prior/definition.mat'])
|
||||||
|
|
|
@ -46,7 +46,7 @@ if isempty(column)
|
||||||
end
|
end
|
||||||
|
|
||||||
% Get informations about the posterior draws:
|
% Get informations about the posterior draws:
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis',M_.dname);
|
||||||
try
|
try
|
||||||
load([DirectoryName '/' M_.fname '_mh_history.mat']);
|
load([DirectoryName '/' M_.fname '_mh_history.mat']);
|
||||||
catch
|
catch
|
||||||
|
|
Loading…
Reference in New Issue