Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
688366d6
Commit
688366d6
authored
Mar 4, 2011
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
SWZ: sz_prd correct calls to mex functions
parent
b7447076
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/ms-sbvar/sz_prd.m
+43
-52
43 additions, 52 deletions
matlab/ms-sbvar/sz_prd.m
with
43 additions
and
52 deletions
matlab/ms-sbvar/sz_prd.m
+
43
−
52
View file @
688366d6
...
@@ -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
]
=
m
ex
_sbvar_init_file
(
create_init_file
);
[
err
]
=
m
s
_sbvar_
create_
init_file
(
create_init_file
);
mexErrCheck
(
'm
ex
_sbvar_init_file'
,
err
);
mexErrCheck
(
'm
s
_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_estimat
ion
-
c
seed 5 -ft '
,
options_
.
ms
.
output_file_tag
];
perform_estimation
=
[
c_path
,
'/sbvar_
commandline -
estimat
e
-seed 5 -ft '
,
options_
.
ms
.
output_file_tag
];
system
(
perform_estimation
);
system
(
perform_estimation
);
else
else
perform_estimation
=
[
c_path
,
'\sbvar_
estimation.exe -c
seed 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
=
[
'-
c
seed 5 -ft '
,
options_
.
ms
.
output_file_tag
];
perform_estimation
=
[
'-
estimate -
seed 5 -ft '
,
options_
.
ms
.
output_file_tag
];
[
err
]
=
m
ex
_sbvar_
estimation
(
perform_estimation
);
[
err
]
=
m
s
_sbvar_
command_line
(
perform_estimation
);
mexErrCheck
(
'm
ex
_sbvar_estimation'
,
err
);
mexErrCheck
(
'm
s
_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
]
=
m
ex
_sbvar_
probabilities
(
compute_
prob
);
[
err
]
=
m
s
_sbvar_
command_line
(
compute_
mdd
);
mexErrCheck
(
'm
ex
_sbvar_
probabilities
'
,
err
);
mexErrCheck
(
'm
s
_sbvar_
command_line marginal data density
'
,
err
);
end
end
end
end
%==========================================================================
%==========================================================================
%==
Print Draw
s
%==
Compute posterior mode regime probabilitie
s
%==========================================================================
%==========================================================================
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
]
=
m
ex
_sbvar_
draws
(
print_draws
);
[
err
]
=
m
s
_sbvar_
command_line
(
compute_prob
);
mexErrCheck
(
'm
ex
_sbvar_
draw
s'
,
err
);
mexErrCheck
(
'm
s
_sbvar_
command_line probabilitie
s'
,
err
);
end
end
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment