Merge pull request #739 from JohannesPfeifer/Cosmetic_changes

Cosmetic changes, documentation, and small bugfix
time-shift
Stéphane Adjemian 2014-10-13 13:39:19 +02:00
commit 573d276f1a
4 changed files with 18 additions and 12 deletions

View File

@ -5139,7 +5139,11 @@ Use the Univariate Diffuse Kalman Filter
@end table
@noindent
Default value is @code{0}. In case of missing observations of single or all series, Dynare treats those missing values as unobserved states and uses the Kalman filter to infer their value (see e.g. @cite{Durbin and Koopman (2012), Ch. 4.10})
This procedure has the advantage of being capable of dealing with observations where the forecast error variance matrix becomes singular for some variable(s).
If this happens, the respective observation enters with a weight of zero in the log-likelihood, i.e. this observation for the respective variable(s) is dropped
from the likelihood computations (for details see @cite{Durbin and Koopman (2012), Ch. 6.4 and 7.2.5}). If the use of a multivariate Kalman filter is specified and a
singularity is encountered, Dynare by default automatically switches to the univariate Kalman filter for this parameter draw. This behavior can be changed via the
@ref{use_univariate_filters_if_singularity_is_detected} option.
@item kalman_tol = @var{DOUBLE}
@anchor{kalman_tol} Numerical tolerance for determining the singularity of the covariance matrix of the prediction errors during the Kalman filter (minimum allowed reciprocal of the matrix condition number). Default value is @code{1e-10}
@ -5273,6 +5277,7 @@ Use endogenous priors as in @cite{Christiano, Trabandt and Walentin
(2011)}.
@item use_univariate_filters_if_singularity_is_detected = @var{INTEGER}
@anchor{use_univariate_filters_if_singularity_is_detected}
Decide whether Dynare should automatically switch to univariate filter
if a singularity is encountered in the likelihood computation (this is
the behaviour if the option is equal to @code{1}). Alternatively, if

View File

@ -1,4 +1,4 @@
function [fval,DLIK,Hess,exit_flag,ys,trend_coeff,info,Model,DynareOptions,BayesInfo,DynareResults] = dsge_likelihood(xparam1,DynareDataset,DatasetInfo,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults,derivatives_info)
function [fval,DLIK,Hess,exit_flag,SteadyState,trend_coeff,info,Model,DynareOptions,BayesInfo,DynareResults] = dsge_likelihood(xparam1,DynareDataset,DatasetInfo,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults,derivatives_info)
% Evaluates the posterior kernel of a dsge model using the specified
% kalman_algo; the resulting posterior includes the 2*pi constant of the
% likelihood function
@ -39,7 +39,7 @@ function [fval,DLIK,Hess,exit_flag,ys,trend_coeff,info,Model,DynareOptions,Bayes
%! Integer scalar, equal to zero if the routine return with a penalty (one otherwise).
%! @item ys
%! Vector of doubles, steady state level for the endogenous variables.
%! @item trend_coeffs
%! @item trend_coeff
%! Matrix of doubles, coefficients of the deterministic trend in the measurement equation.
%! @item info
%! Integer scalar, error code.
@ -136,16 +136,15 @@ global objective_function_penalty_base
% Initialization of the returned variables and others...
fval = [];
ys = [];
SteadyState = [];
trend_coeff = [];
exit_flag = 1;
info = 0;
singularity_flag = 0;
DLIK = [];
Hess = [];
if DynareOptions.estimation_dll
[fval,exit_flag,ys,trend_coeff,info,params,H,Q] ...
[fval,exit_flag,SteadyState,trend_coeff,info,params,H,Q] ...
= logposterior(xparam1,DynareDataset, DynareOptions,Model, ...
EstimatedParameters,BayesInfo,DynareResults);
mexErrCheck('logposterior', exit_flag);
@ -154,7 +153,7 @@ if DynareOptions.estimation_dll
Model.H = H;
end
Model.Sigma_e = Q;
DynareResults.dr.ys = ys;
DynareResults.dr.ys = SteadyState;
return
end
@ -315,7 +314,8 @@ if BayesInfo.with_trend
end
trend = repmat(constant,1,DynareDataset.nobs)+trend_coeff*[1:DynareDataset.nobs];
else
trend = repmat(constant,1,DynareDataset.nobs);
trend_coeff = zeros(DynareDataset.vobs,1);
trend = repmat(constant,1,DynareDataset.nobs);
end
% Get needed informations for kalman filter routines.

View File

@ -1,7 +1,7 @@
function [dataset_, dataset_info, xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] = dynare_estimation_init(var_list_, dname, gsa_flag, M_, options_, oo_, estim_params_, bayestopt_)
% function dynare_estimation_init(var_list_, gsa_flag)
% preforms initialization tasks before estimation or
% performs initialization tasks before estimation or
% global sensitivity analysis
%
% INPUTS

View File

@ -12,16 +12,17 @@ function [x,u] = lyapunov_symm(a,b,third_argument,lyapunov_complex_threshold,met
% lyapunov_complex_threshold [double] scalar, complex block threshold for the upper triangular matrix T.
% method [integer] Scalar, if method=0 [default] then U, T, n and k are not persistent.
% method=1 then U, T, n and k are declared as persistent
% variables and the schur decomposition is triggered.
% variables and the Schur decomposition is triggered.
% method=2 then U, T, n and k are declared as persistent
% variables and the schur decomposition is not performed.
% variables and the Schur decomposition is not performed.
% method=3 fixed point method
% OUTPUTS
% x: [double] m*m solution matrix of the lyapunov equation, where m is the dimension of the stable subsystem.
% u: [double] Schur vectors associated with unit roots
%
% ALGORITHM
% Uses reordered Schur decomposition
% Uses reordered Schur decomposition (Bartels-Stewart algorithm)
% [method<3] or a fixed point algorithm (method==4)
%
% SPECIAL REQUIREMENTS
% None