I am trying to implement Eq(7) given below from Parameter estimation for Linear dynamical system

ll where Q is a 2 by 2 covariance matrix of the process noise. The model is x which is a 2 by T dimensional and observation vector is 1 by T dimensional for a state space model:

The state space model :

x(t+1) = Ax(t) + u(t)

y(t) = Cx(t) + v(t)

w(t) = N(0,Q)

v(t) = N(0,R)

The answer should be a scalar negative value. On breaking up the equation, till the first three terms I am getting a scalar negative value. But as soon as I include the fourth term (T-1)/2 log (abs(Q)) the value of the log-likelihood becomes a matrix with positive values in the diagonal and off-diagonal elements being infinity. Is my understanding of the notation incorrect? Is | .| not absolute but the determinant of Q? Same for V_1 and R? Thank you for help.

UPDATE: Based on the answer, For the second expression: - 0.5*T*log(det(R)) the answer is coming : -0.5*T*log(0.0100) which becomes positive. How do I mitigate this problem?


1 Answer 1


It is the determinant. The likelihoods in the first two expression look like multivariate normals. Look up


under properties, non-degenerate case they specify that $|\Sigma|$ is the determinant

  • $\begingroup$ Please see the update in my Question. I implemented the determinant which although gives a scalar for the likelihood, but it is a positive value instead of negative. Due to this answer which is a large positive number, the entire value of likelihood is becoming positive. Please help. $\endgroup$
    – SKM
    Mar 17, 2015 at 22:29
  • $\begingroup$ A likelihood has to be positive, because it is proportional to a probability. If you mean the log likelihood, its sign could be either positive or negative. $\endgroup$
    – whuber
    Mar 17, 2015 at 23:15
  • 1
    $\begingroup$ Adding to what @whuber mentions noting that (1) the covariance matrix is positive semi-definite and (2) the determinant of a matrix is the product of its eigenvalues the determinant is necessarily positive. $\endgroup$
    – Sid
    Mar 17, 2015 at 23:56
  • $\begingroup$ @Sid:I ran the Kalman filter toolbox by Kevin Murphy. The log-likelihood is negative and it starts from a highly negative number slowly converging to a smaller negative number. From that point of view, the value of the log-likelihood expression must be negative because my implementation does not converge. I wrote my own implementation since it is very difficult to understand the mechanism otherwise. Will it be possible to go through my code? There is no run time error but I cannot figure out what is the problem. I will upload my code if you have time to go through it, please. $\endgroup$
    – SKM
    Mar 18, 2015 at 0:55
  • $\begingroup$ The LOG likelihood can absolutely be negative. The likelihood cannot be negative. The Kalman filter is providing a reasonable probabilistic result. What makes you believe the Kalman filter is not converging? By the sound of things it is converging $\endgroup$
    – Sid
    Mar 18, 2015 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.