Bug in kalman_filter.m
Posted: Thu Jun 03, 2010 7:40 am
Hi,
there is obviously a bug in the file kalman_filter.m used in Dynare. The respective part is
If
and
Dynare only sets the variables a and P. However, after the if-clause, K is used in
there is obviously a bug in the file kalman_filter.m used in Dynare. The respective part is
- Code: Select all
while notsteady & t<smpl
t = t+1;
v = Y(:,t)-a(mf);
F = P(mf,mf) + H;
if rcond(F) < kalman_tol
if ~all(abs(F(:))<kalman_tol)
return
else
a = T*a;
P = T*P*transpose(T)+QQ;
end
else
F_singular = 0;
dF = det(F);
iF = inv(F);
lik(t) = log(dF)+transpose(v)*iF*v;
K = P(:,mf)*iF;
a = T*(a+K*v);
P = T*(P-K*P(mf,:))*transpose(T)+QQ;
end
notsteady = max(max(abs(K-oldK))) > riccati_tol;
oldK = K;
end
If
- Code: Select all
rcond(F) < kalman_tol
and
- Code: Select all
~all(abs(F(:))<kalman_tol)
Dynare only sets the variables a and P. However, after the if-clause, K is used in
- Code: Select all
max(max(abs(K-oldK)))