Description Details Author(s) References See Also Examples

MmgraphR produces parallel coordinate plots which map each element in a probability transition matrix (of any order) as a line. Each line is weighted by probability, and so the thicker the line, the more probable a sequence of states is and vice-versa. Probability transition matrices reflecting higher order dependencies, often useful in life-course studies, can also be mapped.

Additional functionalities of MmgraphR include probability filters that can easily be applied to emphasize the most (or least) probable state sequences overall, or by initial state. Any specific element(s) of the probability transition matrix can also be highlighted. To render the plot more attractive, various color palettes using the Hue-Chroma-Luminance color scheme have been built-in and can be easily selected by the user.

The package is available through CRAN as well as R-forge, where it is developed. Although MmgraphR can be used on its own, it is also compatible with the output of R packages `msm`

, `HiddenMarkov`

, `HMM`

, `depmixS4`

, `seqHMM`

, as well as `march`

.

Package: | MmgraphR |

Version: | 0.3-1 |

Date: | 2018-08-23 |

Depends: | R (>= 3.1.1), TraMineR, colorspace |

Imports: | march, msm |

License: | GPL (>= 2) |

LazyData: | true |

URL: | https://cran.r-project.org/package=MmgraphR |

URL: | https://r-forge.r-project.org/scm/viewvc.php/pkg/MmgraphR/?root=traminer |

Encoding: | latin1 |

Pauline Adamopoulou [aut, cre, cph], Andre Berchtold [ths], Gilbert Ritschard [ths], Reto Buergin [cbt], Ogier Maitre [cbt], Maintainer: Pauline Adamopoulou <padamopo@gmail.com>

Buergin, R. and G. Ritschard (2014), "A decorated parallel coordinate plot for categorical longitudinal data", *The American Statistician*. Vol. 68(2), pp. 98-103.

Zeileis, A.; Hornik, K. and P. Murrell (2009), "Escaping RGBland: Selecting Colors for Statistical Graphics", *Computational Statistics & Data Analysis*. Vol. 53, pp. 3259-3270.

`trmatplot`

,
`trmatplot.default`

,
`trmatplot.array`

,
`trmatplot.depmix.fitted`

,
`trmatplot.dthmm`

,
`trmatplot.hmm`

,
`trmatplot.msm`

,
`march.Dcmm.trmatplot`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | ```
## Plotting a probability transition matrix
###########################################
trMat<-matrix(c(0.1, 0.05, 0.05, 0.80,
0.06, 0.02, 0.03, 0.89,
0.03, 0.01, 0.01, 0.95,
0, 0, 0, 1), nrow = 4, ncol = 4, byrow = TRUE)
trmatplot(trMat)
#--- Setting a seed so that the graphic can be replicated
trmatplot(trMat, seed = 2)
#--- Defining a second order probability transition matrix as an array
trMatArray <- array(c(
0.30, 0.70,
0.65, 0.35,
0.05, 0.95,
0.99, 0.01), dim = c( 1, 2, 4))
#--- Plotting with user-defined colors
trmatplot(trMatArray, seed = 3, morder = 2, cpal = c("grey40", "grey70"))
# cspal: ready-to-use color palettes using colorspace
#####################################################
#--- Color palette "dynamic"
trmatplot(trMat, seed = 2, cspal = "dynamic")
#--- Color palette "harmonic"
trmatplot(trMat, seed = 2, cspal = "harmonic")
## pfilter: Filtering out most (or least) probable sequences
############################################################
#--- The most probable sequence given a state
trmatplot(trMat, seed = 2, pfilter = "smax")
#--- The ten least probable sequences
trmatplot(trMat, seed = 2, pfilter = "tmin", num = 10 )
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.