Possible bug in Dynare 4.3.3 when using diffuse KF

Dear Dynare Team,

I have a DSGE model with some non-stationary observables. I am using the diffuse_filter option in estimation (as well as the so-called obsolete observation_trends and unit_root_vars, because I get error messages about the steady state values from my *_steadystate.m file not satisfying the model equations without these arguments, see my earlier post viewtopic.php?f=1&t=2813&start=0). I would like to use the mode=1 for the joint posterior mode determination. Estimation typically begins OK, but after a few iterations of mode=1, I get this error message when Dynare crashes:

Attempted to access H(2); index out of bounds because numel(H)=1.

Error in univariate_kalman_filter (line 171)
Fi = z(i,:)*PZ + H(d_index(i));

Error in dsge_likelihood (line 677)
[LIK, lik] =
univariate_kalman_filter(DynareDataset.missing.aindex,DynareDataset.missing.number_of_observations,DynareDataset.missing.no_more_missing_observations,Y,diffuse_periods+1,size(Y,2),
.
Error in nlconst (line 744)
f = feval(funfcn{3},x,varargin{:});

Error in fmincon (line 837)
[X,FVAL,LAMBDA,EXITFLAG,OUTPUT,GRAD,HESSIAN]=…

Error in dynare_estimation_1 (line 227)
[xparam1,fval,exitflag,output,lamdba,grad,hessian_fmincon] = …

Error in dynare_estimation (line 70)
dynare_estimation_1(var_list,dname);

Error in tempv6_experiment (line 1332)
dynare_estimation(var_list_);

Error in dynare (line 120)
evalin(‘base’,fname) ;

Looking at the code, I see that the value of H=0 (and not a vector as the code would like: the error occurs when the code needs to use a value for H(2)). I see earlier in the code that the routine does make a H1 matrix for the diffuse case. Perhaps the solution can be found by using this matrix instead of H (in the diffuse case when kalman_algo==4 as is the case for my mod-file)?

Any help would be much appreciated!

Thank you.

Sincerely,
Rob Luginbuhl

ps I cannot include my mod file or steady state, because I am not sure that they can be made public.

This is a bug that will be soon fixed in the unstable version. For Dynare 4.3.3 a bug-fixed version of dsge_likelihood.m is attached. If you replace the original one with it, it should run.
dsge_likelihood.m (29 KB)

Thank you! The problem seems to be fixed.
Sincerely,
Rob Luginbuhl