
viterbiEM(hmm, data, max.iter = c(5, 15), eps = 0.01, verbose = 0, ...)
hmm
. This is used as starting point for the optimisation procedure.list
of observation sequences.viterbiTraining
and baumWelch
(see Details).hmm
with optimised parameter estimates.
max.iter
and eps
can have either one or two elements. In the latter case
the first element is used for viterbiTraining
and the second one for baumWelch
.
Additional arguments can be passed to viterbiTraining
and baumWelch
by using arguments of the form
viterbi = list(a = a.value)
and baumWelch = list(b = b.value)
respectively. All other arguments are
passed on to both functions.
baumWelch
, viterbiTraining
, hmm.setup
## create two state HMM with t distributions
state.names <- c("one","two")
transition <- c(0.035, 0.01)
location <- c(1, 2)
scale <- c(1, 1)
df <- c(4, 6)
hmm1 <- getHMM(list(a=transition, mu=location, sigma=scale, nu=df),
state.names)
## generate observation sequences from model
obs.lst <- list()
for(i in 1:50) obs.lst[[i]] <- sampleSeq(hmm1, 100)
## fit an HMM to the data (with fixed degrees of freedom)
hmm2 <- hmm.setup(obs.lst, state=c("one","two"), df=5)
hmm2.fit <- viterbiEM(hmm2, obs.lst, max.iter=c(5,15), verbose=2, df=5)
Run the code above in your browser using DataLab