Commit 1fcf708b authored by MichelJuillard's avatar MichelJuillard
Browse files

Merge remote-tracking branch 'origin/master' into dr1break

parents 80ca47d6 4ba016cc
dnl Process this file with autoconf to produce a configure script.
dnl Copyright (C) 2009-2011 Dynare Team
dnl Copyright (C) 2009-2012 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
......@@ -30,7 +30,7 @@ case ${host_os} in
*mingw32*)
# On mingw32, we don't want dynamic libgcc
# Note that static-libstdc++ is only supported since GCC 4.5 (but generates no error on older versions)
LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -static-libgfortran"
have_windows="yes"
;;
*cygwin*)
......@@ -155,6 +155,15 @@ AC_CHECK_PROG([CWEAVE], [cweave], [cweave])
AM_CONDITIONAL([HAVE_CWEAVE], [test "x$CWEAVE" != "x"])
AC_PROG_F77
AC_F77_LIBRARY_LDFLAGS
# Hack to get static linking of libgfortran on MinGW
# (-static-libgfortran doesn't act on gcc/g++)
case ${host_os} in
*mingw32*)
FLIBS=`echo $FLIBS | sed 's/-lgfortran/-Wl,-Bstatic -lgfortran -Wl,-Bdynamic/'`
;;
esac
if test "x$F77" != "x"; then
AX_BLAS
AX_LAPACK
......
......@@ -295,15 +295,15 @@ Stéphane Adjemian (Université du Maine, Gains and Cepremap), Houtan
Bastani (Cepremap), Michel Juillard (Banque de France), Frédéric Karamé
(Université d'Évry, Epee and Cepremap), Junior Maih (Norges Bank),
Ferhat Mihoubi (Université d'Évry, Epee and Cepremap), George Perendia,
Marco Ratto (JRC) and Sébastien Villemot (Cepremap and Paris School of
Economics). Increasingly, the developer base is expanding, as tools
developed by researchers outside of Cepremap are integrated into
Dynare. Financial support is provided by Cepremap, Banque de France and
DSGE-net (an international research network for DSGE modeling). The
Dynare project also received funding through the Seventh Framework
Programme for Research (FP7) of the European Commission's Socio-economic
Sciences and Humanities (SSH) Program from October 2008 to September
2011 under grant agreement SSH-CT-2009-225149.
Johannes Pfeifer, Marco Ratto (JRC) and Sébastien Villemot (Cepremap and
Paris School of Economics). Increasingly, the developer base is
expanding, as tools developed by researchers outside of Cepremap are
integrated into Dynare. Financial support is provided by Cepremap,
Banque de France and DSGE-net (an international research network for
DSGE modeling). The Dynare project also received funding through the
Seventh Framework Programme for Research (FP7) of the European
Commission's Socio-economic Sciences and Humanities (SSH) Program from
October 2008 to September 2011 under grant agreement SSH-CT-2009-225149.
Interaction between developers and users of Dynare is central to the
project. A @uref{http://www.dynare.org/phpBB3, web forum} is available
......@@ -3888,6 +3888,9 @@ Uses Dynare implementation of the Nelder-Mead simplex based optimization
routine (generally more efficient than the MATLAB or Octave implementation
available with @code{mode_compute=7})
@item 9
Uses the CMA-ES (Covariance Matrix Adaptation Evolution Strategy) algorithm, an evolutionary algorithm for difficult non-linear non-convex optimization
@item @var{FUNCTION_NAME}
It is also possible to give a @var{FUNCTION_NAME} to this option,
instead of an @var{INTEGER}. In that case, Dynare takes the return
......@@ -3988,6 +3991,7 @@ and graphics that can be later directly included in LaTeX files (not
yet implemented)
@item kalman_algo = @var{INTEGER}
@anchor{kalman_algo}
@dots{}
@item kalman_tol = @var{DOUBLE}
......@@ -5263,6 +5267,9 @@ Critical value for correlation @math{\rho}: plot couples of parmaters with
@item mode_file = @var{FILENAME}
@xref{mode_file}.
@item kalman_algo = @var{INTEGER}
@xref{kalman_algo}.
@end table
@customhead{Identification Analysis Options}
@table @code
......@@ -5290,6 +5297,9 @@ for identification analysis. Default: @code{0}
@item ar = @var{INTEGER}
Maximum number of lags for moments in identification analysis. Default: @code{1}
@item lik_init = @var{INTEGER}
@xref{lik_init}.
@end table
@end deffn
......@@ -5357,6 +5367,9 @@ Specify the parameter set to use. Default: @code{prior_mean}
@item lik_init = @var{INTEGER}
@xref{lik_init}.
@item kalman_algo = @var{INTEGER}
@xref{kalman_algo}.
@end table
@end deffn
......@@ -5841,20 +5854,17 @@ model. Output @code{.eps} files are contained in
@xref{simulation_file_tag}.
@item horizon = @var{INTEGER}
The forecast horizon. Default: @code{12}
@anchor{horizon} The forecast horizon. Default: @code{12}
@item filtered_probabilities
@anchor{filtered_probabilities} Uses filtered probabilities at the end
of the sample as initial conditions for regime probabilities. Default:
@code{off}
@item no_error_bands
@anchor{no_error_bands} Do not output error bands. Default: @code{off}
(@i{i.e.} output error bands)
of the sample as initial conditions for regime probabilities. Only one
of @code{filtered_probabilities}, @code{regime} and @code{regimes} may
be passed. Default: @code{off}
@item error_band_percentiles = [@var{DOUBLE1} @dots{}]
@anchor{error_band_percentiles} The percentiles to compute. Default:
@code{[0.16 0.50 0.84]}. If @code{no_error_bands} is passed, the default
@code{[0.16 0.50 0.84]}. If @code{median} is passed, the default
is @code{[0.5]}
@item shock_draws = @var{INTEGER}
......@@ -5873,11 +5883,25 @@ draws in posterior draws file are used. Default: @code{1}
@anchor{free_parameters} A vector of free parameters to initialize theta
of the model. Default: use estimated parameters
@item median
@anchor{median}
@item parameter_uncertainty
@anchor{parameter_uncertainty} Calculate IRFs under parameter
uncertainty. Requires that @command{ms_simulation} has been
run. Default: @code{off}
A shortcut to setting @code{error_band_percentiles=[0.5]}. Default:
@code{off}
@item regime = @var{INTEGER}
@anchor{regime} Given the data and model parameters, what is the ergodic
probability of being in the specified regime. Only one of
@code{filtered_probabilities}, @code{regime} and @code{regimes} may be
passed. Default: @code{off}
@item regimes
@anchor{regimes} Describes the evolution of regimes. Only one of
@code{filtered_probabilities}, @code{regime} and @code{regimes} may be
passed. Default: @code{off}
@item median
@anchor{median} A shortcut to setting
@code{error_band_percentiles=[0.5]}. Default: @code{off}
@end table
......@@ -5909,9 +5933,6 @@ while data files are contained in @code{<output_file_tag/Forecast>}.
@item data_obs_nbr = @var{INTEGER}
The number of data points included in the output. Default: @code{0}
@item no_error_bands
@xref{no_error_bands}.
@item error_band_percentiles = [@var{DOUBLE1} @dots{}]
@xref{error_band_percentiles}.
......@@ -5927,6 +5948,16 @@ The number of data points included in the output. Default: @code{0}
@item free_parameters = @var{NUMERICAL_VECTOR}
@xref{free_parameters}.
@item parameter_uncertainty
@xref{parameter_uncertainty}.
@item regime = @var{INTEGER}
@xref{regime}.
@item regimes
@xref{regimes}.
@item median
@xref{median}.
......@@ -5959,11 +5990,15 @@ are contained in @code{<output_file_tag/Variance_Decomposition>}.
@item simulation_file_tag = @var{FILENAME}
@xref{simulation_file_tag}.
@item horizon = @var{INTEGER}
@xref{horizon}.
@item filtered_probabilities
@xref{filtered_probabilities}.
@item no_error_bands
@xref{no_error_bands}.
Do not output percentile error bands (@i{i.e.} compute mean). Default:
@code{off} (@i{i.e.} output error bands)
@item error_band_percentiles = [@var{DOUBLE1} @dots{}]
@xref{error_band_percentiles}.
......@@ -5980,9 +6015,15 @@ are contained in @code{<output_file_tag/Variance_Decomposition>}.
@item free_parameters = @var{NUMERICAL_VECTOR}
@xref{free_parameters}.
@item median
@item parameter_uncertainty
@xref{parameter_uncertainty}.
@xref{median}.
@item regime = @var{INTEGER}
@xref{regime}.
@item regimes
@xref{regimes}.
@end table
......@@ -6075,7 +6116,7 @@ line. The main directives are:
@item
@code{@@#define}, for defining a macro-processor variable,
@item
@code{@@#if}, @code{@@#then}, @code{@@#else}, @code{@@#endif} for
@code{@@#if}, @code{@@#ifdef}, @code{@@#else}, @code{@@#endif} for
conditional statements,
@item
@code{@@#for}, @code{@@#endfor} for constructing loops.
......@@ -6218,13 +6259,15 @@ end;
@end deffn
@deffn {Macro directive} @@#if @var{MACRO_EXPRESSION}
@deffnx {Macro directive} @@#ifdef @var{MACRO_VARIABLE}
@deffnx {Macro directive} @@#else
@deffnx {Macro directive} @@#endif
Conditional inclusion of some part of the @file{.mod} file.
The lines between @code{@@#if} and the next @code{@@#else} or
@code{@@#end} is executed only if the condition evaluates to a
non-null integer. The @code{@@#else} branch is optional and, if
present, is only evaluated if the condition evaluates to @code{0}.
The lines between @code{@@#if} or @code{@@#ifdef} and the next
@code{@@#else} or @code{@@#endif} is executed only if the condition
evaluates to a non-null integer. The @code{@@#else} branch is optional
and, if present, is only evaluated if the condition evaluates to
@code{0}.
@examplehead
......@@ -6242,6 +6285,23 @@ model;
end;
@end example
@examplehead
Choose between two alternative monetary policy rules using a
macro-variable. As @code{linear_mon_pol} was not previously defined in
this example, the second equation will be chosen:
@example
model;
@@#ifdef linear_mon_pol
i = w*i(-1) + (1-w)*i_ss + w2*(pie-piestar);
@@#else
i = i(-1)^w * i_ss^(1-w) * (pie/piestar)^w2;
@@#endif
...
end;
@end example
@end deffn
@deffn {Macro directive} @@#for @var{MACRO_VARIABLE} in @var{MACRO_EXPRESSION}
......
......@@ -8,6 +8,8 @@
\usepackage{psfrag}
\usepackage{setspace}
\usepackage{rotating}
\usepackage{hyperref}
\hypersetup{breaklinks=true,pagecolor=white,colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=blue}
%\singlespacing (interlinea singola)
%\onehalfspacing (interlinea 1,5)
%\doublespacing (interlinea doppia)
......@@ -20,7 +22,13 @@
\begin{document}
% ----------------------------------------------------------------
\title{Sensitivity Analysis Toolbox for DYNARE}%
\title{Sensitivity Analysis Toolbox for DYNARE\thanks{Copyright \copyright~2012 Dynare
Team. Permission is granted to copy, distribute and/or modify
this document under the terms of the GNU Free Documentation
License, Version 1.3 or any later version published by the Free
Software Foundation; with no Invariant Sections, no Front-Cover
Texts, and no Back-Cover Texts. A copy of the license can be found
at: \url{http://www.gnu.org/licenses/fdl.txt}}}
\author{Marco Ratto\\
European Commission, Joint Research Centre \\
......
......@@ -65,7 +65,7 @@
\begin{itemize}
\item file inclusion
\item loops (\textit{for} structure)
\item conditional inclusion (\textit{if/then/else} structures)
\item conditional inclusion (\textit{if/else} structures)
\item expression substitution
\end{itemize}
\item Implemented in Dynare starting from version 4.0
......@@ -95,7 +95,7 @@
\begin{itemize}
\item file inclusion: \verb+@#include+
\item definition a variable of the macro-processor: \verb+@#define+
\item conditional statements (\verb+@#if/@#then/@#else/@#endif+)
\item conditional statements (\verb+@#if/@#else/@#endif+)
\item loop statements (\verb+@#for/@#endfor+)
\end{itemize}
\item In most cases, directives occupy exactly one line of text. In case of need, two anti-slashes (\verb+\\+) at the end of the line indicates that the directive is continued on the next line.
......
This diff is collapsed.
This diff is collapsed.
......@@ -44,7 +44,7 @@ function [s,nu] = inverse_gamma_specification(mu,sigma,type,use_fzero_flag)
%! @end deftypefn
%@eod:
% Copyright (C) 2003-2011 Dynare Team
% Copyright (C) 2003-2012 Dynare Team
%
% This file is part of Dynare.
%
......@@ -99,7 +99,7 @@ elseif type == 1; % Inverse Gamma 1
end
end
% Solve for nu using the secant method.
while abs(nu2-nu1) > 1e-8
while abs(nu2/nu1-1) > 1e-14
if err > 0
nu1 = nu;
if nu < nu2
......@@ -117,10 +117,10 @@ elseif type == 1; % Inverse Gamma 1
end
s = (sigma2+mu2)*(nu-2);
if check_solution_flag
if abs(mu-sqrt(s/2)*gamma((nu-1)/2)/gamma(nu/2))>1e-9
if abs(log(mu)-log(sqrt(s/2))-gammaln((nu-1)/2)+gammaln(nu/2))>1e-7
error('inverse_gamma_specification:: Failed in solving for the hyperparameters!');
end
if abs(sigma-sqrt(s/(nu-2)-mu^2))>1e-9
if abs(sigma-sqrt(s/(nu-2)-mu^2))>1e-7
error('inverse_gamma_specification:: Failed in solving for the hyperparameters!');
end
end
......
function [dr,info,M_,options_,oo_] = dr1(dr,task,M_,options_,oo_)
function [dr,info] = dr1(dr,task,M_,options_,oo_)
% function [dr,info,M_,options_,oo_] = dr1(dr,task,M_,options_,oo_)
% computes the reduced form solution of a rational expectation model (first or second order
% approximation of the stochastic model around the deterministic steady state).
......@@ -21,9 +21,6 @@ function [dr,info,M_,options_,oo_] = dr1(dr,task,M_,options_,oo_)
% indeterminacy.
% info=5: BK rank condition not satisfied.
% info=6: The jacobian matrix evaluated at the steady state is complex.
% M_ [matlab structure]
% options_ [matlab structure]
% oo_ [matlab structure]
%
% ALGORITHM
% ...
......@@ -61,7 +58,6 @@ end
if options_.k_order_solver;
dr = set_state_space(dr,M_);
[dr,info] = k_order_pert(dr,M_,options_,oo_);
oo_.dr = dr;
return;
end
......@@ -72,20 +68,12 @@ iyv = iyv(:);
iyr0 = find(iyv) ;
it_ = M_.maximum_lag + 1 ;
if M_.exo_nbr == 0
oo_.exo_steady_state = [] ;
end
klen = M_.maximum_lag + M_.maximum_lead + 1;
iyv = lead_lag_incidence';
iyv = iyv(:);
iyr0 = find(iyv) ;
it_ = M_.maximum_lag + 1 ;
if M_.exo_nbr == 0
oo_.exo_steady_state = [] ;
end
it_ = M_.maximum_lag + 1;
z = repmat(dr.ys,1,klen);
if ~options_.bytecode
......
......@@ -567,7 +567,9 @@ for i = 1:Size;
if block_type == 5
vghx_other = - inv(kron(eye(size(D_,2)), A_) + kron(C_', B_)) * vec(D_);
ghx_other = reshape(vghx_other, size(D_,1), size(D_,2));
else
elseif options_.sylvester_fp == 1
ghx_other = gensylv_fp(A_, B_, C_, D_, i);
else
[err, ghx_other] = gensylv(1, A_, B_, C_, -D_);
end;
if options_.aim_solver ~= 1 && options_.use_qzdiv
......@@ -650,7 +652,7 @@ for i = 1:Size;
end
end;
if task ~=1
if (maximum_lag > 0 && n_pred > 0)
if (maximum_lag > 0 && (n_pred > 0 || n_both > 0))
sorted_col_dr_ghx = M_.block_structure.block(i).sorted_col_dr_ghx;
dr.ghx(endo, sorted_col_dr_ghx) = dr.ghx(endo, sorted_col_dr_ghx) + ghx;
data(i).ghx = ghx;
......
......@@ -127,17 +127,21 @@ function [fval,exit_flag,ys,trend_coeff,info,Model,DynareOptions,BayesInfo,Dynar
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT FR
% Declaration of the penalty as a persistent variable.
persistent penalty
% Initialization of the persistent variable.
if ~nargin || isempty(penalty)
penalty = 1e8;
if ~nargin, return, end
end
if nargin==1
penalty = xparam1;
return
end
% Persistent variable 'penalty' is used to compute an endogenous penalty to
% the value 'fval' when various conditions are encountered. These conditions
% set also 'exit_flag' equal to 0 instead of 1. It is only when
% dsge_likelihood() is called by an optimizer called by
% dynare_estimation_1() that 'exit_flag' is ignored and penalized 'fval' is
% actually used.
% In that case, 'penalty' is properly initialized, at the very end of the
% present function, by a call to dsge_likelihood() made in
% initial_estimation_checks(). If a condition triggers exit_flag ==
% 0, initial_estimation_checks() triggers an error.
% In summary, an initial call to the present function, without triggering
% any condition, guarantees that 'penalty' is properly initialized when needed.
persistent penalty
% Initialization of the returned variables and others...
fval = [];
......@@ -146,6 +150,21 @@ trend_coeff = [];
exit_flag = 1;
info = 0;
singularity_flag = 0;
DLIK = [];
AHess = [];
if DynareOptions.estimation_dll
[fval,exit_flag,ys,trend_coeff,info,params,H,Q] ...
= logposterior(xparam1,DynareDataset, DynareOptions,Model, ...
EstimatedParameters,BayesInfo,DynareResults);
Model.params = params;
if ~isequal(Model.H,0)
Model.H = H;
end
Model.Sigma_e = Q;
DynareResults.dr.ys = ys;
return
end
% Set flag related to analytical derivatives.
if nargout > 9
......@@ -209,7 +228,7 @@ if EstimatedParameters.ncx
a = diag(eig(Q));
k = find(a < 0);
if k > 0
fval = BayesInfo.penalty+sum(-a(k));
fval = penalty+sum(-a(k));
exit_flag = 0;
info = 43;
return
......@@ -233,7 +252,7 @@ if EstimatedParameters.ncn
a = diag(eig(H));
k = find(a < 0);
if k > 0
fval = BayesInfo.penalty+sum(-a(k));
fval = penalty+sum(-a(k));
exit_flag = 0;
info = 44;
return
......@@ -339,13 +358,19 @@ end
diffuse_periods = 0;
correlated_errors_have_been_checked = 0;
singular_diffuse_filter = 0;
switch DynareOptions.lik_init
case 1% Standard initialization with the steady state of the state equation.
if kalman_algo~=2
% Use standard kalman filter except if the univariate filter is explicitely choosen.
kalman_algo = 1;
end
Pstar = lyapunov_symm(T,R*Q*R',DynareOptions.qz_criterium,DynareOptions.lyapunov_complex_threshold);
if DynareOptions.lyapunov_fp == 1
Pstar = lyapunov_symm(T,Q,DynareOptions.qz_criterium,DynareOptions.lyapunov_complex_threshold, 4, R);
else
Pstar = lyapunov_symm(T,R*Q*R',DynareOptions.qz_criterium,DynareOptions.lyapunov_complex_threshold);
end;
Pinf = [];
a = zeros(mm,1);
Zflag = 0;
......@@ -359,10 +384,14 @@ switch DynareOptions.lik_init
a = zeros(mm,1);
Zflag = 0;
case 3% Diffuse Kalman filter (Durbin and Koopman)
if kalman_algo ~= 4
% Use standard kalman filter except if the univariate filter is explicitely choosen.
if kalman_algo == 0
kalman_algo = 3;
elseif ~((kalman_algo == 3) || (kalman_algo == 4))
error(['diffuse filter: options_.kalman_algo can only be equal ' ...
'to 0 (default), 3 or 4'])
end
[Z,T,R,QT,Pstar,Pinf] = schur_statespace_transformation(Z,T,R,Q,DynareOptions.qz_criterium);
Zflag = 1;
% Run diffuse kalman filter on first periods.
......@@ -383,39 +412,39 @@ switch DynareOptions.lik_init
diffuse_periods = length(tmp);
if isinf(dLIK)
% Go to univariate diffuse filter if singularity problem.
kalman_algo = 4;
singularity_flag = 1;
singular_diffuse_filter = 1;
end
end
if (kalman_algo==4)
if singular_diffuse_filter || (kalman_algo==4)
% Univariate Diffuse Kalman Filter
if singularity_flag
if isequal(H,0)
H = zeros(nobs,1);
mmm = mm;
if isequal(H,0)
H1 = zeros(nobs,1);
mmm = mm;
else
if all(all(abs(H-diag(diag(H)))<1e-14))% ie, the covariance matrix is diagonal...
H1 = diag(H);
mmm = mm;
else
if all(all(abs(H-diag(diag(H)))<1e-14))% ie, the covariance matrix is diagonal...
H = diag(H);
mmm = mm;
else
Z = [Z, eye(pp)];
T = blkdiag(T,zeros(pp));
Q = blkdiag(Q,H);
R = blkdiag(R,eye(pp));
Pstar = blkdiag(Pstar,H);
Pinf = blckdiag(Pinf,zeros(pp));
H = zeros(nobs,1);
mmm = mm+pp;
end
Z = [Z, eye(pp)];
T = blkdiag(T,zeros(pp));
Q = blkdiag(Q,H);
R = blkdiag(R,eye(pp));
Pstar = blkdiag(Pstar,H);
Pinf = blckdiag(Pinf,zeros(pp));
H1 = zeros(nobs,1);
mmm = mm+pp;
end
% no need to test again for correlation elements
singularity_flag = 0;
end
[dLIK,tmp,a,Pstar] = univariate_kalman_filter_d(DynareDataset.missing.aindex,DynareDataset.missing.number_of_observations,DynareDataset.missing.no_more_missing_observations, ...
Y, 1, size(Y,2), ...
zeros(mmm,1), Pinf, Pstar, ...
kalman_tol, riccati_tol, DynareOptions.presample, ...
T,R,Q,H,Z,mmm,pp,rr);
% no need to test again for correlation elements
correlated_errors_have_been_checked = 1;
[dLIK,tmp,a,Pstar] = univariate_kalman_filter_d(DynareDataset.missing.aindex,...
DynareDataset.missing.number_of_observations,...
DynareDataset.missing.no_more_missing_observations, ...
Y, 1, size(Y,2), ...
zeros(mmm,1), Pinf, Pstar, ...
kalman_tol, riccati_tol, DynareOptions.presample, ...
T,R,Q,H1,Z,mmm,pp,rr);
diffuse_periods = length(tmp);
end
case 4% Start from the solution of the Riccati equation.
......@@ -586,7 +615,6 @@ if ((kalman_algo==1) || (kalman_algo==3))% Multivariate Kalman Filter
else
kalman_algo = 4;
end
singularity_flag = 1;
else
if DynareOptions.lik_init==3
LIK = LIK + dLIK;
......@@ -594,10 +622,10 @@ if ((kalman_algo==1) || (kalman_algo==3))% Multivariate Kalman Filter
end
end
if ( singularity_flag || (kalman_algo==2) || (kalman_algo==4) )
if (kalman_algo==2) || (kalman_algo==4)
% Univariate Kalman Filter
% resetting measurement error covariance matrix when necessary %
if singularity_flag
if ~correlated_errors_have_been_checked
if isequal(H,0)
H = zeros(nobs,1);
mmm = mm;
......
function [fval,llik,cost_flag,ys,trend_coeff,info] = DsgeLikelihood_hh(xparam1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults)
function [fval,llik,cost_flag,ys,trend_coeff,info] = dsge_likelihood_hh(xparam1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults)
% function [fval,llik,cost_flag,ys,trend_coeff,info] = DsgeLikelihood_hh(xparam1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults)
% Evaluates the posterior kernel of a dsge model.
%
......@@ -41,17 +41,20 @@ function [fval,llik,cost_flag,ys,trend_coeff,info] = DsgeLikelihood_hh(xparam1,D
% Declaration of the penalty as a persistent variable.
persistent penalty
% Initialization of the persistent variable.