Viterbi algorithm for Hidden Markov Model with duration
1  duration_viterbi(aa_sample, pipar, tpmpar, od, params)

aa_sample 

pipar 
probabilities of initial state in Markov Model. 
tpmpar 
matrix of transition probabilities between states. 
od 
matrix of response probabilities. Eg. od[1,2] is a probability of signal 2 in state 1. 
params 
matrix of probability distribution for duration. Eg. params[10,2] is probability of duration of time 10 in state 2. 
A list of length four:
path a vector of most probable path
viterbi values of probability in all intermediate points,
psi matrix that gives for every signal and state the previous state in viterbi path,
duration matrix that gives for every signal and state gives the duration in that state on viterbi path.
All computations are on logarithms of probabilities.
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.