STbayes is an R package for building, fitting and interpreting Bayesian network-based diffusion analyses (NBDA). NBDA models are generally used to identify i) whether social transmission is occurring, ii) correlates of asocial learning and social transmission, iii) pathways of transmission. An overview of the package is now published as an application article in Methods in Ecology and Evolution.
STbayes depends on cmdstanr, posterior, bayestestR, data.table and loo. You can install cmdstanr by following these instructions. Vignettes use NBDA (install with devtools::install_github("whoppitt/NBDA"), igraph, dplyr, ggplot2, and ggpubr.
To install STbayes:
# install devtools if not already
if (!require("devtools")) install.packages("devtools")
devtools::install_github("michaelchimento/STbayes")Chimento, M., & Hoppitt, W. (2025). STbayes: An R package for creating, fitting and understanding Bayesian models of social transmission. Methods in Ecology and Evolution, 00, 1–10. https://doi.org/10.1111/2041-210x.70228.
- Importing data
- Generate a model
- Fit and save the model
- Viewing model output
- Posterior predictive checks
- Model comparison
- Dynamic network models
- Multi-network models
- Individual-level variables
- Transmission weights
- Varying effects
- Other model types: OADA and dTADA
- Edge weight uncertainty
- Complex Transmission
- Setting priors
- High resolution data mode
- Import NBDA Objects
- TADA (acquisition time known) and OADA (only acquisition order known) model types.
- static and dynamic networks.
- multi-network comparison (with static or dynamic networks).
- multiple trials with the same set, subsets, or different sets of individuals.
- constant and time-varying ILVs for additive and multiplicative transmission models.
- varying effects by individual, by trial, or by both for any parameter.
- easy workflow for ELPD (loo-psis, waic) model comparison.
- propagation of uncertainty from network measures to transmission model
- modeling of complex transmission and contagion
