DsgeLikelihood_hh.m lik calculation compatibility and consistency changes

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2825 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
george 2009-07-08 16:38:24 +00:00
parent f4c3482acd
commit c9d08951bf
6 changed files with 23 additions and 18 deletions

View File

@ -61,8 +61,7 @@ smpl = size(Y,2);
a = zeros(mm,1);
QQ = R*Q*transpose(R);
t = 0;
lik = zeros(smpl+1,1);
lik(smpl+1) = smpl*pp*log(2*pi); %% the constant of minus two times the log-likelihood
lik = zeros(smpl,1);
notsteady = 1;
crit = options_.kalman_tol;
crit1 = 1.e-6;
@ -190,5 +189,7 @@ while t < smpl
a = T*a;
end
LIK = .5*(sum(lik(start:end))-(start-1)*lik(smpl+1)/smpl);
% adding log-likelihhod constants
lik = (lik + pp*log(2*pi))/2;
LIK = sum(lik(start:end)); % Minus the log-likelihood.

View File

@ -60,8 +60,7 @@ smpl = size(Y,2);
a = zeros(mm,1);
QQ = R*Q*R';
t = 0;
lik = zeros(smpl+1,1);
lik(smpl+1) = smpl*pp*log(2*pi); %% the constant of minus two times the log-likelihood
lik = zeros(smpl,1);
notsteady = 1;
crit = options_.kalman_tol;
crit1 = 1.e-6;
@ -175,6 +174,7 @@ while t < smpl
end
a = T*a;
end
% adding log-likelihhod constants
lik = (lik + pp*log(2*pi))/2;
LIK = .5*(sum(lik(start:end))-(start-1)*lik(smpl+1)/smpl);
LIK = sum(lik(start:end)); % Minus the log-likelihood.

View File

@ -61,8 +61,7 @@ smpl = size(Y,2);
a = zeros(mm,1);
QQ = R*Q*transpose(R);
t = 0;
lik = zeros(smpl+1,1);
lik(smpl+1) = smpl*pp*log(2*pi); %% the constant of minus two times the log-likelihood
lik = zeros(smpl,1);
notsteady = 1;
crit = options_.kalman_tol;
crit1 = 1.e-6;
@ -173,5 +172,7 @@ while t < smpl
end
a = T*a;
end
LIK = .5*(sum(lik(start:end))-(start-1)*lik(smpl+1)/smpl);
% adding log-likelihhod constants
lik = (lik + pp*log(2*pi))/2;
LIK = sum(lik(start:end)); % Minus the log-likelihood.

View File

@ -61,8 +61,7 @@ smpl = size(Y,2);
a = zeros(mm,1);
QQ = R*Q*R';
t = 0;
lik = zeros(smpl+1,1);
lik(smpl+1) = smpl*pp*log(2*pi); %% the constant of minus two times the log-likelihood
lik = zeros(smpl,1);
notsteady = 1;
crit = options_.kalman_tol;
crit1 = 1.e-6;
@ -176,6 +175,8 @@ while t < smpl
end
a = T*a;
end
% adding log-likelihhod constants
lik = (lik + pp*log(2*pi))/2;
LIK = .5*(sum(lik(start:end))-(start-1)*lik(smpl+1)/smpl);
LIK = sum(lik(start:end)); % Minus the log-likelihood.

View File

@ -1,4 +1,4 @@
function LIK = DiffuseLikelihoodH3corr(T,R,Q,H,Pinf,Pstar,Y,trend,start)
function [LIK lik] = DiffuseLikelihoodH3corr(T,R,Q,H,Pinf,Pstar,Y,trend,start)
% Same as DiffuseLikelihoodH3 but allows correlation between the measurement
% errors (this is not a problem with the multivariate approach).
@ -36,8 +36,7 @@ Pstar = cat(1,cat(2,Pstar,zeros(mm,pp)),cat(2,zeros(pp,mm),H));
a = zeros(mm+pp,1);
QQ = R*Q*transpose(R);
t = 0;
lik = zeros(smpl+1,1);
lik(smpl+1) = smpl*pp*log(2*pi); %% the constant of minus two times the log-likelihood
lik = zeros(smpl,1);
notsteady = 1;
crit = options_.kalman_tol;
newRank = rank(Pinf,crit);
@ -110,4 +109,7 @@ while t < smpl
end
a = T*a;
end
LIK = .5*(sum(lik(start:end))-(start-1)*lik(smpl+1)/smpl);
% adding log-likelihhod constants
lik = (lik + pp*log(2*pi))/2;
LIK = sum(lik(start:end)); % Minus the log-likelihood.

View File

@ -317,5 +317,5 @@ function [fval,llik,cost_flag,ys,trend_coeff,info] = DsgeLikelihood_hh(xparam1,g
lnprior = priordens(xparam1,bayestopt_.pshape,bayestopt_.p6,bayestopt_.p7,bayestopt_.p3,bayestopt_.p4);
fval = (likelihood-lnprior);
options_.kalman_algo = kalman_algo;
llik=[-lnprior; .5*lik(start:end)];
llik=[-lnprior; lik(start:end)];