Skip to content
Snippets Groups Projects
Commit 688366d6 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

SWZ: sz_prd correct calls to mex functions

parent b7447076
Branches
No related tags found
No related merge requests found
...@@ -10,13 +10,13 @@ ms_root = strrep(which('ms_sbvar'),'/ms_sbvar.m',''); ...@@ -10,13 +10,13 @@ ms_root = strrep(which('ms_sbvar'),'/ms_sbvar.m','');
% path for C executables % path for C executables
%c_path='./c-executables'; %c_path='./c-executables';
c_path = [ms_root '/bin']; c_path = [ms_root '../../ms-sbvar'];
% path for Markov specification % path for Markov specification
m_spec_path=[ms_root '/switching_specification']; %m_spec_path=[ms_root '/switching_specification'];
% path for MHM specification % path for MHM specification
mhm_spec_path=[ms_root '/mhm_specification']; %mhm_spec_path=[ms_root '/mhm_specification'];
%========================================================================== %==========================================================================
%== Processing control %== Processing control
...@@ -59,7 +59,7 @@ markov_file = [options_.ms.markov_file '.dat']; ...@@ -59,7 +59,7 @@ markov_file = [options_.ms.markov_file '.dat'];
%options_.ms.mhm_file = 'MHM_input.dat'; %options_.ms.mhm_file = 'MHM_input.dat';
mhm_file = '/MHM_input.dat'; %mhm_file = '/MHM_input.dat';
%options_.ms.proposal_draws = 100000; %options_.ms.proposal_draws = 100000;
%========================================================================== %==========================================================================
...@@ -492,13 +492,13 @@ if options_.ms.create_initialization_file == 1 ...@@ -492,13 +492,13 @@ if options_.ms.create_initialization_file == 1
create_init_file=[c_path,'/sbvar_init_file ',matlab_filename,' ',markov_file,' ',options_.ms.output_file_tag]; create_init_file=[c_path,'/sbvar_init_file ',matlab_filename,' ',markov_file,' ',options_.ms.output_file_tag];
system(create_init_file); %Run operating system command and return result system(create_init_file); %Run operating system command and return result
else else
create_init_file=[c_path,'\sbvar_init.exe ',matlab_filename,' ',markov_file,' ',options_.ms.output_file_tag]; create_init_file=[c_path,'\sbvar_init_file.exe ',matlab_filename,' ',markov_file,' ',options_.ms.output_file_tag];
dos(create_init_file) dos(create_init_file)
end end
else else
create_init_file=[matlab_filename,' ',markov_file,' ',options_.ms.output_file_tag]; create_init_file=[matlab_filename,' ',markov_file,' ',options_.ms.output_file_tag];
[err] = mex_sbvar_init_file(create_init_file); [err] = ms_sbvar_create_init_file(create_init_file);
mexErrCheck('mex_sbvar_init_file',err); mexErrCheck('ms_sbvar_create_init_file',err);
end end
end end
...@@ -508,84 +508,75 @@ end ...@@ -508,84 +508,75 @@ end
if options_.ms.estimate_msmodel == 1 if options_.ms.estimate_msmodel == 1
if options_.ms.standalone == 1 if options_.ms.standalone == 1
if use_linux == 1 if use_linux == 1
perform_estimation=[c_path,'/sbvar_estimation -cseed 5 -ft ',options_.ms.output_file_tag]; perform_estimation=[c_path,'/sbvar_commandline -estimate -seed 5 -ft ',options_.ms.output_file_tag];
system(perform_estimation); system(perform_estimation);
else else
perform_estimation=[c_path,'\sbvar_estimation.exe -cseed 5 -ft ',options_.ms.output_file_tag]; perform_estimation=[c_path,'\sbvar_commandline.exe -estimate -seed 5 -ft ',options_.ms.output_file_tag];
dos(perform_estimation) dos(perform_estimation)
end end
else else
perform_estimation=['-cseed 5 -ft ',options_.ms.output_file_tag]; perform_estimation=['-estimate -seed 5 -ft ',options_.ms.output_file_tag];
[err] = mex_sbvar_estimation(perform_estimation); [err] = ms_sbvar_command_line(perform_estimation);
mexErrCheck('mex_sbvar_estimation',err); mexErrCheck('ms_sbvar_command_line estimation',err);
end end
end end
%========================================================================== %==========================================================================
%== Compute marginal data density %== Simulation
%========================================================================== %==========================================================================
if options_.ms.compute_mdd == 1 if options_.ms.print_draws == 1
mhm_file = ['mhm_input_' M.fname '.dat'];
ms_write_mhm_input(mhm_file,options_.ms);
if options_.ms.standalone == 1 if options_.ms.standalone == 1
if use_linux == 1 if use_linux == 1
compute_mdd1=[c_path,'/sbvar_mhm_1 -cseed 5 -ft ',options_.ms.output_file_tag,' -fi ',mhm_file]; print_draws=[c_path,'/sbvar_commandline -simulate -seed 5 -ft ',options_.ms.output_file_tag,' -ndraws ',int2str(options_.ms.n_draws),' -thin ',int2str(options_.ms.thinning_factor)];
system(compute_mdd1); system(print_draws);
compute_mdd2=[c_path,'/sbvar_mhm_2 -cseed 5 -ft ',options_.ms.output_file_tag,' -d ',int2str(options_.ms.proposal_draws),' -t 3'];
system(compute_mdd2);
else else
compute_mdd1=[c_path,'\sbvar_mhm_1.exe -cseed 5 -ft ',options_.ms.output_file_tag,' -fi ',mhm_file]; print_draws=[c_path,'\sbvar_commandline.exe -simulate -seed 5 -ft ',options_.ms.output_file_tag,' -ndraws ',int2str(options_.ms.n_draws),' -thin ',int2str(options_.ms.thinning_factor)];
system(compute_mdd1); system(print_draws);
compute_mdd2=[c_path,'\sbvar_mhm_2.exe -cseed 5 -ft ',options_.ms.output_file_tag,' -d ',int2str(options_.ms.proposal_draws),' -t 3'];
system(compute_mdd2);
end end
else else
compute_mdd1=['-cseed 5 -ft ',options_.ms.output_file_tag,' -fi ',mhm_file]; print_draws=['-simulate -seed 5 -ft ',options_.ms.output_file_tag,' -ndraws ',int2str(options_.ms.n_draws),' -thin ',int2str(options_.ms.thinning_factor)];
[err] = mex_sbvar_mhm_1(compute_mdd1); [err] = ms_sbvar_command_line(print_draws);
mexErrCheck('mex_sbvar_mhm_1',err); mexErrCheck('ms_sbvar_command_line simulation',err);
compute_mdd2=['-cseed 5 -ft ',options_.ms.output_file_tag,' -d ',int2str(options_.ms.proposal_draws),' -t 3'];
[err] = mex_sbvar_mhm_2(compute_mdd2);
mexErrCheck('mex_sbvar_mhm_2',err);
end end
end end
%========================================================================== %==========================================================================
%== Compute posterior mode regime probabilities %== Compute marginal data density
%========================================================================== %==========================================================================
if options_.ms.compute_probabilities == 1 %error registers here if options_.ms.compute_mdd == 1
% mhm_file = ['mhm_input_' M.fname '.dat'];
% ms_write_mhm_input(mhm_file,options_.ms);
if options_.ms.standalone == 1 if options_.ms.standalone == 1
if use_linux == 1 if use_linux == 1
compute_prob=[c_path,'/sbvar_probabilities -ft ',options_.ms.output_file_tag]; compute_mdd=[c_path,'/sbvar_commandline -mdd -seed 5 -ft ',options_.ms.output_file_tag,' -d ',int2str(options_.ms.proposal_draws),' -pt 3'];
system(compute_prob); system(compute_mdd);
else else
compute_prob=[c_path,'\sbvar_probabilities -ft ',options_.ms.output_file_tag]; compute_mdd=[c_path,'\sbvar_commandline.exe -mdd -seed 5 -ft ',options_.ms.output_file_tag,' -d ',int2str(options_.ms.proposal_draws),' -pt 3'];
system(compute_prob); system(compute_mdd);
end end
else else
compute_prob=['-ft ',options_.ms.output_file_tag]; compute_mdd=['-mdd -seed 5 -ft ',options_.ms.output_file_tag,' -d ',int2str(options_.ms.proposal_draws),' -pt 3'];
[err] = mex_sbvar_probabilities(compute_prob); [err] = ms_sbvar_command_line(compute_mdd);
mexErrCheck('mex_sbvar_probabilities',err); mexErrCheck('ms_sbvar_command_line marginal data density',err);
end end
end end
%========================================================================== %==========================================================================
%== Print Draws %== Compute posterior mode regime probabilities
%========================================================================== %==========================================================================
if options_.ms.print_draws == 1 %error here as well if options_.ms.compute_probabilities == 1
if options_.ms.standalone == 1 if options_.ms.standalone == 1
if use_linux == 1 if use_linux == 1
print_draws=[c_path,'/sbvar_draws -cseed 5 -ft ',options_.ms.output_file_tag,' -i ',int2str(options_.ms.n_draws),' -t ',int2str(options_.ms.thinning_factor)]; compute_prob=[c_path,'/sbvar_commandline -probabilities -ft ',options_.ms.output_file_tag];
system(print_draws); system(compute_prob);
else else
print_draws=[c_path,'\sbvar_draws -cseed 5 -ft ',options_.ms.output_file_tag,' -i ',int2str(options_.ms.n_draws),' -t ',int2str(options_.ms.thinning_factor)]; compute_prob=[c_path,'\sbvar_commandline.exe -probabilities -ft ',options_.ms.output_file_tag];
system(print_draws); system(compute_prob);
end end
else else
print_draws=['-cseed 5 -ft ',options_.ms.output_file_tag,' -i ',int2str(options_.ms.n_draws),' -t ',int2str(options_.ms.thinning_factor)]; compute_prob=['-probabilities -ft ',options_.ms.output_file_tag];
[err] = mex_sbvar_draws(print_draws); [err] = ms_sbvar_command_line(compute_prob);
mexErrCheck('mex_sbvar_draws',err); mexErrCheck('ms_sbvar_command_line probabilities',err);
end end
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment