Bergm: Bayesian Exponential Random Graph Models

Bergm provides a comprehensive framework for Bayesian parameter estimation and model selection for exponential random graph models using advanced computational algorithms. It can also supply graphical Bayesian goodness-of-fit procedures that address the issue of model adequacy and missing data imputation.

What’s new

Bergm 6 is a rewrite of the computational core that keeps the Bergm 5 interface (same functions, arguments and returned elements) while making every function faster and more flexible. See NEWS.md for the full list.

Speed-ups over Bergm 5.0.7

Wall-clock time on a 2-core machine (ergm 4.12.0), average of two runs; “ESS/s gain” compares effective samples per second for the worst-mixing parameter. Full table, settings and validation against Bergm 5 in benchmarks/ (in the source repository).

Function, data, (Bergm 6 option) Bergm 5 Bergm 6 ESS/s gain
bergm(), Florentine 9.4 s 3.6 s 2.7x
bergm(), Lazega 45.4 s 31.9 s 1.4x
bergm(), Lazega, (delayed acceptance) 45.4 s 18.2 s 1.9x
bergm(), Faux Mesa High, (delayed acceptance) 44.2 s 19.1 s 2.7x
bergmM(), Florentine with missing nodes 62.2 s 5.4 s 10.0x
bergmC(), Florentine 17.9 s 1.0 s 14.8x
bergmC(), Lazega 33.1 s 6.0 s 5.1x
evidencePP(), Florentine 18.1 s 2.2 s 8.1x
evidencePP(), Lazega 77.2 s 13.3 s 5.8x
bgof(), Florentine 3.9 s 0.2 s
bgof(), Lazega 7.5 s 2.0 s
library(Bergm)
data(florentine)

# Curved ERGM, delayed acceptance (default) and 4 workers
data(lazega)

fit2 <- bergm(lazega ~ edges + nodematch("Office") + gwesp(0.5, fixed = FALSE),
              burn.in = 200, main.iters = 2000, aux.iters = 3000,
              cores = 4, seed = 1)

# Model selection
a1 <- ergmAPL(flomarriage ~ edges + kstar(2))
a2 <- ergmAPL(flomarriage ~ edges + triangle)
evidencePP(flomarriage ~ edges + kstar(2), apl = a1)$log.evidence -
  evidencePP(flomarriage ~ edges + triangle, apl = a2)$log.evidence

# Goodness of fit and posterior predictive networks
bgof(fit, sample.size = 100, aux.iters = 5000)
nets <- simulate(fit, nsim = 10)

How to cite Bergm

Caimo, A., Bouranis, L., Krause, R., and Friel, N. (2022). Statistical Network Analysis with Bergm. Journal of Statistical Software, 104(1), 1–23. doi: https://doi.org/10.18637/jss.v104.i01.