stagedtrees Staged Event Trees

stagedtrees is an R package that implements staged event trees, a class of probabilistic graphical models for categorical random variables. Staged trees generalise discrete Bayesian networks: they can represent asymmetric, context-specific conditional independences, so that a dependence may hold for some groups of units and vanish for others.

With stagedtrees it is possible to learn (stratified) staged event trees from data with score-based and clustering algorithms, use them to compute probabilities, make predictions, visualize staged trees and chain event graphs, and compare different models. The package also implements simple and context-specific staged trees, staged tree classifiers and asymmetry-labeled DAGs.

The development version on GitHub, which will be released on CRAN as version 2.4.0, adds learning from incomplete data and tools for treatment effect estimation: potential outcomes, propensity-score stratification and checks of the positivity assumption.

The book

Staged Tree Models: With Applications in R, by Manuele Leonelli and Gherardo Varando, is forthcoming with CRC Press. See the book page for details.

Installation

# Stable version from CRAN
install.packages("stagedtrees")

# Development version from GitHub
remotes::install_github(
  "stagedtrees/stagedtrees"
)

A first example

library("stagedtrees")

tree <- Titanic |>
  full() |>
  stages_bhc() |>
  stndnaming(uniq = TRUE)

prob(tree, c(Survived = "Yes"),
     conditional_on = c(Age = "Adult"))
#> [1] 0.3107124

plot(tree, col = "stages")

Citation

To cite stagedtrees in publications use:

Carli F, Leonelli M, Riccomagno E, Varando G (2022). The R package stagedtrees for structural learning of stratified staged trees. Journal of Statistical Software, 102(6), 1-30. doi:10.18637/jss.v102.i06

The BibTeX entry is available on the publications page.

news

Book update: Staged Tree Models: With Applications in R

10 Oct 2026

The book Staged Tree Models: With Applications in R by Manuele Leonelli and Gherardo Varando is forthcoming with CRC Press. The code in the book requires stagedtrees 2.4.0 or later, which will be released on CRAN; until then the development version can be installed from GitHub.


PGM 2026 in València

11 Sep 2026

The 13th International Conference on Probabilistic Graphical Models (PGM 2026) took place in València on 9-11 September 2026, with Manuele Leonelli and Gherardo Varando as programme chairs.


Paper published in Bayesian Analysis

07 Jul 2026

Bayesian causal effect estimation for categorical data using staged tree models at url (preprint on arXiv)


Preprint: Estimating staged event tree models via hierarchical clustering on the simplex

16 Mar 2026

Estimating staged event tree models via hierarchical clustering on the simplex by Muhammad Shoaib, Eva Riccomagno, Manuele Leonelli and Gherardo Varando is available on arXiv.


Preprint: Staged event trees for transparent treatment effect estimation

30 Sep 2025

Staged event trees for transparent treatment effect estimation by Gherardo Varando, Manuele Leonelli, Jordi Cerdà-Bautista, Vasileios Sitokonstantinou and Gustau Camps-Valls is available on arXiv.