Learn R Programming

LaMa (version 1.0.0)

viterbi: Viterbi algorithm for decoding states

Description

Viterbi algorithm for decoding states

Usage

viterbi(delta, Gamma, allprobs)

Value

Vector of decoded states of length n

Arguments

delta

Initial or stationary distribution of length N

Gamma

Transition probability matrix of dimension c(N,N)

allprobs

Matrix of state-dependent probabilities/ density values of dimension c(n, N)

Examples

Run this code
delta = c(0.5, 0.5)
Gamma = matrix(c(0.9, 0.1, 0.2, 0.8), nrow = 2, byrow = TRUE)
allprobs = matrix(runif(200), nrow = 100, ncol = 2)
states = viterbi(delta, Gamma, allprobs)

Run the code above in your browser using DataLab