Skip to content
Snippets Groups Projects
Commit aa9f52e2 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Merge branch 'fixes' into 'master'

big fix in diffuse filter initialization:

See merge request Dynare/dynare!2104
parents 3184db12 178e892e
Branches
No related tags found
No related merge requests found
...@@ -189,6 +189,7 @@ elseif options_.lik_init == 2 % Old Diffuse Kalman filter ...@@ -189,6 +189,7 @@ elseif options_.lik_init == 2 % Old Diffuse Kalman filter
Pstar = options_.Harvey_scale_factor*eye(np); Pstar = options_.Harvey_scale_factor*eye(np);
Pinf = []; Pinf = [];
elseif options_.lik_init == 3 % Diffuse Kalman filter elseif options_.lik_init == 3 % Diffuse Kalman filter
my_mf = mf;
if kalman_algo ~= 4 if kalman_algo ~= 4
kalman_algo = 3; kalman_algo = 3;
else else
...@@ -201,9 +202,10 @@ elseif options_.lik_init == 3 % Diffuse Kalman filter ...@@ -201,9 +202,10 @@ elseif options_.lik_init == 3 % Diffuse Kalman filter
R = blkdiag(R,eye(vobs)); R = blkdiag(R,eye(vobs));
H = zeros(vobs,vobs); H = zeros(vobs,vobs);
Z = [Z, eye(vobs)]; Z = [Z, eye(vobs)];
my_mf = find(any(Z))';
end end
end end
[Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,options_.qz_criterium); [Pstar,Pinf] = compute_Pinf_Pstar(my_mf,T,R,Q,options_.qz_criterium);
elseif options_.lik_init == 4 % Start from the solution of the Riccati equation. elseif options_.lik_init == 4 % Start from the solution of the Riccati equation.
Pstar = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,vobs)),H); Pstar = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,vobs)),H);
Pinf = []; Pinf = [];
......
...@@ -169,6 +169,7 @@ if np0 ...@@ -169,6 +169,7 @@ if np0
QTinf(1:np0,np0+1:np0+nk) = STinf0; QTinf(1:np0,np0+1:np0+nk) = STinf0;
QTinf([indx0(:); indx(:)],:) = QTinf; QTinf([indx0(:); indx(:)],:) = QTinf;
STinf1 = [zeros(np0+np,np0) [STinf0; eye(nk); zeros(np-nk,nk)] zeros(np0+np,np-nk)]; STinf1 = [zeros(np0+np,np0) [STinf0; eye(nk); zeros(np-nk,nk)] zeros(np0+np,np-nk)];
mf = ismember([indx0(:); indx(:)],mf);
for k = 1:nk for k = 1:nk
if norm(QTinf(mf,:)*ST([indx0(:); indx(:)],k+np0)) < 1e-8 if norm(QTinf(mf,:)*ST([indx0(:); indx(:)],k+np0)) < 1e-8
Pinf(k+np0,k+np0) = 0; Pinf(k+np0,k+np0) = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment