If I have fit a model mf
with depmix()
and fit()
using depmixS4
package, and I want to know the log-likelihood of generating a given sequence s
, how should I do?
I know in the HiddenMarkov
package I can use forwardback(s, mf$Pi, mf$...)$LL
to get the log-likelihood, but I find the forwardbackward()
function in depmixS4
does not work similarly.
Finally I found the way myself, as first time working with S4...
Firstly initialize a model (depmix obj) with depmix()
, and then update it with parameters in the fitted mf
using setpars()
. After that the forwardbackward()
will work
init_mod <- depmix(respones, data, nstates) ## no solid value
mod <- setpars(init_mod, getpars(fm))
forwardbackward(mod)
Anyone knows better solution plz tell me...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.