ChangeStats-ergmConstraint-a69283e7: Specified statistics must remain constant

ChangeStats-ergmConstraintR Documentation

Specified statistics must remain constant

Description

This is an constraint operator that takes a ergmTerm formula, and prevents any changes to the network that modify its value. Unlike \ergmConstraintergmDyads(fix = ...), the terms can be dyad-dependent and are calculated at the same time as the proposal rather than used to select proposable-dyads in the first place.

Usage

# ChangeStats(fix, check_dind = TRUE)

Arguments

fix

an ergmTerm formula.

check_dind

logical; if fix turns out to be dyad-independent, fall back to \ergmConstraintergmDyads(fix).

Dyadic dependence

If the constraint is dyad-independent, \ergmConstraintergmDyads(fix) will usually be faster (at least for estimation) and will make MPLE far more accurate, so if ChangeStats detects a dyad-independent constraint, it will fall back to Dyads. This can be overridden by setting check_dind = FALSE.

Sampleability is not guaranteed

It is perfectly possible for this constraint to make sampling impossible. For example, ChangeStats(~edges) will prevent any proposals that change the number of edges in the network, but ergm has no way of knowing that two toggles (edge and non-edge) are now required, so it will keep trying making proposals and failing.

More insidiously, it is in principle possible for the constraint to split the sample space into two parts such that it is not possible to go between them without passing through a state that breaks the constraint.

Thus, it is recommended to use this constraint to, e.g., prevent certain motifs from forming.

See Also

ergmConstraint for index of constraints and hints currently visible to the package.

\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmConstraint", "ChangeStats", "subsection")}

ergm documentation built on Dec. 22, 2025, 5:10 p.m.