SIR: The SIR process

class epydemic.SIR

The Susceptible-Infected-Removed compartmented model of disease. Susceptible nodes are infected by infected neighbours, and recover to removed.

The Synchronous-Infected-Recovered or SIR process is one of the oldest models of disease, first arising in a paper by Kermack and McKendrick in 1927.

Nodes in the network represent individuals, with edges representing contacts between them. Each individual is assigned a dynamical state which changes according to the rules of the model.

SIR is a compartmented model of disease with three compartments:

  • Susceptible (S), when an individual be infected with the disease;
  • Infected (I), when an individual can infect neighbouring susceptible individuals; and
  • Removed (R), when an individual has recovered from the infection and neither infects nor can be infected.

Essentially a removed individual takes no further part in the dynamics.

Dynamical states

SIR simulation places nodes into one of three compartments:

SIR.SUSCEPTIBLE = ‘S’

Compartment for nodes susceptible to infection.

SIR.INFECTED = ‘I’

Compartment for nodes infected.

SIR.REMOVED = ‘R’

Compartment for nodes recovered/removed.

Parameters

The process is parameterised by three parameters:

SIR.P_INFECTED = ‘pInfected’

Parameter for probability of initially being infected.

SIR.P_INFECT = ‘pInfect’

Parameter for probability of infection on contact.

SIR.P_REMOVE = ‘pRemove’

Parameter for probability of removal.

The SIR.P_INFECTED parameter defines the proportion of nodes that are initially placed into the SIR.INFECTED compartment, with all other nodes being placed into the SIR.SUSCEPTIBLE compartment.

Dynamics

Dynamics in SIR occurs in two places:

  • At infected nodes, which which are removed with a probability given by the SIR.P_REMOVE parameter; and
  • At SI edges, where the node at one endpoint is susceptible and the node at the other is infected.

These two options define the loci for the SIR model.

SIR.SI = ‘SI’

Edge able to transmit infection.

The other locus is named SIR.INFECTED, the same as the compartment.

Building the model

Building the model creates the three epidemic compartments and installs the necessary loci and events to define the disease dynamics. The event methods are described more thoroughly below.

SIR.build(params)

Build the SIR model.

Parameters:params – the model parameters

Event methods

Event methods are defined for each of the two dynamical rules for the process: infection and removal (recovery).

SIR.infect(dyn, t, g, (n, m))

Perform an infection event. This changes the compartment of the susceptible-end node to INFECTED. It also marks the edge traversed as occupied.

Parameters:
  • dyn – the dynamics
  • t – the simulation time (unused)
  • g – the network
  • e – the edge transmitting the infection, susceptible-infected
SIR.remove(dyn, t, g, n)

Perform a removal event. This changes the compartment of the node to REMOVED.

Parameters:
  • dyn – the dynamics
  • t – the simulation time (unused)
  • g – the network
  • n – the node