Merge pull request #1428 from JohannesPfeifer/patch-1
Test the rank of Pinf in univariate smoother for the subset of observablestime-shift
commit
f18c16653e
|
@ -255,8 +255,10 @@ if kalman_algo == 2 || kalman_algo == 4
|
|||
[Pstar,Pinf] = compute_Pinf_Pstar(mf,ST,R1,Q,options_.qz_criterium);
|
||||
else
|
||||
Pstar = blkdiag(Pstar,H);
|
||||
if ~isempty(Pinf)
|
||||
Pinf = blkdiag(Pinf,zeros(vobs));
|
||||
end
|
||||
end
|
||||
%now reset H to 0
|
||||
H = zeros(vobs,vobs);
|
||||
else
|
||||
|
|
|
@ -122,7 +122,11 @@ end
|
|||
|
||||
t = 0;
|
||||
icc=0;
|
||||
if ~isempty(Pinf(:,:,1))
|
||||
newRank = rank(Z*Pinf(:,:,1)*Z',diffuse_kalman_tol);
|
||||
else
|
||||
newRank = rank(Pinf(:,:,1),diffuse_kalman_tol);
|
||||
end
|
||||
while newRank && t < smpl
|
||||
t = t+1;
|
||||
a(:,t) = a1(:,t);
|
||||
|
@ -156,7 +160,11 @@ while newRank && t < smpl
|
|||
end
|
||||
end
|
||||
if newRank
|
||||
if ~isempty(Pinf(:,:,t))
|
||||
oldRank = rank(Z*Pinf(:,:,t)*Z',diffuse_kalman_tol);
|
||||
else
|
||||
oldRank = rank(Pinf(:,:,t),diffuse_kalman_tol);
|
||||
end
|
||||
else
|
||||
oldRank = 0;
|
||||
end
|
||||
|
@ -168,8 +176,12 @@ while newRank && t < smpl
|
|||
Pstar(:,:,t+1) = T*Pstar(:,:,t)*T'+ QQ;
|
||||
Pinf(:,:,t+1) = T*Pinf(:,:,t)*T';
|
||||
if newRank
|
||||
if ~isempty(Pinf(:,:,t+1))
|
||||
newRank = rank(Z*Pinf(:,:,t+1)*Z',diffuse_kalman_tol);
|
||||
else
|
||||
newRank = rank(Pinf(:,:,t+1),diffuse_kalman_tol);
|
||||
end
|
||||
end
|
||||
if oldRank ~= newRank
|
||||
disp('univariate_diffuse_kalman_filter:: T does influence the rank of Pinf!')
|
||||
end
|
||||
|
@ -367,3 +379,9 @@ if decomp_flag
|
|||
end
|
||||
|
||||
epsilonhat = Y - Z*alphahat;
|
||||
|
||||
|
||||
if (d==smpl)
|
||||
warning(['missing_DiffuseKalmanSmootherH3_Z:: There isn''t enough information to estimate the initial conditions of the nonstationary variables']);
|
||||
return
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue