32 Introduction
Modules 4 and 5 built and ran network epidemic models from target statistics we chose by hand, either reasoned from first principles or set up as simulation experiments. That is the right way to learn the machinery, and the right tool for a “what-if” study, but it leaves open the question this module answers: how do you drive the same workflow from real network data?
The answer depends on how the data were collected. Core EpiModel is set up to handle three kinds of network data input, and the netest function will take any of them:
Hand-calculated target statistics. The sufficient statistics for the terms in the model, constructed by the user from empirical summaries or chosen for a simulation experiment, as we did in the Basic Epidemics Module. No individual-level network dataset is required.
Network census data. Empirical data collected from every node and tie in the network of interest. Estimation for this design is handled directly by the
ergmpackage, which tolerates some kinds of missing data (missing ties and nodal attributes) but not others (missing nodes).Egocentrically sampled network data. Empirical data collected from a probability sample of nodes (“egos”) who are asked to report some information on their partners (“alters”). Estimation is handled by the
ergm.egopackage, which can incorporate survey sampling weights and scale the fit to a target population size.
The two empirical designs, network census and egocentric sampling, were introduced in the Network Practice Module; this is the module where they become inputs to an epidemic model.
A theme running through the tutorial is that these inputs are interchangeable in a specific and useful sense. An ERGM or TERGM depends on the data only through the model’s sufficient statistics, so when a census and an egocentric sample carry the same statistics, they produce the same coefficients, the same simulated networks, and the same epidemics. That is what makes egocentric sampling, collecting a little information from a fraction of the population, a valid basis for a model of the whole population network. It also means observed and hypothetical inputs can be mixed: the running example uses an observed friendship network but a hypothetical partnership duration, because the data record who is tied to whom but say nothing about timing.
The module sits between the closed populations of Modules 4 and 5 and the open populations of Module 7. The population here is still closed and the workflow is the familiar one, estimate, diagnose, simulate, analyze; what changes is where the numbers come from.
32.1 What Is in This Module
Tutorial works a complete EpiModel workflow twice over on the same data, the built-in faux.mesa.high (“Mesa”) adolescent friendship network. First as a network census: read the data in, explore the heterogeneity in activity and mixing by grade and sex, fit a TERGM whose target statistics ergm reads straight off the network, diagnose the fit, simulate an SIS epidemic, break prevalence down by grade, and animate the result. Then as an egocentric sample drawn from that same network, to show the two designs give the same answer, and to demonstrate scaling an egocentric fit up to a larger pseudo-population.
Lab is your turn: fit a richer specification (differential homophily plus a gwesp clustering term) to Mesa and carry it through the same pipeline. Because census data let ergm compute every target statistic for you, trying a new specification costs only the time to edit the formula, so the lab is built for exploration.
Appendix: Estimation from egocentric data is optional background, in slides, on the sampling and estimation process for egocentric designs, including the population-scaling assumptions and the principle of scale-invariant measures for different types of ERGM terms.
32.2 Module Learning Objectives
By the end of the module, you should be able to:
- Distinguish the three kinds of network data EpiModel accepts, hand-calculated target statistics, a network census, and an egocentric sample, and name the estimation engine each uses (
ergmfor a census,ergm.egofor egocentric data). - Read a network dataset into R and explore it: compare the observed degree distribution against its Bernoulli-random-graph expectation, and read activity (
nodefactor) and mixing (nodematch, mixing matrices) off the nodal attributes. - Use
summary(nw ~ terms)to compute target statistics directly from network data instead of specifying them by hand. - Fit a TERGM to network data with
netest, supplying a hypothetical dissolution model when partnership durations are not observed. - Diagnose convergence with
netdx, and assess goodness of fit against statistics left out of the model (the default degree, edgewise-shared-partner, and geodesic distributions). - Simulate an SIS epidemic over the fitted dynamic network, break outcomes down by a nodal attribute with
epi.by, and compare rates across unequally sized groups. - Explain why a network census and an egocentric sample yield the same estimates when they carry the same sufficient statistics, and fit the egocentric case with
ergm.ego. - Scale an egocentric fit to a larger pseudo-population with
ppopsize, and explain why the scaling preserves mean degree rather than density.