Package: bml 0.9.0

Benjamin Rosche

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-any)bml_0.9.0.zip(r-4.6-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://cran.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

3.40 score 7 scripts 356 downloads 10 exports 52 dependencies

Last updated from:cfde3345ae. Checks:6 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-develOK157
source / vignettesOK220
linux-releaseOK151
windows-develOK103
windows-releaseOK115
wasm-releaseOK121

Exports:bmlfixfnhmidmcmcDiagmmmonetPlotvarDecompvars

Dependencies:abindbitbit64bootclicliprcodacpp11crayondplyrfarverforcatsgenericsGGallyggmcmcggplot2ggstatsgluegtablehmsisobandlabelinglatticelifecyclemagrittrMASSpatchworkpillarpkgconfigprettyunitsprogresspurrrR2jagsR2WinBUGSR6RColorBrewerreadrrjagsrlangS7scalesstringistringrtibbletidyrtidyselecttzdbutf8vctrsviridisLitevroomwithr

Examples
Example 1: Political Parties and the Survival of Coalition Governments | Example 2: All Friends or Just Your Best Friend? | Example 3: Air Quality and Home Values

Last update: 2026-02-20
Started: 2026-02-20

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-20
Started: 2026-02-20

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-20
Started: 2026-02-20

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-20
Started: 2026-02-20

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-20
Started: 2026-02-20