delta = c(0.5, 0.5)
Gamma = array(dim = c(2,2,99))
for(t in 1:99){
gammas = rbeta(2, shape1 = 0.4, shape2 = 1)
Gamma[,,t] = matrix(c(1-gammas[1], gammas[1],
gammas[2], 1-gammas[2]), nrow = 2, byrow = TRUE)
}
allprobs = matrix(runif(200), nrow = 100, ncol = 2)
states = viterbi_g(delta, Gamma, allprobs)
Run the code above in your browser using DataLab