ERGMMulti.jl
Model several binary relations observed on the same actors, such as marriage and business ties among the same families. ERGMMulti.jl provides layer-specific and pooled effects, selected cross-layer statistics, and estimation by R's rule: maximum pseudo-likelihood (the exact MLE) for a dyad-independent formula, Monte-Carlo maximum likelihood otherwise.
| First analysis | Learn the model or data | Reference and detail |
|---|---|---|
| Assemble and fit layers | Understand multilayer data | Estimation and uncertainty |
Fitting accepts one-mode layers with the same actors and directedness. Estimation follows R's default (method = :auto): MPLE when every term is dyad-independent, MCMLE otherwise; method = :mple and method = :mcmle choose one explicitly. Multilevel and multiple-network containers have descriptive uses but are not alternate fitted model families. See Not implemented for the precise boundary.
Installation
Use Julia 1.12 or newer and the shared workspace installation guide. These development packages are not yet registered; the guide prepares the required sibling checkouts and a Julia environment for the examples.
Quick Start
Compare the baseline tie propensities of two relations on the same 16 Florentine families:
using NetworkCore, ERGMMulti
marriage = load_dataset(:florentine_marriage)
business = load_dataset(:florentine_business)
layers = as_multilayer([marriage, business], [:marriage, :business])
fit = fit_ergm_multi(layers, [LayerEdges(1), LayerEdges(2)])
display(fit)Each coefficient is a separate layer’s baseline log-odds. This model does not test whether the two relations co-occur: that requires a cross-layer statistic such as InterlayerDependence(1, 2), which makes the formula dyad-dependent, so the default fit is then the Monte-Carlo MLE, as in R (see Model Estimation).
The block-diagonal mechanism
The layers of a MultilayerNetwork combine into one block-diagonal network (combine_networks) whose vertices carry :layer and :actor attributes (a layer's missing-dyad mask is carried along and restored by split_by_layer; pass report=true for a ConversionReport of what the block-diagonal network cannot hold). The model's dyad universe is the within-layer dyads; layer-aware terms then express per-layer effects, pooled effects, and cross-layer dependence.
Contents
- Getting Started
- Multi-Network Structures
- Terms
- Model Estimation
- Multilevel Networks
- Types
- Terms
- Estimation and Simulation
Not implemented
These are the parts of ergm.multi that have no counterpart here. Each entry states exactly what a user gets instead; the same items appear in the README and in the CHANGELOG ("Known limitations").
- The MCMLE is not R's implementation.
ergm_multifollows R's default (method = :auto): the MPLE, which is the exact MLE, when every term is dyad-independent, and Monte-Carlo maximum likelihood otherwise (method = :mcmle; checked againstergm.multiwithin R's seed-to-seed spread). The MCMLE uses the package's uniform (layer, i, j) proposal, not R's tie/no-tie proposals orcontrol.ergmtuning, so R seeds do not carry over; it has no missing-data form (a masked layer is refused) and no MCMC diagnostics plot. A statistic at the boundary of its attainable range is fixed at∓Infby both estimators (R ergm'sdrop=TRUE;drop = falserefuses instead), whereergm.multi0.3.0 reportsNAor a finite value where its estimation stopped; when that statistic is dyad-dependent the MCMLE's log-likelihood, AIC and BIC areNaN. The MCMLE is refused when the MPLE start is separated (anArgumentErrornaming the terms, whereergm.multiwarns and returns a finite estimate with a huge standard error). The MPLE of a dyad-dependent formula (method = :mple) reports no z values, p-values or confidence intervals by default (NaNincoeftable,confintthrows anArgumentError), because its naive pseudo-likelihood standard errors under-cover (95% Wald intervals covered 0.76–0.94 in simulation);se = :bootstrapgives parametric-bootstrap standard errors (coverage 0.90–0.96), which are conditional on a finite refit and biased downward when replicates are dropped (counted inshowandapproximations(fit)), andse = :hessianis the written opt-in to the naive Wald table R prints for an MPLE fit. - No models over several networks.
ergm.multi'sNetworks()construction — one model fitted to a sample of networks that may differ in size and composition, withN(~edges, ~x)network-level covariates and thegofNdiagnostics — is not implemented.MultiNetworkis a descriptive container (CrossNetEdgesonly) andergm_multiaccepts aMultilayerNetworkonly: layers on the same actors. What you get: the per-layer (LayerEdges(l),WithinLayer(term, l)) and pooled (LayerEdges(),WithinLayer(term, [1, 2])) parameterisations of a multilayer network — every layer-specific effect is its own coefficient or an offset, never a function of a covariate. - Layer logic is limited to same-dyad conjunction of edges and cross-layer reciprocity.
InterlayerDependence(l1, l2)isL(~edges, ~A&B)andMultiplexMutual(l1, l2)ismutualL(Ls = list(~A, ~B)). Any ERGM.jl term can be evaluated within one layer (WithinLayer(term, l),L(~term, ~A)) or pooled over layers (WithinLayer(term, [1, 2]),L(~term, c(~A, ~B))), but not on a logical layer:L(~term, ~A&B)for a term other thanedges,~A|B,~!A,~A&!B, weighted layer sums,twostarL, theespL/dspL/gwespLcross-layer path families andCMBLare not implemented. Neither areLayer(nw, c("attr1", "attr2"))(layers read from edge attributes of one network — build oneNetworkper layer), the.symmetricmixing of directed and undirected layers (add_layer!refuses a layer of the other directedness) or bipartite layers (b1dspL, ...). What you get: no such term exists to construct; a two-mode (bipartite) network is refused byadd_layer!/as_multilayerwith "layer :a is two-mode (bipartite); ERGMMulti models one-mode layers only — the within-layer dyad universe would enumerate the impossible within-mode pairs as observed non-ties, so the fit is refused instead (statnet's bipartite layer terms b1dspL, b2dspL, ... are not implemented)"; a pooled term that expands into different statistics on different layers (aNodeFactorwhose levels differ between layers) and aWithinLayer(Offset(...), l)areArgumentErrors (use theoffsets=keyword for the latter). - Multilevel statistics are descriptive.
Nestedness,LevelHomophilyandCrossLevelEdgeon aMultilevelNetworkare evaluated withcomputeonly and never enter a fit;ergm_multi(::MultilevelNetwork, ...)is aMethodError. What you get: the numbers, and nothing that looks like an estimate. - Goodness of fit has no geodesic-distance panel.
gofcompares the model statistics, the layer edge counts, the multiplexity distribution and each layer's degree and edgewise-shared-partner distributions;gof.ergm's geodesic distances and the dyad-wise shared partners are not computed.
References
Krivitsky, P.N., Koehly, L.M. & Marcum, C.S. (2020). Exponential-family random graph models for multi-layer networks. Psychometrika, 85(3), 630-659.
Krivitsky, P.N. ergm.multi: Fit, Simulate and Diagnose Exponential-Family Models for Multiple or Multilayer Networks. R package. https://cran.r-project.org/package=ergm.multi
Citation
If you use ERGMMulti.jl in your work, please cite it using the entry in CITATION.bib. Please also cite the R package it ports, ergm.multi (reference 2), and the methods paper (reference 1); the ecosystem's How to cite page lists the references for every package.
@misc{SNWJERGMMultiJL,
author = {Santoni, Simone},
title = {ERGMMulti.jl: Exponential Random Graph Models for Multilayer Networks in Julia},
year = {2026},
url = {https://github.com/statistical-network-analysis-with-Julia/ERGMMulti.jl},
note = {Homepage: https://statistical-network-analysis-with-Julia.github.io/ERGMMulti.jl; GitHub: https://github.com/statistical-network-analysis-with-Julia}
}Module
ERGMMulti — Module
ERGMMulti.jl - ERGMs for Multiple and Multilayer NetworksFits ERGMs to multilayer network data (the same actors observed on several relations), following R ergm.multi (Krivitsky, Koehly & Marcum 2020): the layers form a block-diagonal combined network with layer membership attributes (combine_networks), the model's dyad universe is the set of within-layer dyads, and layer-aware terms carry per-layer, pooled, and cross-layer effects. Estimation (fit_ergm_multi, the R name ergm_multi being the same function) follows R's default (method=:auto): maximum pseudo-likelihood over the within-layer dyads, which is the exact MLE, when every term is dyad-independent, and Monte-Carlo maximum likelihood otherwise, with support for per-layer offset coefficients; simulation (simulate_multi_ergm) uses the ERGM family's Metropolis kernel restricted to within-layer dyads.
Also provides containers for multiple independent networks (MultiNetwork) and descriptive statistics for multilevel designs (MultilevelNetwork); neither enters a fit.