Thank you very much George. I will take a look at it. I think that the correction should be more direct than the min() construct
Best
Michel
G. Perendia wrote:
Dear Michel
I think I found an error in Dynare Matlab kalman_filter. suite of utilities which affects the likelihood LIK results with start>1 (i.e. presampling>0):
the calculation speed-up construct which relies on converged covariance matrix
lik(t) = lik(t) + reste*log(dF);
adds reste * log(dF) to the last-1 (i.e. the smpl) member of lik (the last, the lik(smpl+1) one contains smpl*pp*log(2*pi)) but reste is usually larger than T-start+1 so that
LIK = .5*(sum(lik(start:end))-(start-1)*lik(smpl+1)/smpl)
has much more log(dF)s added than required since they are all concentrated in the last-1 (the T) member
For example, if I change the above construct to lik(t) = lik(t) + min(reste,(smpl-start+1))*log(dF);
the reported likelihood for presample=40 from Matlab KF is 1640935.5855267849 which is nearly the same as that from C++ KF below: 1640935.5854489324
Shall I make changes to kalman/likelihood/ KFs and upload the .m files? This problem affects also the older versions of DiffuseLikelihood**.m too.
Best regards
George artilogica@btconnect.com
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "G. Perendia" george@perendia.orangehome.co.uk Sent: Tuesday, May 26, 2009 10:32 AM Subject: Re: Kalman Filter+PS
Hi George,
Re 1) below: I modified C++ KF so that it reports log-likelihood for given start/preampling in same/similar manner as the Matlab KFs do and I am getting approximately close results, e.g.
ll= -1640935.5854489324 for C++ and (-) 1640482.4179242959 for Matlab KF (for start=41, i.e.
presample=40).
whilst they appear same for presample=0 (e.g.2.5906e+006), i.e. -2590556.989730841 vs 2590556.989778722
Are those results acceptably close or should I investigate further where
the
above difference may come form?
This indicates a problem . The difference should be the same with and without presample. It may come from the computation of the likelihood constant. This is done in a very obscure manner in Dynare Matlab.