Epidemic-Economic Integrated Models
“The pandemic created an externality that standard macroeconomic models cannot capture: your consumption decision imposes infection risk on others. That externality is the source of the market failure.” — Martin Eichenbaum, Sergio Rebelo, and Mathias Trabandt
Cross-reference: Principles Ch. 41 (COVID-19: SIR dynamics, lockdowns, CARES Act, vaccination) [P:Ch.41]
38.1 The Epidemiological-Economic Integration Problem¶
The COVID-19 pandemic forced macroeconomists to confront a phenomenon with no precedent in the DSGE toolkit: an infectious disease externality. Standard macroeconomic shocks — technology, demand, monetary — are transmitted through prices and interest rates. An epidemic is transmitted through physical contact: each economic transaction (going to work, shopping, socializing) carries an infection risk that the individual does not fully internalize.
This creates a specific type of market failure: contagion externality. Each agent, when choosing how much to work and consume, does not account for the infection risk they impose on others. The competitive equilibrium is inefficient: too much activity early in the epidemic, too little investment in isolation, and suboptimal timing of the return to normal activity.
The Eichenbaum–Rebelo–Trabandt (ERT, 2021) model addresses this by embedding a SIR epidemiological model inside a DSGE framework. The household’s Euler equation is modified to account for infection risk, and the social planner’s problem is solved via the Hamiltonian machinery of Chapter 11.
38.2 The SIR Model¶
The Susceptible–Infectious–Recovered (SIR) model (Kermack and McKendrick, 1927) is the foundational epidemiological compartmental model.
Definition 38.1 (SIR Model). At each date , the population is divided into three compartments:
: Susceptible — can contract the disease.
: Infectious — currently infected and contagious.
: Recovered/Removed — immune or deceased.
With (normalized population), the dynamics:
Definition 38.2 (Basic Reproduction Number). The basic reproduction number is the expected number of secondary infections generated by one infectious individual in a fully susceptible population. The epidemic grows () iff .
Theorem 38.1 (Herd Immunity Threshold). The epidemic peaks when . The herd immunity threshold (the fraction that must be immune to stop growth) is:
Proof. The epidemic peaks when : . The HIT is .
For COVID-19: (original strain), giving . For the Delta variant: –7, –.
38.3 The ERT Model: Coupling SIR to DSGE¶
Household preferences. The representative susceptible household maximizes expected lifetime utility, where the utility function accounts for infection risk:
subject to the budget constraint and the infection probability that depends on economic activity.
Infection technology. The probability that a susceptible household becomes infected depends on its own consumption and labor , and on the aggregate infection rate :
where are transmission rates from consumption contacts, work contacts, and other contacts. This specification makes infection endogenous to economic choices — a key departure from exogenous epidemiological models.
Modified SIR dynamics:
The effective transmission rate is now endogenous — it falls when households voluntarily reduce activity.
38.4 The Modified Household Euler Equation¶
The household faces an intertemporal optimization problem where infection risk enters the value function. For a susceptible household:
where is the infection probability and is the value of being infected (lower, due to illness costs).
The modified Euler equation for susceptible households:
The key modification: the household partially internalizes the cost of infection but does not internalize the infection risk imposed on others. This creates the externality.
The contagion externality. The social planner solves the same problem but includes the effect of each household’s activity on the aggregate infection rate :
The externality is negative (more activity imposes more infection risk on the susceptible population) and grows with (more infectious people → higher external cost of activity).
38.5 The Optimal Lockdown Hamiltonian¶
The social planner’s optimal lockdown problem is a continuous-time optimal control problem:
subject to SIR dynamics with endogenous transmission.
The Hamiltonian:
where , , are the costate variables (shadow values of the susceptible, infected, and recovered populations).
Theorem 38.2 (Optimal Lockdown Condition). The social planner’s optimality condition for consumption:
where the additional term captures the cost of infecting others through consumption contacts. The social planner’s optimal consumption is lower than the competitive equilibrium whenever — the optimal lockdown is an internalization of the contagion externality.
Derivation. The costate equation for : . The FOC for : , giving , so the shadow benefit of consumption () equals the net shadow cost of infection spread times the contact rate.
38.6 Numerical Solution of the ERT Model¶
The ERT model is solved as a two-point boundary value problem: initial conditions fix (epidemiological state at pandemic onset), while a terminal condition (herd immunity or vaccine arrival) fixes the endpoint.
Algorithm 38.1 (ERT Solution).
Discretize time into periods of 1 week (or 1 day for precision).
At the optimal lockdown, the household’s FOC pins as functions of the state and costate .
The costate equations provide the costate dynamics.
The system is solved by the shooting method: guess , integrate forward, adjust until the terminal condition is satisfied.
Python¶
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
# ERT model parameters
rho = 0.04/52 # weekly discount rate (4% annual)
gamma = 0.2 # recovery rate (5-week infectious period)
pi_C = 0.5e-4 # transmission per consumption contact
pi_N = 0.5e-4 # transmission per work contact
pi_0 = 0.1e-4 # background transmission
phi_labor = 2.0 # inverse Frisch elasticity
kappa_ill = 0.1 # utility loss from illness
def ert_system(t, state, lockdown_level=1.0):
"""ERT model ODEs for social planner."""
S, I, R, lam_S, lam_I = state
# Effective transmission (reduced by lockdown)
C_t = lockdown_level * 0.8 # consumption relative to normal
N_t = lockdown_level * 0.9 # labor relative to normal
beta_t = (pi_C * C_t + pi_N * N_t + pi_0)
# SIR dynamics
new_infections = beta_t * S * I
dS = -new_infections
dI = new_infections - gamma * I
dR = gamma * I
# Costate equations (simplified: lam = value loss from infection)
dlam_S = rho * lam_S + beta_t * I * (lam_S - lam_I)
dlam_I = (rho + gamma) * lam_I - kappa_ill - beta_t * S * (lam_S - lam_I)
return [dS, dI, dR, dlam_S, dlam_I]
def solve_ert(lockdown_level=1.0, T_weeks=104):
"""Solve ERT model for given lockdown intensity."""
# COVID-19 calibration (approximate)
S0 = 0.999; I0 = 0.001; R0 = 0.0
lam_S0 = -0.5; lam_I0 = -1.0 # initial costate guesses
y0 = [S0, I0, R0, lam_S0, lam_I0]
sol = solve_ivp(lambda t,y: ert_system(t, y, lockdown_level),
[0, T_weeks], y0, max_step=0.5, dense_output=True)
return sol
# Compare: no lockdown vs. optimal lockdown vs. strict lockdown
fig, axes = plt.subplots(2, 2, figsize=(12, 8))
labels = ['S (susceptible)', 'I (infected, %)', 'R (recovered)', 'GDP (relative)']
lockdowns = [(1.0, 'No lockdown'), (0.7, 'Moderate (30% reduction)'), (0.5, 'Strict (50% reduction)')]
for ld, name in lockdowns:
sol = solve_ert(lockdown_level=ld)
t = sol.t; S,I,R = sol.y[0], sol.y[1], sol.y[2]
GDP = ld * np.ones_like(t) * (1 - 0.5*I) # GDP drops with infection rate too
for ax, (data, label) in zip(axes.flat, [(S, 'S'), (I*100, 'I%'), (R, 'R'), (GDP, 'GDP')]):
ax.plot(t, {'S':S,'I%':I*100,'R':R,'GDP':GDP}[label], label=name)
for ax, label in zip(axes.flat, labels):
ax.set_title(label); ax.set_xlabel('Weeks'); ax.legend(fontsize=8)
plt.suptitle('ERT Model: SIR-Economic Coupling')
plt.tight_layout(); plt.show()
# Compute R0 and herd immunity threshold
R0 = (pi_C*0.8 + pi_N*0.9 + pi_0) / gamma
HIT = 1 - 1/R0
print(f"\nCOVID calibration:")
print(f" R₀ ≈ {R0:.2f} (data: 2-3 for original strain)")
print(f" HIT ≈ {HIT*100:.1f}% (data: ~60% for R₀=2.5)")
print(f" Peak infection share (no lockdown): {sol_no_ld.y[1].max()*100:.1f}%")Julia¶
using DifferentialEquations, Statistics
# Julia: SIR model with optimal lockdown
function sir_ode!(du, u, p, t)
S, I, R = u; beta, gamma = p
new_inf = beta * S * I
du[1] = -new_inf; du[2] = new_inf - gamma*I; du[3] = gamma*I
end
# Calibration for COVID-19 (original strain)
R0_covid = 2.5; gamma = 0.2 # 1/5 weeks recovery
beta_base = R0_covid * gamma
HIT = 1 - 1/R0_covid
println("COVID-19 SIR calibration:")
println(" R₀ = $R0_covid, HIT = $(round(HIT*100,digits=1))%")
# Solve without any lockdown
u0 = [0.999, 0.001, 0.0]
prob = ODEProblem(sir_ode!, u0, (0.0, 104.0), [beta_base, gamma])
sol = solve(prob, Tsit5(), saveat=1.0)
peak_I = maximum(sol[2,:])
println(" Peak infected (no lockdown): $(round(peak_I*100,digits=2))%")
println(" Total infected (no lockdown): $(round((1-sol[1,end])*100,digits=1))%")
# With 30% behavior reduction
beta_ld = beta_base * 0.7
prob_ld = ODEProblem(sir_ode!, u0, (0.0, 104.0), [beta_ld, gamma])
sol_ld = solve(prob_ld, Tsit5(), saveat=1.0)
println(" Peak infected (30% lockdown): $(round(maximum(sol_ld[2,:])*100,digits=2))%")38.7 Policy Experiments¶
38.7.1 Optimal Lockdown Timing¶
The optimal lockdown depends critically on the stage of the epidemic. Too early: wastes economic damage before the epidemic has spread widely. Too late: allows exponential growth that requires much more severe restrictions later.
The ERT model shows the optimal lockdown begins when the infection rate exceeds a threshold determined by the costate equation:
at which point the marginal cost of infection externality equals the marginal utility of consumption.
38.7.2 Vaccine Rollout¶
When a vaccine arrives at date with coverage (fraction vaccinated), the effective drops to . If , herd immunity is achieved and the epidemic ends. Optimal vaccine rollout prioritizes the most active (high-contact) individuals — workers in customer-facing industries — rather than the most at-risk (elderly), balancing epidemiological effectiveness with distributional equity.
38.7.3 Fiscal Stimulus¶
The CARES Act ($2 trillion) provided direct payments to households and expanded unemployment insurance. In the ERT model, direct payments increase consumption — which increases transmission if . The optimal fiscal response targets consumption that has low transmission risk (home food delivery rather than restaurant meals) while supporting incomes.
38.8 Programming Exercises¶
Exercise 38.1 (APL — SIR Simulation)¶
Implement the SIR model in APL as a scan: {sir_step ⍵}\ T ⍴ ⊂(S0, I0, R0). (a) Simulate 100 weeks with . (b) Compute the HIT numerically: find where and verify . (c) Simulate with voluntary reduction in contacts (multiply by 0.7) and compare the peak infection rate.
Exercise 38.2 (Python — Vaccine Arrival Timing)¶
Simulate the ERT model with a vaccine arriving at weeks (6, 12, 18, 24 months) with coverage. (a) For each , compute: total infections before vaccine, GDP loss, and welfare. (b) Plot the trade-off between earlier vaccine arrival and total pandemic cost. (c) Estimate the value of a 6-month acceleration in vaccine development (the “vaccine acceleration premium”) in welfare units.
Exercise 38.3 (Julia — Externality Quantification)¶
# Quantify the contagion externality
function externality_size(I_current; pi_C=5e-5, pi_N=5e-5, S=0.7)
# Marginal infection cost of consuming one unit more
# = pi_C * I * S * (value loss from infecting one person)
# Value loss per infection ≈ present value of illness duration * utility loss
value_loss_per_infection = 0.1 / 0.2 # 0.1 utility loss / 0.2 recovery rate
marginal_ext = pi_C * I_current * S * value_loss_per_infection
return marginal_ext
end
I_vals = [0.001, 0.01, 0.05, 0.10, 0.20]
println("Contagion externality (marginal cost of consuming one unit more):")
for I in I_vals
ext = externality_size(I)
println(" I = $(I*100)%: externality = $(round(ext,digits=5)) utility units")
end
println("Competitive equilibrium ignores this cost; optimal lockdown internalizes it.")Exercise 38.4 — SIR-HANK Model ()¶
Extend the ERT model to include heterogeneous households (high- vs. low-contact workers). (a) Define two types: essential workers (high , cannot work from home) and remote workers (low , can substitute home for office work). (b) The optimal lockdown imposes different restrictions on essential vs. remote workers. Derive the optimal activity level for each type using the social planner’s Hamiltonian. (c) Quantify the distributional impact: essential workers bear higher infection risk and lower income; remote workers bear lower infection risk but face consumption restrictions.
38.9 Chapter Summary¶
Key results:
The SIR model partitions the population into with dynamics , ; the basic reproduction number determines whether the epidemic grows; herd immunity threshold (Theorem 38.1).
The ERT model makes the transmission rate endogenous: ; households voluntarily reduce activity to avoid infection but do not internalize the infection externality.
The contagion externality is the additional infection risk each agent’s activity imposes on others; the social planner internalizes this, prescribing a lockdown even when private agents would not voluntarily reduce activity.
The optimal lockdown condition (Theorem 38.2): social planner’s FOC for consumption includes an externality correction proportional to — the shadow cost of spreading infection multiplied by the contact rate.
ELB + pandemic: fiscal policy is both a stabilizer (supports demand) and a public health tool (shapes the composition of spending toward low-transmission activities).
In APL: SIR is
sir_step \ T ⍴ ⊂(S0 I0 R0); the optimal lockdown uses the Hamiltonian costate equations from Chapter 11.
Next: Chapter 39 — Forecasting Inflation and GDP: Time Series vs. DSGE