| 1 |
//Test mh_recover function for RW-MH |
| 2 |
|
| 3 |
@#include "fs2000.common.inc" |
| 4 |
|
| 5 |
options_.MaxNumberOfBytes=1000*11*8/2; |
| 6 |
estimation(order=1, datafile='../fsdat_simul',nobs=192, silent_optimizer,loglinear, mh_replic=1000, mh_nblocks=2, mh_jscale=0.8); |
| 7 |
copyfile([M_.dname filesep 'metropolis' filesep M_.dname '_mh1_blck1.mat'],[M_.dname '_mh1_blck1.mat']) |
| 8 |
copyfile([M_.dname filesep 'metropolis' filesep M_.dname '_mh2_blck2.mat'],[M_.dname '_mh2_blck2.mat']) |
| 9 |
delete([M_.dname filesep 'metropolis' filesep M_.dname '_mh2_blck2.mat']) |
| 10 |
|
| 11 |
estimation(order=1, datafile='../fsdat_simul',mode_compute=0,mode_file='fs2000_recover/Output/fs2000_recover_mode', nobs=192, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8,mh_recover); |
| 12 |
|
| 13 |
%check first unaffected chain |
| 14 |
temp1=load([M_.dname '_mh1_blck1.mat']); |
| 15 |
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh1_blck1.mat']); |
| 16 |
|
| 17 |
if max(max(abs(temp1.x2-temp2.x2)))>1e-10 |
| 18 |
error('Draws of unaffected chain are not the same') |
| 19 |
end |
| 20 |
|
| 21 |
%check second, affected chain with last unaffected file |
| 22 |
temp1=load([M_.dname '_mh1_blck1.mat']); |
| 23 |
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh1_blck1.mat']); |
| 24 |
|
| 25 |
if max(max(abs(temp1.x2-temp2.x2)))>1e-10 |
| 26 |
error('Draws of affected chain''s unaffected files are not the same') |
| 27 |
end |
| 28 |
|
| 29 |
if ~isoctave |
| 30 |
%check second, affected chain with affected file |
| 31 |
temp1=load([M_.dname '_mh2_blck2.mat']); |
| 32 |
temp2=load([M_.dname filesep 'metropolis' filesep M_.dname '_mh2_blck2.mat']); |
| 33 |
|
| 34 |
if max(max(abs(temp1.x2-temp2.x2)))>1e-10 |
| 35 |
error('Draws of affected chain''s affected files are not the same') |
| 36 |
end |
| 37 |
end |