Looking at the code, I have a doubt concerning the choice that we made to return lik as a scalar and LIK as a vector, in the absence of analytical derivatives, and as cell arrays when we use analytical derivatives. I think it would be better if the Kalman filter functions returned additional arguments, set to empty when not using the derivatives. This would eliminate the code used to convert cell arrays to scalar/vector in dsge_likelihood.m
What do you think?
Best,
Michel