56  Designing a Model for Your Research Question

This chapter is a small-group design exercise, and like the slides before it, it has no code. The slides walked one research question, HIV testing in a sexual network, from a bare susceptible-infected model all the way up to a research-level design, asking the same handful of questions at every step. Now it is your group’s turn to do the same for a question of your own.

You will split by the broad disease area you work in or care about, and build a model from the ground up: first a model that answers an etiological question about how the epidemic works, then the intervention you would layer on top to change it. Nothing here is coded. The output is a design: the states, the network, the attributes, the modules, and the data each would need. This is the one point in the week where every piece we have built connects, so treat it as a chance to see the whole toolkit at once.

The exercise runs in three beats across the day. You design your model now, before you have seen a full research model in code. In the middle of the day the class turns to code and builds one together, the network-based COVID model of Module 13, which is a worked version of exactly this design process. You then reconvene at the end to present your design and close the course.

56.1 The six questions

The slides carried one model up in complexity by asking the same six questions of every addition. Those questions are the framework for this exercise, so ask them of your own model:

  1. What attribute(s) does this require on each node?
  2. What module(s) does it add?
  3. What does each module comprise: what does it read, what stochastic rule does it apply, and what does it write back? This is the read-process-write contract from Module 9.
  4. What existing model elements does it revise?
  5. What network statistics or model parameters does it need?
  6. What data would parameterize it, and where are the gaps?

Before the six questions comes a scoping step, the “brainstorming example” the slides opened with: fix the base model. Name the states and draw the compartment diagram, decide what a node represents and how many network layers transmission runs over, and set the time step. Everything after that is an addition to this base, and each addition gets the six questions run on it.

The order of work matters. Start from the bare minimum that could answer the etiological question, then add realism only where the question demands it, and only then layer the intervention on top. The slides’ testing module went from “everyone tests at one rate” to a version that depended on time since last test, age, and behavior; both are legitimate designs, and which one you need is set by the question, not by how much detail you can imagine.

56.2 Every design decision is something you already built

The reason this exercise is possible on the last morning is that you have already learned to build each piece. Naming the piece is the same as naming the module that taught it.

Design piece Where in the course you built it
The states and the compartment diagram (SI, SIS, SIR, SEIR, and staged natural histories) Module 4 and Module 9
The contact network: what a tie is, and the formation and dissolution terms Module 2 and Module 3
Parameterizing that network from data, and reconciling the target statistics Module 6 and Module 10
Nodal attributes, and the exogenous processes that change them (aging, attribute transitions) Module 4 and Module 7
Open-population vital dynamics: arrivals, departures, and the network-size correction Module 7
The epidemic and intervention modules themselves, as read-process-write functions Module 9
Several contact layers running at once (main, casual, one-time; household, school, community) Module 11

When you hit a design decision your group is unsure how to build, this table is the first place to look: the module that introduced the piece is where the mechanics live.

56.3 Design principles

Four ideas are worth carrying out of the exercise, because they generalize past any one disease.

NoteThe intervention is usually the small part

Almost all of a model’s machinery is the etiological substrate: the natural history and the network transmission runs over. The intervention is often a single module plus one attribute acting through that substrate. Deciding this on paper is the payoff of designing before coding, because the thing that sounded like the whole project frequently turns out to be one module, and the real work is the model it acts on.

NoteBuild the bare minimum first

Build the simplest model that could answer the question, then add realism only where the question forces it. Every attribute you add has to be initialized, every module you add revises the existing ones, and every parameter you add is a quantity someone has to supply from data. Complexity is not free, and a design that names more states than the question needs is harder to fit, slower to run, and no more correct.

NoteDecide whether a network model is even the right tool

A network model earns its cost when partnership structure matters: concurrency, long durations, assortative mixing, or repeated contact with the same people. When contacts are effectively random and fleeting, a compartmental or age-structured model may answer the question with far less machinery, and recognizing that is part of designing well. A network model also inherits a hard limit: it is only as good as the partnership data used to parameterize it, so a model whose contact structure cannot be grounded in data is guessing at its most important assumption.

NoteWatch for endogeneity and selection

An observed pattern, such as partners tending to share a disease-status or an attribute, can arise from selection (people choose similar partners) or from the transmission process itself (partnerships are where infection spreads, so they end up concordant). Separating the two is a parameterization problem, not a data-collection one, and the slides showed one route: estimate the network with the selection term, simulate the full transmission model, and tune the term down until the simulated concordance matches the data. Note where your design will face this.

56.4 Concrete starting points

Form groups around the area closest to your own work. Each area below gives example systems, a sample etiological question and a sample intervention question to react to or replace, the Gallery example closest to it as a code counterpart to read later, and the design challenges that tend to be distinctive to that area. The questions are starting points, not assignments; a question your group actually cares about will always be the better choice.

56.4.1 Zoonotic and animal-contact systems

These are the cases where transmission runs over an animal contact structure, or across a human-animal-environment interface. The network angle is strongest when contacts persist or repeat: livestock movement between premises (nodes are farms, ties are animal shipments), free-roaming animal populations, or the worker-and-animal contacts inside a facility. Open populations are central here, because animal turnover, births, trade, and culling are fast relative to the infection.

  • Example systems. Foot-and-mouth or avian influenza spreading over a livestock or poultry movement network; rabies in free-roaming dog populations; bovine tuberculosis or brucellosis in a wildlife-livestock system.
  • Sample etiological question. How does the structure of the movement network, in particular concurrency of shipments and the presence of high-degree market hubs, shape the size and speed of an outbreak?
  • Sample intervention question. How much outbreak size is averted by movement bans, or by ring vaccination or culling around detected premises, and does targeting the highest-degree hubs beat treating all premises equally?
  • Closest Gallery starting points. SI with Age-Specific Vital Dynamics for an open population with fast turnover; SIR with Time-Varying Vaccination and SEIR with All-or-Nothing Vaccination as templates for phased or ring interventions; SEIR with Contact Tracing for tracing forward along movement links.
  • Distinctive challenges. Deciding what a node is (an individual animal, or a premises or herd as a super-node); representing directed and weighted movement ties rather than symmetric partnerships; handling transmission that is indirect (environmental or vector-borne) and so is not a simple node-to-node contact; and, if the real question is human risk, adding the spillover interface as its own process. Note also that no Gallery example is purely zoonotic, so this area is the clearest test of whether the framework generalizes past the examples it ships with.

56.4.2 HIV and other sexually transmitted infections

The slides already built one model in this area in full: HIV testing among men who have sex with men, over main, casual, and one-time layers. A group here should therefore either extend that model with a different intervention (pre-exposure prophylaxis, treatment as prevention, partner services) or take a different STI whose natural history changes the compartment structure. A curable bacterial STI is an SIS system with reinfection, which behaves very differently from HIV’s chronic SI-with-stages structure, and that contrast is instructive on its own.

  • Example systems. Gonorrhea or chlamydia (curable, SIS, with reinfection from untreated partners); antimicrobial-resistant gonorrhea (competing strains); syphilis (a staged natural history); HPV with vaccination.
  • Sample etiological question. How much of an STI’s persistence is driven by partnership concurrency and turnover versus reinfection from a small, untreated core group?
  • Sample intervention question. How much incidence is averted by increasing screening frequency, by expedited partner therapy or partner notification, or by targeted vaccination, and which reaches the core group most efficiently?
  • Closest Gallery starting points. Test and Treat for an SIS Epidemic; Partner Notification for an Endemic STI; Competing Pathogen Strains for resistance; Syphilis Progression for a staged history; and the full HIV with Care Cascade and PrEP model as the code counterpart to the slides.
  • Distinctive challenges. Choosing between a chronic (SI) and a curable (SIS) structure, since reinfection changes everything downstream; representing multiple partnership types as separate network layers with different durations and mixing; handling partner-reported attributes that the respondent may not know accurately (the disclosure problem the slides raised); and the endogeneity of status concordance flagged in the design principles above.

56.4.3 Respiratory and directly transmitted infections

These pathogens spread through the air over contacts that are often momentary rather than persistent, which puts real pressure on whether a partnership network is the right representation at all. The network angle earns its keep when repeated-contact settings structure transmission: households, schools, workplaces, and congregate facilities, which is exactly the multilayer picture from Module 11. Age structure is usually first-order.

  • Example systems. Influenza or SARS-CoV-2 over household, school or workplace, and community layers; RSV in young children across household and daycare layers; measles or pertussis, where waning immunity and demography matter; tuberculosis, with a long latent period and congregate-setting transmission.
  • Sample etiological question. What fraction of transmission happens in households versus schools versus the wider community, and how does age-structured contact drive that split?
  • Sample intervention question. How much transmission is averted by school closures, by age-targeted vaccination, or by test-and-isolate, and how does the answer depend on which layer dominates?
  • Closest Gallery starting points. Age-Stratified RSV on a Multilayer Network as the multilayer, age-structured template; SEIR with an Exposed State for a latent period; SEIR with All-or-Nothing Vaccination and SEIRS with Leaky Vaccination to contrast vaccine modes; and the Module 13 COVID capstone as a worked build.
  • Distinctive challenges. Deciding whether persistent ties are even appropriate when infectious periods are short relative to partnership durations, which may push toward one-time or instantaneous contact layers; capturing strong age structure and the household-school-community layering; representing immunity and its waning, which turns an SIR into an SIRS; and being honest about when a well-mixed age-structured compartmental model would answer the question more cheaply than the network machinery.

56.5 The group exercise

NoteYour group’s tasks

Work through these as a group now, in the morning session. You will not write any code; the deliverable is a design on paper or a whiteboard. Later in the day the class builds a full model together in code, and each group presents its design at the end.

  1. Pick your system and your two questions. Within your disease area, settle on one concrete pathogen or system. Write one sentence stating an etiological question (how does the epidemic work?) and one sentence stating an intervention question (what would change it?).
  2. Scope the base model. Name the states and draw the compartment diagram with the flows between them. Decide what a node represents, how many network layers transmission runs over, and what the time step is.
  3. Build up to the etiological question. Add heterogeneity and processes one at a time, running the six questions on each addition. Start from the bare minimum and add realism only where your etiological question needs it. For every addition, name the course module or Gallery example that shows you how to build it.
  4. Layer on the intervention. Add the intervention as its own process, again through the six questions. Identify the single module and the attribute that carry it, and list which existing model elements it forces you to revise.
  5. Stress-test the design. Name the one design decision your group is least sure how to build, and the single largest gap or bias in the data you would need. Flag anything about your area that seems genuinely distinctive, the way the slides asked you to note what is unusual about each new phenomenon.

56.6 Then go build one in code

With your design in hand, the class now turns to code. Module 13 carries this exact process through to a running model: a network-based COVID model whose design decisions (a clinical and subclinical natural history, a screening-and-isolation intervention, age-structured mixing) become concrete modules. Work through it as the coded version of what you just did on paper. The screening module there is the direct realization of the kind of testing and diagnosis module the design process produces, and every state, attribute, and module you named has a counterpart in the code. Keep your own design in front of you as you go: if your group chose a respiratory system, the COVID model is close to your design built out, and if you chose another area, it is the template for how any of these designs becomes code.

56.7 Present your design to the class

NoteWhat to bring to the share-out

Each group presents to the room at the end of the day, as the course wrap-up. You will have built the COVID model in between, so return to your design with fresh eyes: if seeing a full model in code changed how you would design yours, fold that in before you present. Be ready to show:

  • your etiological and intervention questions;
  • your compartment diagram and your network structure (how many layers, what heterogeneity);
  • the single module that carries your intervention, and what it reads, does, and writes;
  • your hardest design decision and your biggest data problem.

The last item is the most valuable to the room, because the distinctive difficulties of each area are what the rest of the class will not have thought about.