From c42f33ff472cc2583da27db7e0b38737ae392bb1 Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 3 Apr 2009 22:23:46 +0000 Subject: [PATCH] Bug fix + Cosmetic change. Do not compute the likelihood if the steady state is complex. git-svn-id: https://www.dynare.org/svn/dynare/trunk@2554 ac1d8469-bf42-47a9-8791-bf33cf982152 --- matlab/DsgeLikelihood.m | 34 +++++++++++++++++----------------- matlab/resol.m | 1 + 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/matlab/DsgeLikelihood.m b/matlab/DsgeLikelihood.m index e879c609f..60ce7d1b3 100644 --- a/matlab/DsgeLikelihood.m +++ b/matlab/DsgeLikelihood.m @@ -127,26 +127,26 @@ function [fval,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend,data [T,R,SteadyState,info] = dynare_resolve(bayestopt_.restrict_var_list,... bayestopt_.restrict_columns,... bayestopt_.restrict_aux); - if info(1) == 1 | info(1) == 2 | info(1) == 5 - fval = bayestopt_.penalty+1; - cost_flag = 0; - return - elseif info(1) == 3 | info(1) == 4 | info(1) == 20 - fval = bayestopt_.penalty+info(2);%^2; % penalty power raised in DR1.m and resol already. GP July'08 - cost_flag = 0; - return + if info(1) == 1 || info(1) == 2 || info(1) == 5 + fval = bayestopt_.penalty+1; + cost_flag = 0; + return + elseif info(1) == 3 || info(1) == 4 || info(1) == 20 || info(1) == 21 + fval = bayestopt_.penalty+info(2);%^2; % penalty power raised in DR1.m and resol already. GP July'08 + cost_flag = 0; + return end bayestopt_.mf = bayestopt_.mf1; - if ~options_.noconstant - if options_.loglinear == 1 - constant = log(SteadyState(bayestopt_.mfys)); - else - constant = SteadyState(bayestopt_.mfys); - end - else - constant = zeros(nobs,1); + if options_.noconstant + constant = zeros(nobs,1); + else + if options_.loglinear + constant = log(SteadyState(bayestopt_.mfys)); + else + constant = SteadyState(bayestopt_.mfys); + end end - if bayestopt_.with_trend == 1 + if bayestopt_.with_trend trend_coeff = zeros(nobs,1); t = options_.trend_coeffs; for i=1:length(t) diff --git a/matlab/resol.m b/matlab/resol.m index 7ba1691f5..c7034854f 100644 --- a/matlab/resol.m +++ b/matlab/resol.m @@ -106,6 +106,7 @@ if ~isreal(dr.ys) info(1) = 21; info(2) = sum(imag(ys).^2); dr.ys = real(dr.ys); + return end dr.fbias = zeros(M_.endo_nbr,1);