JuliaStats / TimeModels.jl

Modeling time series in Julia
Other
57 stars 28 forks source link

Kalman likelihood #34

Closed mschauer closed 9 years ago

mschauer commented 9 years ago

Can we check the likelihood of the Kalman filter? Kalman.jl has

    ll = log(1) - 0.5log(2pi*det(S)) + 0.5log(det(S)) - 0.5*innov' * S * innov

but S is a covariance matrix, not a precision matrix, I think it should be

    ll = - (dot(innov,S\innov) + logdet(S) + size(S,1)*log(2pi))/2

or

    L = chol(S, :L)
    ll =  - (norm(L\innov)^2 + 2sum(log(diag(L))) + size(S,1)*log(2pi))/2
milktrader commented 9 years ago

ping @scidom

mschauer commented 9 years ago

PS: I checked the rest of the Kalman filter, it is ok. I open a seperate issue for the Rauch-Tung-Striebel smoother.