v4: more \
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@602 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
cabb3f9820
commit
0f3b8e141c
|
@ -18,7 +18,7 @@ npar = npar + estim_params_.ncn;
|
||||||
npar = npar + estim_params_.np ;
|
npar = npar + estim_params_.np ;
|
||||||
MAX_nruns = ceil(options_.MaxNumberOfBytes/(npar+2)/8);
|
MAX_nruns = ceil(options_.MaxNumberOfBytes/(npar+2)/8);
|
||||||
|
|
||||||
load(['.\' M_.dname '\metropolis\' M_.fname '_mh_history.mat'])
|
load(['./' M_.dname '/metropolis/' M_.fname '_mh_history.mat'])
|
||||||
|
|
||||||
PastDraws = sum(record.MhDraws,1);
|
PastDraws = sum(record.MhDraws,1);
|
||||||
LastFileNumber = PastDraws(2);
|
LastFileNumber = PastDraws(2);
|
||||||
|
@ -49,13 +49,13 @@ for j=1:npar
|
||||||
for b = 1:nblck
|
for b = 1:nblck
|
||||||
startline = 0;
|
startline = 0;
|
||||||
for n = 1:LastFileNumber-1
|
for n = 1:LastFileNumber-1
|
||||||
eval(['load ' M_.dname '\metropolis\' M_.fname '_mh' int2str(n) '_blck' int2str(b)]);
|
eval(['load ' M_.dname '/metropolis/' M_.fname '_mh' int2str(n) '_blck' int2str(b)]);
|
||||||
clear logpo2 post2;
|
clear logpo2 post2;
|
||||||
tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+MAX_nruns*n,1) = x2(:,j);
|
tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+MAX_nruns*n,1) = x2(:,j);
|
||||||
clear x2;
|
clear x2;
|
||||||
startline = startline + MAX_nruns;
|
startline = startline + MAX_nruns;
|
||||||
end
|
end
|
||||||
eval(['load ' M_.dname '\metropolis\' M_.fname '_mh' int2str(LastFileNumber) '_blck' int2str(b)]);
|
eval(['load ' M_.dname '/metropolis/' M_.fname '_mh' int2str(LastFileNumber) '_blck' int2str(b)]);
|
||||||
clear logpo2 post2;
|
clear logpo2 post2;
|
||||||
tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+MAX_nruns*(LastFileNumber-1)+LastLineNumber,1) = x2(:,j);
|
tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+MAX_nruns*(LastFileNumber-1)+LastLineNumber,1) = x2(:,j);
|
||||||
clear x2;
|
clear x2;
|
||||||
|
@ -228,7 +228,7 @@ clear UDIAG;
|
||||||
%% Multivariate diagnostic.
|
%% Multivariate diagnostic.
|
||||||
%%
|
%%
|
||||||
if TeX
|
if TeX
|
||||||
fidTeX = fopen([M_.dname '\TeX\' M_.fname '_MultivariateDiagnostics.TeX'],'w');
|
fidTeX = fopen([M_.dname '/TeX/' M_.fname '_MultivariateDiagnostics.TeX'],'w');
|
||||||
fprintf(fidTeX,'%% TeX eps-loader file generated by McmcDiagnostics.m (Dynare).\n');
|
fprintf(fidTeX,'%% TeX eps-loader file generated by McmcDiagnostics.m (Dynare).\n');
|
||||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||||
fprintf(fidTeX,' \n');
|
fprintf(fidTeX,' \n');
|
||||||
|
@ -239,12 +239,12 @@ MDIAG = zeros(NumberOfLines,6);
|
||||||
for b = 1:nblck
|
for b = 1:nblck
|
||||||
startline = 0;
|
startline = 0;
|
||||||
for n = 1:LastFileNumber-1
|
for n = 1:LastFileNumber-1
|
||||||
eval(['load ' M_.dname '\metropolis\' M_.fname '_mh' int2str(n) '_blck' int2str(b)]);
|
eval(['load ' M_.dname '/metropolis/' M_.fname '_mh' int2str(n) '_blck' int2str(b)]);
|
||||||
clear x2 post2;
|
clear x2 post2;
|
||||||
tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+MAX_nruns*n,1) = logpo2;
|
tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+MAX_nruns*n,1) = logpo2;
|
||||||
startline = startline+MAX_nruns;
|
startline = startline+MAX_nruns;
|
||||||
end
|
end
|
||||||
eval(['load ' M_.dname '\metropolis\' M_.fname '_mh' int2str(LastFileNumber) '_blck' int2str(b)]);
|
eval(['load ' M_.dname '/metropolis/' M_.fname '_mh' int2str(LastFileNumber) '_blck' int2str(b)]);
|
||||||
clear x2 post2;
|
clear x2 post2;
|
||||||
tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+ MAX_nruns*(LastFileNumber-1)+LastLineNumber,1) = logpo2;
|
tmp((b-1)*NumberOfDraws+startline+1:(b-1)*NumberOfDraws+ MAX_nruns*(LastFileNumber-1)+LastLineNumber,1) = logpo2;
|
||||||
end
|
end
|
||||||
|
@ -323,4 +323,4 @@ if TeX
|
||||||
fprintf(fidTeX,'\n');
|
fprintf(fidTeX,'\n');
|
||||||
fprintf(fidTeX,'% End Of TeX file.');
|
fprintf(fidTeX,'% End Of TeX file.');
|
||||||
fclose(fidTeX);
|
fclose(fidTeX);
|
||||||
end
|
end
|
||||||
|
|
|
@ -227,7 +227,7 @@ elseif options_.load_mh_file == -1% The previous metropolis-hastings
|
||||||
% (if there was a complete session before the crash) ?
|
% (if there was a complete session before the crash) ?
|
||||||
if OldMh
|
if OldMh
|
||||||
ante = sum(record.MhDraws(1:end-1,2),1);
|
ante = sum(record.MhDraws(1:end-1,2),1);
|
||||||
load(['.\' DirectoryName '/' M_.fname '_mh' int2str(ante) '_blck' ...
|
load(['./' DirectoryName '/' M_.fname '_mh' int2str(ante) '_blck' ...
|
||||||
int2str(CrashedBlck) '.mat'],'logpo2');
|
int2str(CrashedBlck) '.mat'],'logpo2');
|
||||||
if length(logpo2) == MAX_nruns
|
if length(logpo2) == MAX_nruns
|
||||||
IsTheLastFileOfThePreviousMhFull = 1;
|
IsTheLastFileOfThePreviousMhFull = 1;
|
||||||
|
@ -243,7 +243,7 @@ elseif options_.load_mh_file == -1% The previous metropolis-hastings
|
||||||
MhFileNumber = ante;
|
MhFileNumber = ante;
|
||||||
while MhFileExist
|
while MhFileExist
|
||||||
MhFileNumber = MhFileNumber + 1;
|
MhFileNumber = MhFileNumber + 1;
|
||||||
if ~exist(['.\' DirectoryName '/' M_.fname '_mh' int2str(MhFileNumber) '_blck' int2str(CrashedBlck) '.mat'])
|
if ~exist(['./' DirectoryName '/' M_.fname '_mh' int2str(MhFileNumber) '_blck' int2str(CrashedBlck) '.mat'])
|
||||||
MhFileExist = 0;
|
MhFileExist = 0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -265,7 +265,7 @@ elseif options_.load_mh_file == -1% The previous metropolis-hastings
|
||||||
nruns(CrashedBlck) = nruns(CrashedBlck)-NumberOfSavedDraws;
|
nruns(CrashedBlck) = nruns(CrashedBlck)-NumberOfSavedDraws;
|
||||||
% I initialize with the last saved mh file of the inccomplete
|
% I initialize with the last saved mh file of the inccomplete
|
||||||
% block:
|
% block:
|
||||||
load(['.\' DirectoryName '/' M_.fname '_mh' int2str(MhFileNumber-1) '_blck' int2str(CrashedBlck) '.mat']);
|
load(['./' DirectoryName '/' M_.fname '_mh' int2str(MhFileNumber-1) '_blck' int2str(CrashedBlck) '.mat']);
|
||||||
ilogpo2(CrashedBlck) = logpo2(end);
|
ilogpo2(CrashedBlck) = logpo2(end);
|
||||||
ix2(CrashedBlck,:) = x2(end,:);
|
ix2(CrashedBlck,:) = x2(end,:);
|
||||||
NewFile(CrashedBlck) = MhFileNumber;
|
NewFile(CrashedBlck) = MhFileNumber;
|
||||||
|
@ -282,7 +282,7 @@ end% of (if options_.load_mh_file == {0,1 or -1})
|
||||||
InitSizeArray = min([MAX_nruns*ones(nblck) nruns],[],2);
|
InitSizeArray = min([MAX_nruns*ones(nblck) nruns],[],2);
|
||||||
for b = fblck:nblck
|
for b = fblck:nblck
|
||||||
if (options_.load_mh_file~=0) & (fline(b)>1) & OpenOldFile(b)
|
if (options_.load_mh_file~=0) & (fline(b)>1) & OpenOldFile(b)
|
||||||
load(['.\' DirectoryName '/' M_.fname '_mh' int2str(NewFile(b)) ...
|
load(['./' DirectoryName '/' M_.fname '_mh' int2str(NewFile(b)) ...
|
||||||
'_blck' int2str(b) '.'])
|
'_blck' int2str(b) '.'])
|
||||||
x2 = [x2;zeros(InitSizeArray(b)-fline(b)+1,npar)];
|
x2 = [x2;zeros(InitSizeArray(b)-fline(b)+1,npar)];
|
||||||
logpo2 = [logpo2;zeros(InitSizeArray(b)-fline(b)+1,1)];
|
logpo2 = [logpo2;zeros(InitSizeArray(b)-fline(b)+1,1)];
|
||||||
|
|
Loading…
Reference in New Issue