50  Multi-Layer Networks Lab

In the Multi-Layer Networks tutorial you built a two-layer SI epidemic, first with independent layers and then with a cross-layer dependency, and added a custom module that tracks which layer each infection came from. This lab has you turn those models into experiments: change one thing at a time and read the epidemiological consequence off the network mechanics.

The specific learning objectives are to:

Note

A worked solution is in the course repository as mod11-Lab-Solution.R. It rebuilds the tutorial’s models so it runs on its own, works through the four steps, and answers the questions in comments. Please work through the lab yourself before you consult it. You will get much more out of the questions if you have already formed your own answer.

50.1 Setup

Start from the tutorial’s independent model: the shared node set with the race attribute, est1 (main, duration 200) and est2 (casual, duration 20), and the SI parameters param and init. Re-run the tutorial’s Part 1 code, or copy those blocks into a fresh script, so that est1, est2, param, and init are in your workspace before you begin.

50.2 Lab Steps

NoteStep 1 (warm-up): Duration drives the epidemic

The casual layer’s short duration is what makes it churn. Re-estimate the casual layer (est2) with its mean duration shortened from 20 to 5, holding everything else fixed, then re-run the independent netsim and overlay the new prevalence curve on the original. Describe how the peak height and its timing change.

The point is that dissolution, not just the formation target, sets the pace of spread: the same mean degree with faster turnover reaches more distinct people over time.

NoteStep 2 (core): Predict, then check, whether coupling matters

Before you look at any output, write down a prediction: relative to the independent model, will the negative cross-layer dependency raise or lower peak prevalence, and why? Then build the dependent model as in Part 2 (the san() bootstrap from mod11-helpers.R, the two cross-layer nodefactor terms, and the dat.updates callback), run it, and overlay its prevalence on the independent model’s.

Read the result off the plot and check it against your prediction. Tie the direction back to the mechanism: how does forcing high-degree nodes to be busy in only one layer change the number of people who can carry the pathogen between layers?

NoteStep 3 (extension): Does coupling change which layer drives transmission?

The tutorial’s infect_bylayer module records si.flow.main and si.flow.casual, the per-step infections attributed to each layer. Run it on both the independent model (est1, est2) and the dependent model (est.1, est.2), and compare the two main/casual shares.

Coupling separates the high-degree nodes across the layers rather than concentrating them in the same people. Form a hypothesis for how that should move the balance of transmission between the layers, then check it against the two share vectors.

NoteStep 4 (stretch): A third layer, no new machinery

Independent layers cost nothing but another netest. Add a third, one-off layer that represents momentary contacts (~edges only, a small edge target, duration = 1), estimate it as est3, and pass netsim(list(est1, est2, est3), param, init, control). Compare the epidemic with the two-layer independent run. What does adding a churning momentary layer do to early spread?

50.3 Lab Questions

NoteQuestions
  1. In Step 1, why does halving the casual layer’s duration move the peak the way it does? Relate it to the infectious period against partnership timing, the same bridging idea from the single-layer labs.
  2. In Step 2, did the cross-layer dependency raise or lower the peak, and why? Explain in terms of the number of nodes that are active in both layers and can therefore carry infection between them.
  3. In Step 3, did coupling shift the layer shares of transmission, and by how much? Why would separating the high-degree nodes across layers change which layer transmits more, even if total prevalence barely moves?
  4. In Step 4, what did the momentary layer add, and when is a duration = 1 layer a defensible model of a real contact process rather than a modeling convenience?

50.4 Additional Exploration

After the four steps, you could push any of the models further:

  • Sweep the cross-layer target (the 10 in the dependent model’s target stats) up and down to make the coupling weaker or stronger, and watch the epidemic move between the independent and strongly-coupled extremes.
  • Give the two layers different inf.prob values by writing a transmission module that reads a per-layer probability, extending the infect_bylayer pattern.
  • Turn the SI model into an SIS or SIR by supplying a recovery module, and ask whether the layer that dominated transmission also dominates re-infection.