The 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))
ans$logLik
Are both approaches right?
If yes, then why I am getting different likelihood values using different packages, and which one should be preferred?