Reference Measures
Reference measures are the foundation of count ERGMs. They specify the baseline distribution for edge values, playing the same role that the Bernoulli distribution plays in binary ERGMs.
Overview
In the count ERGM:
\[P(Y = y) \propto h(y) \exp\left(\theta^\top g(y)\right)\]
The reference measure $h(y) = \prod_{(i,j)} h(y_{ij})$ determines the "null model" distribution for each edge value. Without any ERGM terms ($\theta = 0$), the edge values are independent draws from this reference distribution.
Why Reference Measures Matter
The choice of reference measure affects:
- Support: What values are possible (unbounded vs. bounded)
- Baseline shape: The prior distribution of edge values
- Interpretation: How coefficients relate to changes in edge value probabilities
- Convergence: Some references work better with certain data patterns
Available Reference Measures
PoissonReference
The Poisson reference measure is the most common choice for count-valued networks.
<!– skip-check –>
PoissonReference(lambda::Float64=1.0)Reference function:
\[h(y_{ij}) = \frac{\lambda^{y_{ij}}}{y_{ij}!}\]
Support: $y_{ij} \in \{0, 1, 2, \ldots\}$ (unbounded non-negative integers)
Properties:
- Unbounded support means any positive integer is possible
- The parameter $\lambda$ controls the baseline mean
- With $\lambda = 1$ and no ERGM terms, each edge has a Poisson(1) distribution
- Naturally models event counts (emails, calls, meetings)
When to use:
- Edge values represent counts of independent events
- No hard upper bound on edge values
- Moderate variance (mean approximately equals variance)
using ERGMCount
# Default: lambda = 1.0
ref = PoissonReference()
# Higher baseline rate
ref = PoissonReference(2.0)
# Lower baseline rate (sparser networks)
ref = PoissonReference(0.5)Log-reference computation (the internal definition, for reference):
<!– skip-check –>
log_reference(ref::PoissonReference, y) = y * log(ref.lambda) - log(factorial(y))GeometricReference
The Geometric reference is useful for over-dispersed count data.
GeometricReference()Reference function (the counting measure, as in ergm.count/Krivitsky 2012):
\[h(y_{ij}) = 1\]
Support: $y_{ij} \in \{0, 1, 2, \ldots\}$ (unbounded)
Properties:
- Unbounded support like Poisson, but heavier (geometric) tails
- The geometric shape of the dyad distribution comes from a negative
SumTermcoefficient, not from a reference parameter: with coefficient θ < 0 each dyad is conditionally geometric with success probability 1 − e^θ - The reference itself has no free parameter
When to use:
- Edge values show more variance than a Poisson would predict
- Some dyads have very high counts while most are zero or low
- Heavy-tailed distributions are expected
ref = GeometricReference()BinomialReference
The Binomial reference is appropriate when edge values have a known upper bound.
<!– skip-check –>
BinomialReference(trials::Int)Reference function (matching ergm.count's Binomial(trials)):
\[h(y_{ij}) = \binom{n}{y_{ij}}\]
Support: $y_{ij} \in \{0, 1, \ldots, n\}$ (bounded)
Properties:
- Bounded support – edge values cannot exceed the number of trials $n$
- Natural when each edge represents "successes out of trials"
- The baseline success probability is absorbed into the estimated
SumTermcoefficient rather than parameterizing the reference: with coefficient θ each dyad is conditionally Binomial(n, logistic(θ))
When to use:
- Edge values have a natural upper bound
- Counts represent "k out of n" scenarios
- Examples: meetings out of possible workdays, co-occurrences in fixed-size groups
# 10 possible meetings
ref = BinomialReference(10)
# 5 weekdays
ref = BinomialReference(5)DiscUnifReference
The Discrete Uniform reference assigns equal probability to all values in the support.
<!– skip-check –>
DiscUnifReference(max::Int)Reference function:
\[h(y_{ij}) = \frac{1}{\text{max} + 1}\]
Support: $y_{ij} \in \{0, 1, \ldots, \text{max}\}$
Properties:
- All values are equally likely under the null model
- No prior preference for any particular edge value
- The constant reference cancels in the normalizing constant, simplifying computation
When to use:
- No strong prior belief about the baseline distribution
- Data is bounded and you want a "non-informative" reference
- Likert-scale or ordinal data treated as counts
# Values 0 through 10
ref = DiscUnifReference(10)
# Values 0 through 5
ref = DiscUnifReference(5)DiscUnif2Reference
The range-bounded Discrete Uniform reference allows specifying both lower and upper bounds.
<!– skip-check –>
DiscUnif2Reference(a::Int, b::Int)Reference function:
\[h(y_{ij}) = \frac{1}{b - a + 1}\]
Support: $y_{ij} \in \{a, a+1, \ldots, b\}$
Properties:
- Uniform distribution over an arbitrary integer range (R's
DiscUnif(a, b)) - Allows non-zero lower bounds, negative ones included: with
a < 0a dyad's count may be negative — the estimator enumeratesa:b, the Gibbs sampler draws from it (an edge is stored for every non-zero count, its:weightthe negative value),nonzerocountsy ≠ 0, andgof's count-value panel runs over the negative values too - Useful when zero is not a valid edge value (
a > 0: an absent edge is then refused with a hint to widen the reference)
When to use:
- Edge values must be at least some minimum (e.g., rating scales starting at 1)
- Data has known lower and upper bounds, possibly signed (net balances, ±k ratings)
# Rating scale 1 to 5
ref = DiscUnif2Reference(1, 5)
# Bounded range 0 to 100
ref = DiscUnif2Reference(0, 100)
# Signed counts −2..2
ref = DiscUnif2Reference(-2, 2)Comparing Reference Measures
Decision Tree
Is the count bounded?
|
+-- Yes --> Is there a natural "trials" interpretation?
| |
| +-- Yes --> BinomialReference
| |
| +-- No --> Is there a non-zero lower bound?
| |
| +-- Yes --> DiscUnif2Reference
| +-- No --> DiscUnifReference
|
+-- No --> Is the variance close to the mean?
|
+-- Yes --> PoissonReference
+-- No --> GeometricReferenceComparison Table
| Property | Poisson | Geometric | Binomial | DiscUnif |
|---|---|---|---|---|
| Support | $[0, \infty)$ | $[0, \infty)$ | $[0, n]$ | $[0, \text{max}]$ |
| Tail weight | Light | Heavy | Light | None |
| Reference parameters | $\lambda$ (fixed, default 1) | none — the counting measure | $n$ (trials) | max |
Dyad law with a sum coefficient $\theta$ | Poisson$(\lambda e^\theta)$ | Geometric, success probability $1 - e^\theta$ ($\theta < 0$) | Binomial$(n, \text{logistic}(\theta))$ | tilted uniform |
| Truncated by the estimator? | yes (0:max_val, error-controlled) | yes | no | no |
| Best for | Event counts | Over-dispersed | Bounded trials | No prior |
Sensitivity Analysis
When unsure which reference to use, compare results across multiple references:
using NetworkCore, ERGMCount, Random
rng = Xoshiro(1)
net = network(10; directed=true)
for i in 1:10, j in 1:10
if i != j && rand(rng) < 0.2
add_edge!(net, i, j)
set_edge_attribute!(net, :weight, i, j, rand(rng, 1:5))
end
end
terms = [SumTerm(), NonzeroTerm(), CountMutualTerm()]
refs = [
("Poisson(1.0)", PoissonReference(1.0)),
("Geometric", GeometricReference()),
("DiscUnif(10)", DiscUnifReference(10)),
]
for (name, ref) in refs
result = ergm_count(net, terms; reference=ref, method=:mple) # fast; compare signs
println("$name: ", round.(coef(result), digits=3),
" converged=", result.converged)
endIf coefficients are qualitatively similar across references (same signs, similar magnitudes), the results are robust. Large differences suggest that the reference choice matters for your data, and domain knowledge should guide the selection.
Sampling from References
Each reference measure can draw from its baseline distribution — the law of a dyad when every coefficient is 0 (for the parameter-free counting measure and the binomial, a conventional Geometric(0.5) and Binomial(n, 0.5)). The Gibbs sampler does not use these draws: it redraws each dyad from its full conditional under the fitted coefficients, in which the reference enters through log_reference. sample_reference is a convenience for seeding or for baseline comparisons.
# Draw a random value from the baseline distribution
sample_reference(PoissonReference(2.0)) # Random Poisson(2) draw
sample_reference(GeometricReference()) # Random Geometric(0.5) draw
sample_reference(BinomialReference(10)) # Random Binomial(10, 0.5) draw
# All samplers accept an rng keyword for reproducibility
using Random
sample_reference(PoissonReference(2.0); rng=Xoshiro(1))Log-Reference Values
For numerical stability, ERGMCount.jl works with log-reference values internally:
# Log-probability under reference
log_reference(PoissonReference(1.0), 3) # log(1^3 / 3!)
log_reference(GeometricReference(), 3) # 0.0 (counting measure)
log_reference(BinomialReference(10), 3) # log(C(10,3))Mathematical Details
Relationship Between Reference and Conditional Distribution
Given parameters $\theta$ and the rest of the network $y_{-ij}$, the conditional distribution of $y_{ij}$ is:
\[P(Y_{ij} = y \mid Y_{-ij} = y_{-ij}) \propto h(y) \exp\left(\theta^\top \Delta g(y_{ij})\right)\]
Where $\Delta g(y_{ij})$ is the change in sufficient statistics when $y_{ij}$ changes.
Poisson-SumTerm Connection
With Poisson reference and SumTerm, the conditional distribution of $y_{ij}$ is:
\[P(Y_{ij} = y) \propto \frac{\lambda^y}{y!} \exp(\theta \cdot y) = \frac{(\lambda e^\theta)^y}{y!}\]
This is a Poisson distribution with rate $\lambda \exp(\theta)$. The coefficient $\theta$ on SumTerm multiplicatively adjusts the baseline Poisson rate.
Identifiability
The reference measure and the ERGM terms must be identifiable together. For example, with a Poisson reference, the SumTerm coefficient and the Poisson $\lambda$ are confounded – changing one can be compensated by changing the other. In practice, $\lambda$ is fixed (often at 1.0) and only the ERGM coefficients are estimated.