Document different treatment of mh_recover and load_mh_file under Octave

Also adjusts unit tests accordingly. Closes #1332
time-shift
Johannes Pfeifer 2016-12-23 10:47:58 +01:00
parent 2d17ff43a4
commit 5e010f57c0
6 changed files with 50 additions and 35 deletions

View File

@ -5304,7 +5304,9 @@ simulation that crashed prematurely, starting with the last available saved
the proposal density from the previous run will automatically be loaded. In older versions, the proposal density from the previous run will automatically be loaded. In older versions,
to assure a neat continuation of the chain with the same proposal density, you should to assure a neat continuation of the chain with the same proposal density, you should
provide the @code{mode_file} used in the previous provide the @code{mode_file} used in the previous
run or the same user-defined @code{mcmc_jumping_covariance} when using this option. run or the same user-defined @code{mcmc_jumping_covariance} when using this option. Note that
under Octave, a neat continuation of the crashed chain with the respective last random number
generator state is currently not supported.
@item mh_mode = @var{INTEGER} @item mh_mode = @var{INTEGER}
@dots{} @dots{}
@ -5476,7 +5478,9 @@ the proposal density from the previous run will automatically be loaded. In olde
to assure a neat continuation of the chain with the same proposal density, you should to assure a neat continuation of the chain with the same proposal density, you should
provide the @code{mode_file} used in the previous provide the @code{mode_file} used in the previous
run or the same user-defined @code{mcmc_jumping_covariance} when using this option. run or the same user-defined @code{mcmc_jumping_covariance} when using this option.
Shouldn't be used together with @code{mh_recover}. Shouldn't be used together with @code{mh_recover}. Note that under Octave, a neat
continuation of the chain with the last random number
generator state of the already present draws is currently not supported.
@item load_results_after_load_mh @item load_results_after_load_mh
@anchor{load_results_after_load_mh} This option is available when loading a previous MCMC run without @anchor{load_results_after_load_mh} This option is available when loading a previous MCMC run without

View File

@ -26,10 +26,12 @@ if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s unaffected files are not the same') error('Draws of affected chain''s unaffected files are not the same')
end end
%check second, affected chain with affected file if ~isoctave
temp1=load([M_.dname '_mh2_blck2.mat']); %check second, affected chain with affected file
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh2_blck2.mat']); temp1=load([M_.dname '_mh2_blck2.mat']);
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh2_blck2.mat']);
if max(max(abs(temp1.x2-temp2.x2)))>1e-10 if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s affected files are not the same') error('Draws of affected chain''s affected files are not the same')
end end
end

View File

@ -32,18 +32,21 @@ if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s unaffected files are not the same') error('Draws of affected chain''s unaffected files are not the same')
end end
%check second, affected chain with affected file if ~isoctave
temp1=load([M_.dname '_mh4_blck2.mat']); %check second, affected chain with affected file
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh4_blck2.mat']); temp1=load([M_.dname '_mh4_blck2.mat']);
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh4_blck2.mat']);
if max(max(abs(temp1.x2-temp2.x2)))>1e-10 if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s affected files are not the same') error('Draws of affected chain''s affected files are not the same')
end
%check second, affected chain with affected file
temp1=load([M_.dname '_mh5_blck2.mat']);
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh5_blck2.mat']);
if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s affected files are not the same')
end
end end
%check second, affected chain with affected file
temp1=load([M_.dname '_mh5_blck2.mat']);
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh5_blck2.mat']);
if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s affected files are not the same')
end

View File

@ -30,10 +30,12 @@ if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s unaffected files are not the same') error('Draws of affected chain''s unaffected files are not the same')
end end
%check second, affected chain with affected file if ~isoctave
temp1=load([M_.dname '_mh4_blck2.mat']); %check second, affected chain with affected file
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh4_blck2.mat']); temp1=load([M_.dname '_mh4_blck2.mat']);
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh4_blck2.mat']);
if max(max(abs(temp1.x2-temp2.x2)))>1e-10 if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s affected files are not the same') error('Draws of affected chain''s affected files are not the same')
end
end end

View File

@ -26,10 +26,12 @@ if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s unaffected files are not the same') error('Draws of affected chain''s unaffected files are not the same')
end end
%check second, affected chain with affected file if ~isoctave
temp1=load([M_.dname '_mh2_blck2.mat']); %check second, affected chain with affected file
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh2_blck2.mat']); temp1=load([M_.dname '_mh2_blck2.mat']);
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh2_blck2.mat']);
if max(max(abs(temp1.x2-temp2.x2)))>1e-10 if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Draws of affected chain''s affected files are not the same') error('Draws of affected chain''s affected files are not the same')
end end
end

View File

@ -111,10 +111,12 @@ estimation(mode_compute=0,mode_file=fs2000_mode,order=1, datafile=fsdat_simul, n
temp1=load([M_.dname '_mh1_blck1.mat']); temp1=load([M_.dname '_mh1_blck1.mat']);
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh1_blck1.mat']); temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh1_blck1.mat']);
if max(max(abs(temp1.x2-temp2.x2)))>1e-10 if ~isoctave
error('Draws of unaffected chain are not the same') if max(max(abs(temp1.x2-temp2.x2)))>1e-10
error('Adding draws did not result in the same chain')
end
end end
save('fs2000_result.mat','oo_') save('fs2000_result.mat','oo_')
options_.load_results_after_load_mh=1; options_.load_results_after_load_mh=1;
estimation(mode_compute=0,mode_file=fs2000_mode,order=1, datafile=fsdat_simul, nobs=192, loglinear, mh_replic=0, mh_nblocks=1, mh_jscale=10,load_mh_file,smoother) gy_obs gp_obs; estimation(mode_compute=0,mode_file=fs2000_mode,order=1, datafile=fsdat_simul, nobs=192, loglinear, mh_replic=0, mh_nblocks=1, mh_jscale=10,load_mh_file,smoother) gy_obs gp_obs;