state space model , I am trying to implement is as follows $$ y_t= CY + FF* X_t + Ve_t$$ $$(X_t-m0)= GG (X_{t-1}-m0) +W\eta_t$$

In DLM I am using following modification(because DLM does not allow intercept in measurement and transition equation)

mod= build(param) #creates DLM objects with some additional objects
adj= mod$FF%*%mod$m0+ mod$CY
data= t(apply(data_full,1,function(x) x-adj)) # adjust Y variable for the intercept term
mod$m0=0 # now latent factor will have zero mean
dlmLL(data,mod )

Now I am trying to implement the same using fkf package

mod= build(param)
mod$CX= (I-mod$GG)%*%mod$m0
ans <- fkf(a0 = mod$m0, P0 = mod$C0, dt = mod$CX, ct = mod$CY, Tt = mod$GG,
         Zt = mod$FF, HHt = mod$W, GGt = mod$V, yt = t(data_full))

are both the approaches right? If yes, then Why I am getting different likelihood values using different packages, and which one should be preferred


Your Answer

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

Browse other questions tagged or ask your own question.