Package: bml 0.9.0

bml: Bayesian Multiple-Membership Multilevel Models with Parameterizable Weight Functions

Implements Bayesian multiple-membership multilevel models with parameterizable weight functions via 'JAGS' to model how lower-level units jointly shape higher-level outcomes (micro-macro link) across a range of outcome types (e.g., linear, logit, and survival models). Supports estimation and comparison of alternative aggregation mechanisms, allows weight matrices to be endogenized through parameters and covariates, and accommodates complex dependence structures that extend beyond traditional multilevel frameworks. For details, see Rosche (2026) "A Multilevel Model for Coalition Governments. Uncovering Party-Level Dependencies Within and Between Governments" <doi:10.31235/osf.io/4bafr_v2>.

Authors:Benjamin Rosche [aut, cre]

bml_0.9.0.tar.gz
bml_0.9.0.zip(r-4.7)bml_0.9.0.zip(r-4.6)bml_0.9.0.zip(r-4.5)
bml_0.9.0.tgz(r-4.6-any)bml_0.9.0.tgz(r-4.5-any)
bml_0.9.0.tar.gz(r-4.7-any)bml_0.9.0.tar.gz(r-4.6-any)
bml_0.9.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
bml/json (API)

# Install 'bml' in R:
install.packages('bml', repos = c('https://benrosche.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/benrosche/bml/issues

Pkgdown/docs site:https://benrosche.github.io

Uses libs:
  • jags– Just Another Gibbs Sampler for Bayesian MCMC
  • c++– GNU Standard C++ Library v3
Datasets:
  • coalgov - Coalition Governments in Western Democracies

On CRAN:

Conda:

jagscpp

6.22 score 6 stars 7 scripts 233 downloads 14 exports 52 dependencies

Last updated from:c023e5356f. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK164
source / vignettesOK239
linux-release-x86_64OK194
macos-release-arm64OK149
macos-oldrel-arm64OK1474
windows-develOK119
windows-releaseOK116
windows-oldrelOK320
wasm-releaseOK117

Exports:bmlbmlComparecoefPlotfixfnglancehmidmcmcDiagmmmonetPlottidyvarDecompvars

Dependencies:abindbitbit64bootclicliprcodacpp11crayondplyrfarverforcatsgenericsGGallyggmcmcggplot2ggstatsgluegtablehmsisobandlabelinglatticelifecyclemagrittrMASSpatchworkpillarpkgconfigprettyunitsprogresspurrrR2jagsR2WinBUGSR6RColorBrewerreadrrjagsrlangS7scalesstringistringrtibbletidyrtidyselecttzdbutf8vctrsviridisLitevroomwithr

Examples
1. All friends, or just your best friend? (network regression) | Model 1: linear-in-means | Model 2: best friend only | Comparing the two models | 2. Air quality and home values (spatial regression) | Data and spatial weights | Baseline bml: equal weights | Parameterised weights: similarity across covariates | Do the weights actually vary with similarity? | Benchmark: spatial Durbin error model | Model comparison | 3. Political parties and the survival of coalition governments (micro-macro regression) | The data | Equal-weight baseline | Letting weights vary across parties | Prime minister's party against equal weights | Prime minister against seat share | Comparing the models | MCMC diagnostics

Last update: 2026-06-15
Started: 2021-05-02

Installation
1. Install JAGS | 2. Install bml R package | Option A: Install from CRAN (Recommended) | Option B: Install development version from GitHub | Troubleshooting

Last update: 2026-02-14
Started: 2021-05-02

Frequently Asked Questions
1. What's the difference between a multiple-membership model and a conventional multilevel model? | 2. What's the difference between a conventional MMMM and the extended MMMM implemented in bml? | 3. When should I use bml instead of other multilevel modeling packages? | 4. What outcome types and distributions does bml support? | 5. How do I specify the weight function, and what are the c and ar parameters? | 6. How do I fix parameters to known values? | Main equation and hm() blocks: Using fix() | Weight function fn(): Omitting parameters | 7. I get "Error in node w.1[...]: Invalid parent values" — what does this mean?

Last update: 2026-02-12
Started: 2021-05-02

Getting Started with bml
Introduction | Installation | Basic Example | Understanding the Data Structure | Model 1: Basic Multiple-Membership Model | Model 2: Parameterizing the Weight Function | Visualizing Results | Next Steps | Key Concepts

Last update: 2026-02-12
Started: 2025-10-24

Model Structure
Overview | Notation and Data Structure | The Extended Multiple-Membership Multilevel Model | Full Model Specification | Group-Level Effect | Hierarchical Nesting-Level Effect | Aggregated Member-Level Effect | Parameterizable Weight Functions | Conventional MMMM: Fixed Weights | Extended MMMM: Parameterizing Weights | Testing Alternative Aggregation Mechanisms | Generalized Outcomes | Variance Decomposition and Intraclass Correlation | Intraclass Correlation Coefficients (ICC) | Extensions | Multiple MM Blocks | Autoregressive Random Effects | Opposition Members | Comparison with Conventional MMMM | Model Assumptions | Estimation | Further Information

Last update: 2026-02-12
Started: 2021-05-02