fixing bug for estimation of models with measurement errors and
missing observationstime-shift
parent
540fb1be48
commit
2fa433f18e
|
@ -67,6 +67,10 @@ if isempty(diffuse_periods)
|
||||||
diffuse_periods = 0;
|
diffuse_periods = 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if isequal(H,0)
|
||||||
|
H = zeros(pp,pp);
|
||||||
|
end
|
||||||
|
|
||||||
% Get sample size.
|
% Get sample size.
|
||||||
smpl = last-start+1;
|
smpl = last-start+1;
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,10 @@ dlik = zeros(smpl,1); % Initialization of the vector gathering the densitie
|
||||||
dLIK = Inf; % Default value of the log likelihood.
|
dLIK = Inf; % Default value of the log likelihood.
|
||||||
oldK = Inf;
|
oldK = Inf;
|
||||||
|
|
||||||
|
if isequal(H,0)
|
||||||
|
H = zeros(pp,pp);
|
||||||
|
end
|
||||||
|
|
||||||
while rank(Pinf,kalman_tol) && (t<=last)
|
while rank(Pinf,kalman_tol) && (t<=last)
|
||||||
s = t-start+1;
|
s = t-start+1;
|
||||||
d_index = data_index{t};
|
d_index = data_index{t};
|
||||||
|
@ -107,7 +111,7 @@ while rank(Pinf,kalman_tol) && (t<=last)
|
||||||
dlik(s) = log(det(Finf));
|
dlik(s) = log(det(Finf));
|
||||||
iFinf = inv(Finf);
|
iFinf = inv(Finf);
|
||||||
Kinf = Pinf*ZZ'*iFinf;
|
Kinf = Pinf*ZZ'*iFinf;
|
||||||
Fstar = ZZ*Pstar*ZZ' + H;
|
Fstar = ZZ*Pstar*ZZ' + H(d_index,d_index);
|
||||||
Kstar = (Pstar*ZZ'-Kinf*Fstar)*iFinf;
|
Kstar = (Pstar*ZZ'-Kinf*Fstar)*iFinf;
|
||||||
Pstar = T*(Pstar-Pstar*ZZ'*Kinf'-Pinf*ZZ'*Kstar')*T'+QQ;
|
Pstar = T*(Pstar-Pstar*ZZ'*Kinf'-Pinf*ZZ'*Kstar')*T'+QQ;
|
||||||
Pinf = T*(Pinf-Pinf*ZZ'*Kinf')*T';
|
Pinf = T*(Pinf-Pinf*ZZ'*Kinf')*T';
|
||||||
|
|
Loading…
Reference in New Issue