Skip to content

mHMMbayes

1.1.1Package record

Multilevel Hidden Markov Models Using Bayesian Estimation

0packages depend
3.1Kdownloads / year
70.5%test coverage
13/13flavors OK

Overview

About

An implementation of the multilevel (also known as mixed or random effects) hidden Markov model using Bayesian estimation in R. The multilevel hidden Markov model (HMM) is a generalization of the well-known hidden Markov model, for the latter see Rabiner (1989) doi:10.1109/5.18626. The multilevel HMM is tailored to accommodate (intense) longitudinal data of multiple individuals simultaneously, see e.g., de Haan-Rietdijk et al. doi:10.1080/00273171.2017.1370364. Using a multilevel framework, we allow for heterogeneity in the model parameters (transition probability matrix and conditional distribution), while estimating one overall HMM. The model can be fitted on multivariate data with either a categorical, normal, or Poisson distribution, and include individual level covariates (allowing for e.g., group comparisons on model parameters). Parameters are estimated using Bayesian estimation utilizing the forward-backward recursion within a hybrid Metropolis within Gibbs sampler. Missing data (NA) in the dependent variables is accommodated assuming MAR. The package also includes various visualization options, a function to simulate data, and a function to obtain the most likely hidden state sequence for each individual using the Viterbi algorithm.

Changes in 1.1.1

Accomodating the possibility of fitting a 1-state mHMM

This version includes the possibility of running (and simulating data from) a 1-state multilevel hidden Markov model. This is mainly convenient for benchmarking purposes for model selection (e.g., how much does the AIC / AICc decrease from a 1-state to a 2-state model). To accommodate this change the following main functions are updated: mHMM() and sim_mHMM(). The following S3 methods were updated: print(), summary(), and plot(). In addition, the following post processing functions were updated: obtain_emiss(), obtain_gamma(), and vit_mHMM().

Other minor changes:

The estimation vignette is changed from a pdf output file to a html output file due to recurrent issues with GHA workflow and rendering pdf vignettes.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 4.6 min · r-devel-windows-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK14 OK2026-04-22
  • ERROR13 OK, 1 ERROR2026-04-18
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 1.1.1
READMEYes · 312 wordsVignettesYes · 2 · dynamicNEWSYes · 100% structured · mentions 1.1.1Citation fileNo
Help pages
20 (1 internal)includes a package overview page
Examples that run
71%12 run in a plain check · 5 only when donttest examples are enabled (R CMD check --as-cran)
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
25% with a bibliography file

Downloads

3.1K
CRAN downloads in the past year
Rank #11,536 · ~9/day · ~261/mo
Daily download trend is not available in this view yet.
33930 days
94090 days
3.1K1 year
Compare downloads with other packages →
Also on346 r2u6 autocran

Repository

26Stars
12Forks
6Open issues
3Open PRs
4Releases
489Commits
3Commit identities
489 commits · Last activity 2026-04-17 · 0% stars, 30d
Responsiveness
How these are sampled
PRs merged (all time)
55%
Median days to close, 50 most recently updated closed issues
324
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2025-07-30 · 212026-07-07 · 26
PracticesBeta

9 development-tooling and community-health practices detected across 5 families in the upstream repository

Checks run against github.com/emmekeaarts/mhmmbayes on 2026-10-22.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (2)
README.Rmd

GitHub Pages site last deployed 2026-04-17

Reproducibility and dev environment (1)
data-raw/
CRAN release process (3)
cran-comments.mdrevdep/CRAN-SUBMISSION
Show all practicesHide 1 practice
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v4 (2026-10-20)
AI coding toolsBeta

An outside contributor's pull request to this repository was written with an AI coding tool.

From outside contributors
  • Claude Code
    Pull requests: 1 from outside contributors, first on 2025-09-27, 1 from forks
How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
10 external dependencies (excludes base and recommended)

Installing mHMMbayes adds 10 packages (7 with compiled code, 8.0 MB of source tarballs). Heaviest: Rcpp 1.8 MB, mcmc 1.5 MB, rbibutils 1.1 MB.

Depends (1)
R >= 3.6.0
LinkingTo (1)
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (2)
Author, Maintainer since 0.1.0 (2019)
Author · added in 0.2.0
Releases (6)

Pick two releases to compare their code metrics.

  • R
    R 4.6.0 released · 2026-04-24
  • 1.1.1Latest
    record
    2025-07-11 · current release · diff ↗
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • 1.1.0
    record
    2024-04-01 · diff ↗ ·
    added 3 exports
    pd_RW_emiss_count, prior_emiss_count, var_to_logvar
  • 1.0.0
    record
    2023-10-02 · diff ↗ ·
    added 1 export
    prior_emiss_cont
  • R
    R 4.3.0 released · 2023-04-21
  • 0.2.0
    record
    2022-08-17 · diff ↗ ·
    added 6 exports
    int_to_prob, pd_RW_emiss_cat, pd_RW_gamma, prior_emiss_cat, prior_gamma, prob_to_int
  • R
    R 4.2.0 released · 2022-04-22
  • R
    R 4.1.0 released · 2021-05-18
  • R
    R 4.0.0 released · 2020-04-24
  • 0.1.1
    record
    2019-10-30 · diff ↗
  • 0.1.0
    record
    2019-10-25
  • R
    R 3.6.0 released · 2019-04-26

Package metadata

First published
2019-10-25
Total releases
6 / 7 yrs
License
GPL-3 OSI
Minimum R
≥ 3.6.0
Bundled data
4.0 KB / 2 files
Download size
2.5 MB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("mHMMbayes")
Aarts, E., & Mildiner Moraga, S. (2025). mHMMbayes: Multilevel Hidden Markov Models Using Bayesian Estimation (Version 1.1.1) [Computer software]. https://doi.org/10.32614/CRAN.package.mHMMbayes

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for mHMMbayes version 1.1.1 [Data set]. HJJB, LLC. Data release v2026-10-25. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy