viterbi_p {LaMa} | R Documentation |
Viterbi algorithm for decoding states of periodically inhomogeneous HMMs
Description
Viterbi algorithm for decoding states of periodically inhomogeneous HMMs
Usage
viterbi_p(delta, Gamma, allprobs, tod)
Arguments
delta |
Initial or periodically statioanary distribution of length N |
Gamma |
Array of transition probability matrices of dimension c(N,N,L), where L is the cycle length. |
allprobs |
Matrix of state-dependent probabilities/ density values of dimension c(n, N) |
tod |
Integer valued cyclic variable to index the transition probability matrix. |
Value
Vector of decoded states of length n
Examples
delta = c(0.5, 0.5)
beta = matrix(c(-2, 1, -1,
-2, -1, 1), nrow = 2, byrow = TRUE)
Gamma = tpm_p(1:24, 24, beta)
tod = rep(1:24, 10)
n = length(tod)
allprobs = matrix(runif(2*n), nrow = n, ncol = 2)
states = viterbi_p(delta, Gamma, allprobs, tod)
[Package LaMa version 1.0.0 Index]