Merge pull request #1254 from JohannesPfeifer/log_density_save

Save log_density at the mode and document oo_.posterior-fields
time-shift
MichelJuillard 2016-08-21 11:13:19 +02:00 committed by GitHub
commit cc5cafdd15
2 changed files with 52 additions and 0 deletions

View File

@ -5252,6 +5252,7 @@ Instructs Dynare to run mode computing/optimization silently without displaying
saving files in between. Useful when running loops.
@item mcmc_jumping_covariance = hessian|prior_variance|identity_matrix|@var{FILENAME}
@anchor{MCMC_jumping_covariance}
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
@ -6172,6 +6173,52 @@ Variable set by the @code{estimation} command, if it is used with
based on @cite{Geweke (1999)} Modified Harmonic Mean estimator.
@end defvr
@defvr {MATLAB/Octave variable} oo_.posterior.optimization
Variable set by the @code{estimation} command if mode-finding is used. Stores the results at the mode.
Fields are of the form
@example
@code{oo_.posterior.optimization.@var{OBJECT}}
@end example
where @var{OBJECT} is one of the following:
@table @code
@item mode
Parameter vector at the mode
@item Variance
Inverse Hessian matrix at the mode or MCMC jumping covariance matrix when used with the
@ref{MCMC_jumping_covariance} option
@item log_density
Log likelihood (ML)/log posterior density (Bayesian) at the mode when used with @code{mode_compute>0}
@end table
@end defvr
@defvr {MATLAB/Octave variable} oo_.posterior.metropolis
Variable set by the @code{estimation} command if @code{mh_replic>0} is used.
Fields are of the form
@example
@code{oo_.posterior.metropolis.@var{OBJECT}}
@end example
where @var{OBJECT} is one of the following:
@table @code
@item mean
Mean parameter vector from the MCMC
@item Variance
Covariance matrix of the parameter draws in the MCMC
@end table
@end defvr
@defvr {MATLAB/Octave variable} oo_.FilteredVariables
Variable set by the @code{estimation} command, if it is used with the
@code{filtered_vars} option.

View File

@ -355,9 +355,14 @@ end
oo_.posterior.optimization.mode = [];
oo_.posterior.optimization.Variance = [];
oo_.posterior.optimization.log_density=[];
invhess=[];
if ~options_.mh_posterior_mode_estimation
oo_.posterior.optimization.mode = xparam1;
if exist('fval','var')
oo_.posterior.optimization.log_density=-fval;
end
if options_.cova_compute
invhess = inv(hh);
stdh = sqrt(diag(invhess));