bacontrees: Bayesian Context Trees for Discrete Sequence Data

Models discrete sequential data using Bayesian Context Trees. Context trees, also known as Variable Length Markov Chains (VLMCs), are parsimonious Markov models where the order of dependence can vary with the observed past. Provides a generic 'R6' class structure that exposes the full tree for building custom algorithms, exact Bayesian inference via a bottom-up recursive algorithm (closed-form marginal likelihood, Maximum A Posteriori (MAP) tree, exact posterior probabilities, and exact sampling from the posterior), a frequentist estimator via the context algorithm with likelihood-ratio pruning, simulation utilities, and a Metropolis-Hastings sampler. See Paulichen and Freguglia (2026) <doi:10.48550/arXiv.2603.25806>.

Version: 1.0.0
Depends: R (≥ 4.1.0)
Imports: R6, stringr, glue, purrr, dplyr, progressr, Rcpp, igraph, ggraph, ggplot2, Brobdingnag
LinkingTo: Rcpp
Suggests: testthat (≥ 3.0.0)
Published: 2026-05-12
DOI: 10.32614/CRAN.package.bacontrees (may not be active yet)
Author: Victor Freguglia ORCID iD [aut, cre], Thiago Paulichen ORCID iD [ctb]
Maintainer: Victor Freguglia <victorfreguglia at gmail.com>
License: GPL (≥ 3)
NeedsCompilation: yes
Materials: README, NEWS
CRAN checks: bacontrees results

Documentation:

Reference manual: bacontrees.html , bacontrees.pdf

Downloads:

Package source: bacontrees_1.0.0.tar.gz
Windows binaries: r-devel: not available, r-release: not available, r-oldrel: not available
macOS binaries: r-release (arm64): bacontrees_1.0.0.tgz, r-oldrel (arm64): bacontrees_1.0.0.tgz, r-release (x86_64): bacontrees_1.0.0.tgz, r-oldrel (x86_64): bacontrees_1.0.0.tgz

Linking:

Please use the canonical form https://CRAN.R-project.org/package=bacontrees to link to this page.