46  Introduction

Every partnership has two ends. Once a population is divided into groups, that arithmetic fact becomes a constraint: a tie between a member of group A and a member of group B is one tie, counted once from each side, so the two groups’ counts of it have to agree. This module is about what that accounting does to a network specification. It does two things. It tells us that some target statistics we might want to set independently are not independent at all, which is balance. And it tells us how many statistics are left to set once the constraints already in the model are imposed, which is degrees of freedom.

Both matter in practice because target statistics rarely arrive already reconciled. Egocentric survey data, the kind Module 6 introduced, comes from a sample, and a sample’s reports do not have to satisfy an accounting identity that the underlying population does satisfy. Reconciling them is a modeling decision, not a calculation, and this module is where we make those decisions deliberately rather than by accident.

We first give the general background in the slides below, then practice on a small worked example in the lab.

46.1 Slides

Unable to display PDF file. Download instead.


46.2 Balance

Balance is the requirement that the number of ties group A has with group B equals the number group B has with group A. In a purely heterosexual model, the partnerships females have with males and the partnerships males have with females are the same partnerships counted twice, so in any real population the two counts are necessarily equal.

The most common error is to carry that identity over to proportions, where it does not hold. The two proportions have the same numerator, the cross-group ties, but different denominators: each is divided by that group’s own total tie-ends, which is its size times its overall mean degree. In Seattle, the proportion of Black residents’ ties that are with White residents is far higher than the proportion of White residents’ ties that are with Black residents, and there is nothing paradoxical about it. The same absolute number of cross-group ties is a large share of one group’s total and a small share of the other’s. Note that this asymmetry requires within-group ties to exist; in the purely heterosexual case used below, every tie crosses the boundary, both proportions are 100%, and only the counts carry information.

NoteBalance constrains counts, not proportions and not distributions

Balance is a statement about the number of ties crossing a group boundary. It says nothing on its own about what fraction of a group’s ties cross that boundary, and nothing about how those ties are distributed across the individuals in either group. Both of those follow only after group sizes and degree distributions are supplied.

46.2.1 Group sizes are part of the calculation

Because balance is about counts, converting one group’s mean degree into the other’s requires knowing how many people are in each group. Consider a purely heterosexual population in which females have a mean degree of 0.8. What must the male mean degree be? On that information alone, there is not enough information to say. Given 200 females and 180 males, the answer follows: females hold \(200 \times 0.8 = 160\) tie-ends, males must hold the same 160, and \(160 / 180 = 0.889\). The two mean degrees are equal only in the special case of equal group sizes, which makes it easy to forget that the general rule involves the sizes.

46.2.2 Why egocentric data violate balance

Balance holds in the population. It will generally not hold in a sample, for at least three reasons:

  • Sampling error. With a finite sample the two sides will differ by chance alone, and the smaller the sample the larger the discrepancy.
  • Sample bias. The sex ratio of the sample may not match the population’s, and some groups may be systematically under-sampled (female sex workers are a standard example).
  • Misreporting. Reporting of partner counts is known to differ systematically by group.

The practical consequence is a choice. Suppose a purely heterosexual population with a 1:1 sex ratio, sampled at that same ratio, in which males report a mean degree of 0.74 and females report 0.68. Equal group sizes imply that the two mean degrees must be equal, so the reported pair cannot both be right. The edges target statistic can be built from 0.68, from 0.74, from the midpoint 0.71, or from something else entirely, and each option is an assumption about which report is closer to the truth and why. There is no neutral option: taking one group’s number at face value is as much an assumption as splitting the difference, only less visible.

46.2.3 Balance is easy to over-apply

Because balance is only about tie counts, it constrains far less than it might appear to. Take a heterosexual model with an equal sex ratio in which 20% of men report concurrent partnerships. What does that imply about the percentage of women with concurrent partnerships? Very little. Whatever the total number of ties, it can be allocated across women in ways ranging from near-universal monogamy to substantial concurrency, all of them consistent with the same male concurrency. The accounting pins down the sum of the tie-ends, not their allocation across individuals, and concurrency is entirely a question of allocation.

46.2.4 After estimation, balance takes care of itself

Balance has to be imposed once, when the target statistics are constructed, and that is the part requiring explicit thought about data sources. During simulation it cannot be broken, because a cross-group tie is a single object shared by its two endpoints; no simulated network can be unbalanced, whatever the coefficients turn out to be. Arrivals, departures, and attribute changes do not threaten it.

What that guarantee covers is the identity, not the target values. netest converts the targets into coefficients on the log-odds scale, and those coefficients reproduce the intended statistics for the population they were fit to. If the population size changes during a simulation, the statistics themselves can drift, which is why open-population models carry the network-size correction introduced in Module 7.

46.2.5 A note on ergm.ego

The statnet package ergm.ego automates much of this bookkeeping. It is worth knowing what its default assumes rather than treating it as an escape from the problem: it treats a discrepancy between the two sides’ reports as sampling error, pairs the A-to-B stubs with the B-to-A stubs, and takes the sum over two. That is the split-the-difference option, chosen for you. It also assumes the sample fractions represent the population fractions and that no group systematically over- or under-reports. We work through the arithmetic by hand here for three reasons: it is worth knowing exactly what a model assumes, those assumptions have to be explained to mentors, reviewers, and readers, and the statistics sometimes need to be calculated directly.

46.3 Degrees of Freedom

The constraints already in a model do not only reconcile numbers, they consume specification capacity. A model can carry only as many terms and target statistics as there are degrees of freedom remaining, and identifying how many remain is easy to get wrong.

The canonical case is a sex-specific degree distribution. Consider a network of 250 females and 250 males in a purely heterosexual population, with an edges term already included at a target statistic of 165, and a constraint that nobody holds more than 3 ties at once. The quantities that could in principle be specified are the eight cells of this table, the number of people of each sex at each degree:

Degree Females Males
0 F0 M0
1 F1 M1
2 F2 M2
3 F3 M3

Four equations already constrain those eight cells. Two come from the group sizes, and two from the edges term, since all ties are cross-sex and so each sex’s tie-ends must total the full edge count:

  • \(F_0 + F_1 + F_2 + F_3 = 250\) (every female has some degree)
  • \(M_0 + M_1 + M_2 + M_3 = 250\) (every male has some degree)
  • \(F_1 + 2F_2 + 3F_3 = 165\) (the females’ tie-ends total the number of edges)
  • \(M_1 + 2M_2 + 3M_3 = 165\) (the males’ tie-ends total the number of edges)

The last two are the balance identity doing its work: because every tie is cross-sex, setting edges has already pinned down both sides at once. One solution consistent with all four is females at (92, 153, 3, 2) and males at (120, 104, 17, 9). Eight cells minus four constraints leaves four degrees of freedom, split evenly by sex, so the model can carry at most two female degree terms and two male degree terms before it is fully specified. Adding a third on either side would over-parameterize it, since that term’s value is already implied by the others.

The same counting decides questions of term choice, not just term count. A nodematch term on a categorical attribute comes in two flavors, differential (diff = TRUE), which adds one statistic per attribute value, and uniform (diff = FALSE), which adds a single statistic for a global tendency. Whether both are available depends on how many degrees of freedom are left once the terms already in the model have taken theirs. A nodefactor term, for instance, takes one: it fixes the total degree of every attribute value except an omitted reference category, which by default is the value coming first numerically or alphabetically. The lab runs exactly this argument on mixing by community, and the count decides the specification.

46.4 What Is in This Module

This module has one chapter beyond this introduction.

Lab is your turn. It supplies a deliberately tiny egocentric sample of heterosexual respondents living in two communities, reporting their own sex and community, their number of current partners, and the community of each partner. From that sample the task is to specify and parameterize a temporal ERGM for a simulated population of 2,000, then run an SIS epidemic on it. The formation formula is built one term at a time, with a target statistic calculated for each: overall edges, a cross-sex constraint, a maximum-degree constraint, mean degree by community, mixing by community, and sex-specific monogamy terms. The lab then estimates the model with netest, diagnoses it with netdx, and simulates with netsim. An answers section gives our own solution and the reasoning behind each choice; work through the specification first, since several of the decisions have no single correct answer and the value is in confronting them.

Two caveats the lab states and we repeat here. A real model would never be fit to a sample this small; it is small so that every statistic can be counted by hand in a few minutes. And the whole reconciliation could be automated with ergm.ego; we do it manually so the logic is visible.

The material connects backward to two earlier modules. Module 6 is where egocentric data and the translation from survey responses into target statistics were introduced, and this module is the sustained practice with the decisions that translation requires. Module 4 introduced the special group nodal attribute, which the lab uses to represent sex and which the sex-specific degree terms and two-group epidemic parameters rely on.

It also has a complement at the other end of the data pipeline. Here a small egocentric sample is turned into target statistics and a fitted model, because a sample is all we have. Epidemics over Observed Networks in Module 11 takes the opposite case: a fully observed dynamic network census, where every node and every partnership is recorded over time, so there is nothing to reconcile and nothing to estimate, and the observed network goes straight into netsim. Reading the two together makes clear what estimation is actually buying, and what balance and degrees of freedom are constraints on.

46.5 Module Learning Objectives

  • Explain balance as a constraint on the number of ties crossing a group boundary, and distinguish it from a constraint on proportions or on degree distributions.
  • Use group sizes to convert one group’s mean degree into the mean degree the other group must have.
  • Identify why egocentric data will not satisfy balance (sampling error, sample bias, misreporting), and recognize that reconciling the discrepancy is an assumption rather than a calculation.
  • Choose among reconciliation options for a discordant pair of reported mean degrees, state what each choice assumes, and describe which choice ergm.ego makes by default.
  • Recognize where balance does not apply, in particular that one group’s level of concurrency places almost no constraint on another’s.
  • Count the degrees of freedom available to a specification, by enumerating the quantities that could be set and subtracting the constraints imposed by group sizes and by terms already in the model.
  • Apply that count to bound the number of degree terms a model can carry and to decide between nodematch with diff = TRUE and diff = FALSE.
  • Starting from egocentric data, build a formation formula one term at a time, calculate a target statistic for each, estimate the model, diagnose it, and simulate an epidemic on it.

46.6 Beyond structural parameterization

This module parameterizes the network structure from egocentric data, choosing terms and target statistics so that the simulated partnerships reproduce the observed data. Managing the epidemic parameters that run on top of that structure is a separate task, and EpiModel provides three mechanisms for it, all documented in the Working with Model Parameters vignette. Scenarios apply named sets of parameter values at chosen time steps, which is the recommended way to represent an intervention that changes over time and to compare policy alternatives (use_scenario(), create_scenario_list()). Random parameters draw values from user-supplied distributions, supporting uncertainty and sensitivity analysis (random.params). Parameter tables manage many parameters from a single spreadsheet or data frame (data.frame.params). We cover the scenarios material, with worked code, in Module 11.