MmgraphR: Graphing for Markov, Hidden Markov, and
Mixture Transition Distribution Models
SUMMARY OF MAIN FUNCTION
The work horse function of MmgraphR is 'trmatplot()'.
'trmatplot()' produces a coordinate plot which maps each element
in the probability transition matrix as a line, where each line
is weighted by probability.
Input is either an object of class ‘matrix’, ‘array’,
‘depmix.fitted’, or a ‘list’ of class ‘msm’, ‘hmm’ or ‘dthmm’.
Users can apply filters to emphasize the most (or
least) probable state sequences overall, or by initial state.
Various color palettes using the Hue-Chroma-Luminance color scheme
can be easily selected by the user.
Details below.
PROBABILITY TRANSITION MATRIX TO BE PLOTTED
The object ‘d’ to be plotted, is a probability matrix which, when
of class ‘matrix’ or ‘array’, can be user defined, or extracted
directly from the output of another package (see below).
Objects of class ‘depmix.fitted’, ‘dthmm’, ‘hmm’, ‘msm’
are also accepted as input.
Probability transition matrix is the output of packages
implemented using ‘S3’ methods and classes:
- Package ‘HMM’, function ‘initHMM()’ returns a ‘list’
containing the element ‘transProbs’ with the probability
transition matrix.
- Package ‘HiddenMarkov’, function ‘dthmm()’ returns a ‘list’
of class ‘dthmm’ with the element ‘Pi’ which is a probability
transition matrix.
- Package ‘seqHMM’, functions ‘build_mm()’ and ‘build_hmm()’ return
a ‘list’ of class ‘hmm’ containing the element ‘transition_probs’
with the estimated probability transition matrix.
- Package ‘msm’, function ‘msm()’ returns a ‘list’ of class ‘msm’.
Functions ‘pmatrix.msm()’ and ‘pmatrix.piecewise.msm()’ then
extract the probability transition matrix.
In the case of ‘S4’ classes:
- Package ‘depmixS4’, functions ‘depmix()’ followed by ‘fit()’
will return an object of class ‘depmix.fitted’. Display the
probability transtion matrix using ‘summary()’ on a
‘depmix.fitted’ object. Not all ‘depmix.fitted’ objects contain
a probability transition matrix.
KEY FEATURES OF 'trmatplot()'
- 'pfilter' argument can easily be applied to emphasize the most
(or least) probable state sequences overall, or by initial state.
- 'filter' argument can be used to highlight any specific
element(s) of the probability transition matrix.
- 'cspal' argument can be used to select various built-in
color palettes using the Hue-Chroma-Luminance color scheme.
- 'cpal' argument can be used to insert an external color palette.