Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
73944a10
Commit
73944a10
authored
Nov 05, 2013
by
Sébastien Villemot
Browse files
Finish implementation of mcmc_jumping_covariance option
Closes #112, #514
parent
7dee2507
Changes
6
Show whitespace changes
Inline
Side-by-side
doc/dynare.texi
View file @
73944a10
...
...
@@ -4486,8 +4486,8 @@ value of that function as the posterior mode.
@
noindent
Default
value
is
@
code
{
4
}.
@
item
MCMC
_jumping_covariance
=
hessian
|
prior_variance
|
identity_matrix
|@
var
{
filename
}
Tells
Dynare
which
covariance
to
use
for
the
proposal
density
of
the
MCMC
sampler
.
@
code
{
MCMC
_jumping_covariance
}
can
be
one
of
the
following
:
@
item
mcmc
_jumping_covariance
=
hessian
|
prior_variance
|
identity_matrix
|@
var
{
FILENAME
}
Tells
Dynare
which
covariance
to
use
for
the
proposal
density
of
the
MCMC
sampler
.
@
code
{
mcmc
_jumping_covariance
}
can
be
one
of
the
following
:
@
table
@
code
@
item
hessian
...
...
@@ -4499,12 +4499,12 @@ Uses the prior variances. No infinite prior variances are allowed in this case.
@
item
identity_matrix
Uses
an
identity
matrix
.
@
item
filename
Loads
an
arbitrary
user
-
specified
covariance
matrix
from
@
code
{
filename
.
mat
}.
The
covariance
matrix
must
be
saved
in
a
variable
named
@
code
{
jumping_covariance
},
must
be
square
,
positive
definite
,
and
have
the
same
dimension
as
the
number
of
estimated
parameters
.
@
item
@
var
{
FILENAME
}
Loads
an
arbitrary
user
-
specified
covariance
matrix
from
@
code
{
@
var
{
FILENAME
}
.
mat
}.
The
covariance
matrix
must
be
saved
in
a
variable
named
@
code
{
jumping_covariance
},
must
be
square
,
positive
definite
,
and
have
the
same
dimension
as
the
number
of
estimated
parameters
.
@
end
table
@
noindent
Note
that
the
covariance
matrices
are
stil
scaled
with
@
ref
{
mh_jscale
}.
Default
value
is
@
code
{
hessian
}.
Note
that
the
covariance
matrices
are
stil
l
scaled
with
@
ref
{
mh_jscale
}.
Default
value
is
@
code
{
hessian
}.
@
item
mode_check
Tells
Dynare
to
plot
the
posterior
density
for
values
around
the
...
...
preprocessor/DynareBison.yy
View file @
73944a10
...
...
@@ -113,7 +113,7 @@ class ParsingDriver;
%token LYAPUNOV_FIXED_POINT_TOL LYAPUNOV_DOUBLING_TOL LYAPUNOV_SQUARE_ROOT_SOLVER_TOL LOG_DEFLATOR LOG_TREND_VAR LOG_GROWTH_FACTOR MARKOWITZ MARGINAL_DENSITY MAX MAXIT
%token MFS MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN MINIMAL_SOLVING_PERIODS
%token MODE_CHECK MODE_CHECK_NEIGHBOURHOOD_SIZE MODE_CHECK_SYMMETRIC_PLOTS MODE_CHECK_NUMBER_OF_POINTS MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL
MCMC_JUMPING_COVARIANCE
%token <string_val> NAME
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS
...
...
@@ -151,7 +151,7 @@ class ParsingDriver;
%token VLISTLOG VLISTPER
%token RESTRICTION RESTRICTION_FNAME CROSS_RESTRICTIONS NLAGS CONTEMP_REDUCED_FORM REAL_PSEUDO_FORECAST
%token DUMMY_OBS NSTATES INDXSCALESSTATES NO_BAYESIAN_PRIOR SPECIFICATION SIMS_ZHA
%token <string_val> ALPHA BETA ABAND NINV CMS NCMS CNUM GAMMA INV_GAMMA INV_GAMMA1 INV_GAMMA2 NORMAL UNIFORM EPS PDF FIG DR NONE PRIOR
%token <string_val> ALPHA BETA ABAND NINV CMS NCMS CNUM GAMMA INV_GAMMA INV_GAMMA1 INV_GAMMA2 NORMAL UNIFORM EPS PDF FIG DR NONE PRIOR
PRIOR_VARIANCE HESSIAN IDENTITY_MATRIX
%token GSIG2_LMDM Q_DIAG FLAT_PRIOR NCSK NSTD
%token INDXPARR INDXOVR INDXAP APBAND INDXIMF IMFBAND INDXFORE FOREBAND INDXGFOREHAT INDXGIMFHAT
%token INDXESTIMA INDXGDLS EQ_MS FILTER_COVARIANCE FILTER_DECOMPOSITION
...
...
@@ -1558,6 +1558,7 @@ estimation_options : o_datafile
| o_qz_zero_threshold
| o_taper_steps
| o_geweke_interval
| o_mcmc_jumping_covariance
;
list_optim_option : QUOTED_STRING COMMA QUOTED_STRING
...
...
@@ -2677,6 +2678,14 @@ o_discretionary_tol: DISCRETIONARY_TOL EQUAL non_negative_number { driver.option
o_analytic_derivation : ANALYTIC_DERIVATION { driver.option_num("analytic_derivation", "1"); }
o_endogenous_prior : ENDOGENOUS_PRIOR { driver.option_num("endogenous_prior", "1"); }
o_use_univariate_filters_if_singularity_is_detected : USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED EQUAL INT_NUMBER { driver.option_num("use_univariate_filters_if_singularity_is_detected", $3); }
o_mcmc_jumping_covariance : MCMC_JUMPING_COVARIANCE EQUAL HESSIAN
{ driver.option_str("MCMC_jumping_covariance", $3); } | MCMC_JUMPING_COVARIANCE EQUAL PRIOR_VARIANCE
{ driver.option_str("MCMC_jumping_covariance", $3); }
| MCMC_JUMPING_COVARIANCE EQUAL IDENTITY_MATRIX
{ driver.option_str("MCMC_jumping_covariance", $3); }
| MCMC_JUMPING_COVARIANCE EQUAL filename
{ driver.option_str("MCMC_jumping_covariance", $3); }
;
range : symbol '
:
' symbol
{
...
...
preprocessor/DynareFlex.ll
View file @
73944a10
...
...
@@ -439,6 +439,19 @@ string eofbuff;
<DYNARE_STATEMENT>random_parameter_convergence_criterion {return token::RANDOM_PARAMETER_CONVERGENCE_CRITERION;}
<DYNARE_STATEMENT>tolf {return token::TOLF;}
<DYNARE_STATEMENT>instruments {return token::INSTRUMENTS;}
<DYNARE_STATEMENT>hessian {
yylval->string_val = new string(yytext);
return token::HESSIAN;
}
<DYNARE_STATEMENT>prior_variance {
yylval->string_val = new string(yytext);
return token::PRIOR_VARIANCE;
}
<DYNARE_STATEMENT>identity_matrix {
yylval->string_val = new string(yytext);
return token::IDENTITY_MATRIX;
}
<DYNARE_STATEMENT>mcmc_jumping_covariance {return token::MCMC_JUMPING_COVARIANCE;}
/* These four (var, varexo, varexo_det, parameters) are for change_type */
<DYNARE_STATEMENT>var { return token::VAR; }
...
...
tests/Makefile.am
View file @
73944a10
...
...
@@ -3,6 +3,7 @@ MODFILES = \
estimation/fs2000_mc4_mf.mod
\
estimation/fs2000_mc6.mod
\
estimation/fs2000_mc6_mf.mod
\
estimation/fs2000_MCMC_jumping_covariance.mod
\
gsa/ls2003.mod
\
ramst.mod
\
ramst_a.mod
\
...
...
@@ -309,7 +310,8 @@ EXTRA_DIST = \
third_order/comparison_policy_functions_dynare_mathematica.m
\
third_order/policyfunctions.mat
\
shock_decomposition/example1_calib_shock_decomp_data.mat
\
shock_decomposition/fsdat_simul.m
shock_decomposition/fsdat_simul.m
\
estimation/fs2000_MCMC_jumping_covariance_steadystate.m
TARGETS
=
...
...
@@ -417,3 +419,5 @@ clean-local:
ms-sbvar/*.dat
\
ms-sbvar/tmv_rr_sr
\
ms-sbvar/tmv_rr_tr
rm
-f
estimation/test_matrix.mat
tests/estimation/fs2000_MCMC_jumping_covariance.mod
View file @
73944a10
...
...
@@ -73,14 +73,13 @@ varobs gp_obs gy_obs;
options_.solve_tolf = 1e-12;
options_.mode_compute=4;
options_.plot_priors=0;
options_.MCMC
_jumping_covariance=
'
hessian
'
;
estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=1000,mh_nblocks=1,mh_jscale=0.8);
estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=1000,mh_nblocks=1,mh_jscale=0.8,mcmc
_jumping_covariance=hessian
)
;
load fs2000_MCMC_jumping_covariance_mode hh;
jumping_covariance=diag(diag(hh));
save test_matrix jumping_covariance;
options_.MCMC_jumping_covariance='prior_variance';
estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=1000,mh_nblocks=1,mh_jscale=0.01);
options_.MCMC_jumping_covariance='identity_matrix';
estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=1000,mh_nblocks=1,mh_jscale=0.0001);
options_.MCMC_jumping_covariance='test_matrix';
estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=1000,mh_nblocks=1,mh_jscale=0.8);
save test_matrix.mat jumping_covariance;
estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=1000,mh_nblocks=1,mh_jscale=0.01,mcmc_jumping_covariance=prior_variance);
estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=1000,mh_nblocks=1,mh_jscale=0.0001,mcmc_jumping_covariance=identity_matrix);
estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=1000,mh_nblocks=1,mh_jscale=0.8,mcmc_jumping_covariance='test_matrix');
tests/estimation/fs2000_MCMC_jumping_covariance_steadystate.m
View file @
73944a10
...
...
@@ -18,7 +18,7 @@
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
function
[
ys
,
check
]
=
fs2000_steadystate
(
ys
,
exe
)
function
[
ys
,
check
]
=
fs2000_
MCMC_jumping_covariance_
steadystate
(
ys
,
exe
)
global
M_
alp
=
M_
.
params
(
1
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment