From a53e4db7ab34ec90c32030b526ad99ddf44c1772 Mon Sep 17 00:00:00 2001 From: adjemian Date: Fri, 21 Sep 2007 16:22:16 +0000 Subject: [PATCH] Correction of a bug in the estimation of smoothed variables (occasionaly systematic error in the level). git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1391 ac1d8469-bf42-47a9-8791-bf33cf982152 --- matlab/DsgeSmoother.m | 10 +++++++--- matlab/dynare_estimation.m | 19 +++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/matlab/DsgeSmoother.m b/matlab/DsgeSmoother.m index b2f5d1571..68b32fec6 100644 --- a/matlab/DsgeSmoother.m +++ b/matlab/DsgeSmoother.m @@ -39,10 +39,14 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R] = Dsge %------------------------------------------------------------------------------ [T,R,SteadyState] = dynare_resolve; bayestopt_.mf = bayestopt_.mf2; - if options_.loglinear == 1 - constant = log(SteadyState(bayestopt_.mfys)); + if options_.noconstant + constant = zeros(nobs,1); else - constant = SteadyState(bayestopt_.mfys); + if options_.loglinear == 1 + constant = log(SteadyState(bayestopt_.mfys)); + else + constant = SteadyState(bayestopt_.mfys); + end end trend_coeff = zeros(nobs,1); if bayestopt_.with_trend == 1 diff --git a/matlab/dynare_estimation.m b/matlab/dynare_estimation.m index c7b6fffad..aa320de31 100644 --- a/matlab/dynare_estimation.m +++ b/matlab/dynare_estimation.m @@ -1021,15 +1021,18 @@ if ~((any(bayestopt_.pshape > 0) & options_.mh_replic) | (any(bayestopt_.pshape %% %% Smooth observational errors... %% - yf = zeros(gend,n_varobs); - if options_.prefilter == 1 - yf = atT(bayestopt_.mf,:)+repmat(transpose(bayestopt_.mean_varobs),1,gend); - elseif options_.loglinear == 1 - yf = atT(bayestopt_.mf,:)+repmat(log(ys(bayestopt_.mfys)),1,gend)+... - trend_coeff*[1:gend]; + if options_.noconstant + yf = zeros(n_varobs,gend); else - yf = atT(bayestopt_.mf,:)+repmat(ys(bayestopt_.mfys),1,gend)+... - trend_coeff*[1:gend]; + if options_.prefilter == 1 + yf = atT(bayestopt_.mf,:)+repmat(transpose(bayestopt_.mean_varobs),1,gend); + elseif options_.loglinear == 1 + yf = atT(bayestopt_.mf,:)+repmat(log(ys(bayestopt_.mfys)),1,gend)+... + trend_coeff*[1:gend]; + else + yf = atT(bayestopt_.mf,:)+repmat(ys(bayestopt_.mfys),1,gend)+... + trend_coeff*[1:gend]; + end end if nvn number_of_plots_to_draw = 0;