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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
688366d6
Commit
688366d6
authored
14 years ago
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
SWZ: sz_prd correct calls to mex functions
parent
b7447076
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide 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','');
% path for C executables
%c_path='./c-executables';
c_path
=
[
ms_root
'
/bin
'
];
c_path
=
[
ms_root
'
../../ms-sbvar
'
];
% path for Markov specification
m_spec_path
=
[
ms_root
'/switching_specification'
];
%
m_spec_path=[ms_root '/switching_specification'];
% path for MHM specification
mhm_spec_path
=
[
ms_root
'/mhm_specification'
];
%
mhm_spec_path=[ms_root '/mhm_specification'];
%==========================================================================
%== Processing control
...
...
@@ -59,7 +59,7 @@ markov_file = [options_.ms.markov_file '.dat'];
%options_.ms.mhm_file = 'MHM_input.dat';
mhm_file
=
'/MHM_input.dat'
;
%
mhm_file = '/MHM_input.dat';
%options_.ms.proposal_draws = 100000;
%==========================================================================
...
...
@@ -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
];
system
(
create_init_file
);
%Run operating system command and return result
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
)
end
else
create_init_file
=
[
matlab_filename
,
' '
,
markov_file
,
' '
,
options_
.
ms
.
output_file_tag
];
[
err
]
=
m
ex
_sbvar_init_file
(
create_init_file
);
mexErrCheck
(
'm
ex
_sbvar_init_file'
,
err
);
[
err
]
=
m
s
_sbvar_
create_
init_file
(
create_init_file
);
mexErrCheck
(
'm
s
_sbvar_
create_
init_file'
,
err
);
end
end
...
...
@@ -508,84 +508,75 @@ end
if
options_
.
ms
.
estimate_msmodel
==
1
if
options_
.
ms
.
standalone
==
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
);
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
)
end
else
perform_estimation
=
[
'-
c
seed 5 -ft '
,
options_
.
ms
.
output_file_tag
];
[
err
]
=
m
ex
_sbvar_
estimation
(
perform_estimation
);
mexErrCheck
(
'm
ex
_sbvar_estimation'
,
err
);
perform_estimation
=
[
'-
estimate -
seed 5 -ft '
,
options_
.
ms
.
output_file_tag
];
[
err
]
=
m
s
_sbvar_
command_line
(
perform_estimation
);
mexErrCheck
(
'm
s
_sbvar_
command_line
estimation'
,
err
);
end
end
%==========================================================================
%==
Compute marginal data density
%==
Simulation
%==========================================================================
if
options_
.
ms
.
compute_mdd
==
1
mhm_file
=
[
'mhm_input_'
M
.
fname
'.dat'
];
ms_write_mhm_input
(
mhm_file
,
options_
.
ms
);
if
options_
.
ms
.
print_draws
==
1
if
options_
.
ms
.
standalone
==
1
if
use_linux
==
1
compute_mdd1
=
[
c_path
,
'/sbvar_mhm_1 -cseed 5 -ft '
,
options_
.
ms
.
output_file_tag
,
' -fi '
,
mhm_file
];
system
(
compute_mdd1
);
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
);
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
(
print_draws
);
else
compute_mdd1
=
[
c_path
,
'\sbvar_mhm_1.exe -cseed 5 -ft '
,
options_
.
ms
.
output_file_tag
,
' -fi '
,
mhm_file
];
system
(
compute_mdd1
);
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
);
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
(
print_draws
);
end
else
compute_mdd1
=
[
'-cseed 5 -ft '
,
options_
.
ms
.
output_file_tag
,
' -fi '
,
mhm_file
];
[
err
]
=
mex_sbvar_mhm_1
(
compute_mdd1
);
mexErrCheck
(
'mex_sbvar_mhm_1'
,
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
);
print_draws
=
[
'-simulate -seed 5 -ft '
,
options_
.
ms
.
output_file_tag
,
' -ndraws '
,
int2str
(
options_
.
ms
.
n_draws
),
' -thin '
,
int2str
(
options_
.
ms
.
thinning_factor
)];
[
err
]
=
ms_sbvar_command_line
(
print_draws
);
mexErrCheck
(
'ms_sbvar_command_line simulation'
,
err
);
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
use_linux
==
1
compute_
prob
=
[
c_path
,
'/sbvar_
probabilities
-ft '
,
options_
.
ms
.
output_file_tag
];
system
(
compute_
prob
);
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_
mdd
);
else
compute_
prob
=
[
c_path
,
'\sbvar_
probabilities
-ft '
,
options_
.
ms
.
output_file_tag
];
system
(
compute_
prob
);
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_
mdd
);
end
else
compute_
prob
=
[
'
-ft '
,
options_
.
ms
.
output_file_tag
];
[
err
]
=
m
ex
_sbvar_
probabilities
(
compute_
prob
);
mexErrCheck
(
'm
ex
_sbvar_
probabilities
'
,
err
);
compute_
mdd
=
[
'-mdd -seed 5
-ft '
,
options_
.
ms
.
output_file_tag
,
' -d '
,
int2str
(
options_
.
ms
.
proposal_draws
),
' -pt 3'
];
[
err
]
=
m
s
_sbvar_
command_line
(
compute_
mdd
);
mexErrCheck
(
'm
s
_sbvar_
command_line marginal data density
'
,
err
);
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
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
)
];
system
(
print_draws
);
compute_prob
=
[
c_path
,
'/sbvar_
commandline -probabilities
-ft '
,
options_
.
ms
.
output_file_tag
];
system
(
compute_prob
);
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
)
];
system
(
print_draws
);
compute_prob
=
[
c_path
,
'\sbvar_
commandline.exe -probabilities
-ft '
,
options_
.
ms
.
output_file_tag
];
system
(
compute_prob
);
end
else
print_draws
=
[
'-cseed 5
-ft '
,
options_
.
ms
.
output_file_tag
,
' -i '
,
int2str
(
options_
.
ms
.
n_draws
),
' -t '
,
int2str
(
options_
.
ms
.
thinning_factor
)
];
[
err
]
=
m
ex
_sbvar_
draws
(
print_draws
);
mexErrCheck
(
'm
ex
_sbvar_
draw
s'
,
err
);
compute_prob
=
[
'-probabilities
-ft '
,
options_
.
ms
.
output_file_tag
];
[
err
]
=
m
s
_sbvar_
command_line
(
compute_prob
);
mexErrCheck
(
'm
s
_sbvar_
command_line probabilitie
s'
,
err
);
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