T5 - Interventions (vaccination)

This tutorial shows how to use a simple vaccination, that acts independently of any environmental intervention.

Products and interventions

In addition to direct modification of environmental shedding (previous tutorial), Typhoidsim has implemented a few products, that can be used in combination with different types of interventions. For instance a vaccine product like typhoid_vaccine() can be used in combination with

  • routine_vx() for routine vaccination
  • campaign_vx() for one-off campaigns
  • vaccination_with_waning() for a purpose-built implementation of typhoid vaccine schedules with optional age-specific waning

The next tutorial will describe diagnostic and screening interventions.

import starsim as ss
import typhoidsim as ty

# Define high-level simulation parameters
pars = dict(
    start    = 2000,  # Starting year
    dur      = 2.0,   # Duration of the simulation in years
    dt       = 7.0/365.0,     # Timestep of 1 week, expressed in years
    verbose  = 0,             # Do not print details of the run
)

# The population
ppl = ss.People(50_000)

# Person to person transmission
random_p2p = ss.RandomNet({'n_contacts': 10})

# The disease
typhoid = ty.Typhoid(pars={'tppi':0.1, 'init_seroprev':0.8, 'init_prev':0.001})

# Create products
vax1 = ty.typhoid_vaccine(efficacy=0.4)
vax2 = ty.typhoid_vaccine(efficacy=0.8)

# Create the interventions
my_intervention_vax1 = ss.routine_vx(
    start_year=2000,     # Begin vaccination in 2000
    prob=0.2,            # 20% coverage
    product=vax1         # Use vax 1
)

# Create the interventions
my_intervention_vax2 = ss.routine_vx(
    start_year=2000,     # Begin vaccination in 2000
    prob=0.2,            # 20% coverage
    product=vax2         # Use vax 2
)

# Now create two sims: a baseline sim and one with the intervention
sim_base = ss.Sim(pars=pars, 
                  people=ppl, 
                  networks=random_p2p, 
                  diseases=typhoid)
sim_base.run()

sim_vax1 = ss.Sim(pars=pars, 
                  people=ppl, 
                  networks=random_p2p, 
                  diseases=typhoid, 
                  interventions=my_intervention_vax1)
sim_vax1.run()
sim_vax2 = ss.Sim(pars=pars, 
                  people=ppl, 
                  networks=random_p2p, 
                  diseases=typhoid,
                  interventions=my_intervention_vax2)
sim_vax2.run()
Sim(n=50000; 2000—2002.0; networks=randomnet; diseases=typhoid; interventions=routine_vx)
sim_base.plot()
Figure(1024x768)

sim_vax1.plot()
Figure(1024x768)

sim_vax2.plot()
Figure(1024x768)

import matplotlib.pyplot as plt

res_base = sim_base.results
res_vax1 = sim_vax1.results
res_vax2 = sim_vax2.results

plt.figure()
plt.plot(res_base.timevec, res_base.typhoid.new_infections, label='Baseline')
plt.plot(res_vax1.timevec, res_vax1.typhoid.new_infections, label='Vax 1')
plt.plot(res_vax1.timevec, res_vax2.typhoid.new_infections, label='Vax 2')

plt.axvline(x=2000, color='k', ls='--')
plt.title('New infections')
plt.legend()
plt.show()