Hi Johannes,

On 16/06/16 09:40, Johannes Pfeifer wrote:

Hi Marco (or anyone who can answer the questions),

two quick questions:

 

1.       Is there a reason https://github.com/DynareTeam/dynare/pull/1088/commits/05fc096569e15e89d8d13b08799321c0313b168d was not ported to the diffuse filter?

In fact not, even if, in practice, I think there is no need for porting that:
if all observables are non-stationary, then kalman_filter_d is used and only Finf is inverted [so no need to balance well Fstar];
if some observable is stationary, then univariate_kalman_filter_d.m is used and then no matrix is inverted.

2.       What is the logic behind https://github.com/DynareTeam/dynare/pull/1088/commits/93e7be66e7b08bb0fd46be7863dd9834c3baafb5 where diffuse_kalman_tol is used for evaluating the singularity of Finf, but Kalman_tol for Fstar? Isn’t that pretty much the same check for singularity of the same matrix? diffuse_kalman_tol also governs the singularity Pinf which is the criterion to leave the diffuse filter.

The logic concerns scaling of matrices: Pinf and Finf are always scaled such that their norm=1. Fstar/Pstar, instead, depend on the actual values of std errors in the model and can be badly scaled.
My experience is that diffuse_kalman_tol has to be bigger than kalman_tol, to ensure exiting the diffuse filter properly, avoiding tests that provide false non-zero rank for Pinf. Also the test for singularity is better set coarser for Finf than for Fstar for the same reason. It's a bit difficult to make the diffuse filter numerically well behaved...

3. What is the reference for

if any(diag(F)<kalman_tol) || rcond(F./(sig*sig')) < kalman_tol
  if ~all(abs(F(:))<kalman_tol)

            return

        else

            a = T*a;

            P = T*P*transpose(T)+QQ;

        end

If F is singular we turn to the univariate filter if F is 0 everywhere. If F is not 0 everywhere, we continue with a Kalman gain of 0 and discard the observation from the likelihood. But the gain in this case should be more like K=P*Z'/F= P*Z'/0=Inf. Shouldn’t we generally turn to the univariate filter in this case instead of discarding the observation?

I think the logic here is the opposite: we shift to univariate if F is NOT zero everywhere [~all], so the behaviour should be exactly as you suggest.

 

best!
Marco
-- 
Marco Ratto,
Financial and Economic Analysis
Joint Research Centre
European Commission,
TP 361, 21027  ISPRA(VA), ITALY
Tel: +39 0332 78 3794 Fax: +39 0332 78 5752,
marco.ratto@jrc.ec.europa.eu
http://www.macfinrobods.eu/