From 7f9d2968d9ce632e977d8623c4a9ddeb2c018afb Mon Sep 17 00:00:00 2001 From: Marco Ratto Date: Fri, 8 Jun 2012 08:50:07 +0200 Subject: [PATCH 1/2] fixed bug introduced in previous commit: offset needs to be computed for analytic derivatives. --- matlab/dsge_likelihood.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/matlab/dsge_likelihood.m b/matlab/dsge_likelihood.m index 1e7eada0f..3ac354605 100644 --- a/matlab/dsge_likelihood.m +++ b/matlab/dsge_likelihood.m @@ -457,7 +457,12 @@ switch DynareOptions.lik_init error('dsge_likelihood:: Unknown initialization approach for the Kalman filter!') end -if analytic_derivation +if analytic_derivation, + offset = EstimatedParameters.nvx; + offset = offset+EstimatedParameters.nvn; + offset = offset+EstimatedParameters.ncx; + offset = offset+EstimatedParameters.ncn; + no_DLIK = 0; full_Hess = analytic_derivation==2; asy_Hess = analytic_derivation==-2; From 2de336c94c3175b39fb35fb97e5202d23b407f5f Mon Sep 17 00:00:00 2001 From: Marco Ratto Date: Fri, 8 Jun 2012 08:50:48 +0200 Subject: [PATCH 2/2] fixed bug in analytic derivatives of normal pdf for vector inputs. --- matlab/lpdfnorm.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matlab/lpdfnorm.m b/matlab/lpdfnorm.m index 9afdd2b6d..cb7d7ebaa 100644 --- a/matlab/lpdfnorm.m +++ b/matlab/lpdfnorm.m @@ -35,9 +35,9 @@ if nargin<2, a=0; end ldens = -log(b) -.5*log(2*pi) - .5*((x-a)./b).*((x-a)./b) ; if nargout >1 - Dldens = - (1/b)*((x-a)/b) ; + Dldens = - (1./b).*((x-a)./b) ; end if nargout == 3 - D2ldens = - (1/b)^2 ; + D2ldens = - (1./b).^2 ; end \ No newline at end of file