Mixture Hidden Markov Models for Social Sequence Data and Other Multivariate, Multichannel Categorical Time Series

Designed for estimating variants of hidden (latent) Markov models (HMMs), mixture HMMs, and non-homogeneous HMMs (NHMMs) for social sequence data and other categorical time series. Special cases include feedback-augmented NHMMs, Markov models without latent layer, mixture Markov models, and latent class models. The package supports models for one or multiple subjects with one or multiple parallel sequences (channels). External covariates can be added to explain cluster membership in mixture models as well as initial, transition and emission probabilities in NHMMs. The package provides functions for evaluating and comparing models, as well as functions for visualizing of multichannel sequence data and HMMs. For NHMMs, methods for computing average causal effects and marginal state and emission probabilities are available. Models are estimated using maximum likelihood via the EM algorithm or direct numerical maximization with analytical gradients. Documentation is available via several vignettes, and Helske and Helske (2019, ). For methodology behind the NHMMs, see Helske (2025, ).


R-CMD-check Codecov test coverage cran version downloads

seqHMM: Hidden Markov Models for Life Sequences and Other Multivariate, Multichannel Categorical Time Series

The seqHMM package is designed for fitting hidden (latent) Markov models (HMMs) and their variations for social sequence data and other categorical sequence data (e.g. categorical time series and panel data). Restricted and extended variants include mixture HMMs, Markov models and their mixtures, latent class models, non-homogeneous hidden Markov models (NHMMs) and their mixtures, and feedback-augmented hidden Markov models (FAN-HMMs).

The package supports models for one or multiple subjects with one or multiple parallel outcome sequences (channels). External covariates can be added to explain cluster membership in mixture models, and NHMMs and their variants support covariates in initial, transition and emission matrices as well.

Maximum likelihood estimation via EM algorithm and direct numerical maximization with analytical gradients is supported. All main algorithms are written in C++. Parallel computation is available via OpenMP (pre-2.0.0 version models) and future (via parallel multistart estimation with random initial values).

When using the package in publications, please cite:

Helske, Satu and Helske, Jouni (2019). Mixture hidden Markov models for sequence data: the seqHMM package in R. Journal of Statistical Software, 88(3). doi:10.18637/jss.v088.i03.

Helske, Jouni (2025). Feedback-augmented Non-homogeneous Hidden Markov Models for Longitudinal Causal Inference. arXiv preprint. doi:10.48550/arXiv.2503.16014.

If you find bugs, please add a new issue here in GitHub. You can also contact Satu Helske ([email protected]) or Jouni Helske ([email protected]). We would be happy to hear your feedback.

The package is available on CRAN. Install it via

install.packages("seqHMM")

If you want to try the development version of the seqHMM package, install it from the R-universe:

install.packages("seqHMM", repos = "https://helske.r-universe.dev")

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("seqHMM")

2.2.0 by Jouni Helske, 7 months ago


Report a bug at https://github.com/helske/seqHMM/issues


Browse source code at https://github.com/cran/seqHMM


Authors: Jouni Helske [aut, cre] (ORCID: , Satu Helske [aut]


Documentation:   PDF Manual  


GPL (>= 2) license


Imports checkmate, cli, collapse, data.table, future.apply, ggplot2, ggseqplot, graphics, grDevices, grid, gridBase, igraph, lhs, Matrix, methods, nloptr, numDeriv, patchwork, progressr, Rcpp, RcppHungarian, rlang, stats, TraMineR, utils

Suggests covr, knitr, MASS, nnet, testthat

Linking to nloptr, Rcpp, RcppArmadillo

System requirements: GNU make


Imported by DBHC.

Suggested by clickb, eyeprocess, gp3sequences, tna.


See at CRAN