Function File: [sequence, states] = hmmgenerate (len, transprob, outprob)
Function File: hmmgenerate (..., 'symbols', symbols)
Function File: hmmgenerate (..., 'statenames', statenames)
Generate an output sequence and hidden states of a hidden Markov model. The model starts in state
1at step0but will not include step0in the generated states and sequence.Arguments
- len is the number of steps to generate. sequence and states will have len entries each.
- transprob is the matrix of transition probabilities of the states.
transprob(i, j)is the probability of a transition to statejgiven statei.- outprob is the matrix of output probabilities.
outprob(i, j)is the probability of generating outputjgiven statei.Return values
- sequence is a vector of length len of the generated outputs. The outputs are integers ranging from
1tocolumns (outprob).- states is a vector of length len of the generated hidden states. The states are integers ranging from
1tocolumns (transprob).If
'symbols'is specified, then the elements of symbols are used for the output sequence instead of integers ranging from1tocolumns (outprob). symbols can be a cell array.If
'statenames'is specified, then the elements of statenames are used for the states instead of integers ranging from1tocolumns (transprob). statenames can be a cell array.Examples
transprob = [0.8, 0.2; 0.4, 0.6]; outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1]; [sequence, states] = hmmgenerate (25, transprob, outprob) symbols = {'A', 'B', 'C'}; statenames = {'One', 'Two'}; [sequence, states] = hmmgenerate (25, transprob, outprob, 'symbols', symbols, 'statenames', statenames)References
- Wendy L. Martinez and Angel R. Martinez. Computational Statistics Handbook with MATLAB. Appendix E, pages 547-557, Chapman & Hall/CRC, 2001.
- Lawrence R. Rabiner. A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition. Proceedings of the IEEE, 77(2), pages 257-286, February 1989.
Package: statistics