This page describes how to specify the constraints on the network sample space (the set of possible networks \(Y\), the set of networks \(y\) for which \(h(y)>0\)) and sometimes the baseline weights \(h(y)\) to functions in the ergm
package. It also provides an indexed list of the constraints visible to the ergm's API. Constraints can also be searched via search.ergmConstraints
, and help for an individual constraint can be obtained with ergmConstraint?<constraint>
or help("<constraint>-ergmConstraint")
.
In an exponential-family random graph model (ERGM), the probability or density of a given network, \(y \in Y\), on a set of nodes is $$h(y) \exp[\eta(\theta) \cdot g(y)] / \kappa(\theta),$$ where \(h(y)\) is the reference distribution (particularly for valued network models), \(g(y)\) is a vector of network statistics for \(y\), \(\eta(\theta)\) is a natural parameter vector of the same length (with \(\eta(\theta)\equiv\theta\) for most terms), \(\cdot\) is the dot product, and \(\kappa(\theta)\) is the normalizing constant for the distribution. A complete ERGM specification requires a list of network statistics \(g(y)\) and (if applicable) their \(\eta(\theta)\) mappings provided by a formula of ergmTerm
s; and, optionally, sample space \(\mathcal{Y}\) and reference distribution \(h(y)\) information provided by ergmConstraint
s and, for valued ERGMs, by ergmReference
s.
Constraints typically affect \(Y\), or, equivalently, set \(h(y)=0\) for some \(y\), but some (“soft” constraints) set
\(h(y)\) to values other than 0 and 1.
A constraints formula is a one- or two-sided formula whose left-hand side is
an optional direct selection of the InitErgmProposal
function and
whose right-hand side is a series of one or more terms separated by
"+"
and "-"
operators, specifying the constraint.
The sample space (over and above the reference distribution) is determined by iterating over the constraints terms from left to right, each term updating it as follows:
If the constraint introduces complex
dependence structure (e.g., constrains degree or number of edges in the
network), then this constraint always restricts the sample space. It may
only have a "+"
sign.
If the constraint only restricts the set of dyads that may vary in the
sample space (e.g., block-diagonal structure or fixing specific dyads at
specific values) and has a "+"
sign, the set of dyads that may
vary is restricted to those that may vary according to this constraint
and all the constraints to date.
If the constraint only restricts the set of dyads that may vary in the
sample space but has a "-"
sign, the set of dyads that may
vary is expanded to those that may vary according to this constraint
or all the constraints up to date.
For example, a constraints formula ~a-b+c-d
with all constraints
dyadic will allow dyads permitted by either a
or b
but only if they are
also permitted by c
; as well as all dyads permitted by d
. If A
, B
,
C
, and D
were logical matrices, the matrix of variable dyads would be
equal to ((A|B)&C)|D
.
Terms with a positive sign can be viewed as "adding" a constraint while those with a negative sign can be viewed as "relaxing" a constraint.
network
By default, %ergmlhs%
attributes constraints
or
constraints.obs
(depending on which constraint) attached to the
LHS of the model formula or the basis=
argument will be added in
front of the specified constraints formula. This is the desired
behaviour most of the time, since those constraints are usually
determined by how the network was constructed (e.g., structural
zeros in a block-diagonal network).
For those situations in which this is not the desired behavior, a
.
term (with a positive sign or no sign at all) can be used to
manually set the position of the inherited constraints in the
formula, and a -.
(minus-dot) term anywhere in the constraints
formula will suppress the inherited formula altogether.
ergm:::.formatIndexHtml(ergm:::.buildTermsDataframe("ergmConstraint"))
ergm:::.formatMatrixHtml(ergm:::.termMatrix("ergmConstraint"))
ergm:::.formatTocHtml(ergm:::.termToc("ergmConstraint"))
Goodreau SM, Handcock MS, Hunter DR, Butts CT, Morris M (2008a). A statnet Tutorial. Journal of Statistical Software, 24(8). tools:::Rd_expr_doi("10.18637/jss.v024.i08")
Hunter, D. R. and Handcock, M. S. (2006) Inference in curved exponential family models for networks, Journal of Computational and Graphical Statistics.
Hunter DR, Handcock MS, Butts CT, Goodreau SM, Morris M (2008b). ergm: A Package to Fit, Simulate and Diagnose Exponential-Family Models for Networks. Journal of Statistical Software, 24(3). tools:::Rd_expr_doi("10.18637/jss.v024.i03")
Karwa V, Krivitsky PN, and Slavkovi\'c AB (2016). Sharing Social Network Data: Differentially Private Estimation of Exponential-Family Random Graph Models. Journal of the Royal Statistical Society, Series C, 66(3): 481-500. tools:::Rd_expr_doi("10.1111/rssc.12185")
Krivitsky PN (2012). Exponential-Family Random Graph Models for Valued Networks. Electronic Journal of Statistics, 6, 1100-1128. tools:::Rd_expr_doi("10.1214/12-EJS696")
Morris M, Handcock MS, Hunter DR (2008). Specification of Exponential-Family Random Graph Models: Terms and Computational Aspects. Journal of Statistical Software, 24(4). tools:::Rd_expr_doi("10.18637/jss.v024.i04")