diff --git a/matlab/DsgeLikelihood.m b/matlab/DsgeLikelihood.m index a58941a5b..a34d264ae 100644 --- a/matlab/DsgeLikelihood.m +++ b/matlab/DsgeLikelihood.m @@ -115,8 +115,11 @@ function [fval,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend,data end if bayestopt_.with_trend == 1 trend_coeff = zeros(nobs,1); + t = options_.trend_coeffs; for i=1:nobs - trend_coeff(i) = evalin('base',bayestopt_.trend_coeff{i}); + if ~isempty(t{i}) + trend_coeff(i) = evalin('base',t{i}); + end end trend = repmat(constant,1,gend)+trend_coeff*[1:gend]; else diff --git a/matlab/DsgeLikelihood_hh.m b/matlab/DsgeLikelihood_hh.m index e02634731..bc7f8c795 100644 --- a/matlab/DsgeLikelihood_hh.m +++ b/matlab/DsgeLikelihood_hh.m @@ -121,8 +121,11 @@ function [fval,llik,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend end if bayestopt_.with_trend == 1 trend_coeff = zeros(nobs,1); + t = options_.trend_coeffs; for i=1:nobs - trend_coeff(i) = evalin('base',bayestopt_.trend_coeff{i}); + if ~isempty(t{i}) + trend_coeff(i) = evalin('base',t{i}); + end end trend = repmat(constant,1,gend)+trend_coeff*[1:gend]; else diff --git a/matlab/DsgeSmoother.m b/matlab/DsgeSmoother.m index 68b32fec6..c765fac90 100644 --- a/matlab/DsgeSmoother.m +++ b/matlab/DsgeSmoother.m @@ -51,9 +51,11 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R] = Dsge trend_coeff = zeros(nobs,1); if bayestopt_.with_trend == 1 trend_coeff = zeros(nobs,1); - nx1 = estim_params_.nvx+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn; + t = options_.trend_coeffs; for i=1:nobs - trend_coeff(i) = evalin('base',bayestopt_.trend_coeff{i}); + if ~isempty(t{i}) + trend_coeff(i) = evalin('base',t{i}); + end end trend = constant*ones(1,gend)+trend_coeff*(1:gend); else