SIR_FixedRecovery: SIR with a fixed recovery interval

class epydemic.SIR_FixedRecovery

The Susceptible-Infected-Removed compartmented model of disease, in the variation where the time spent infected is fixed rather than happening with some probability.

Models of this kind have slightly more predictable behaviour (since they use a fixed rather than randomly-distributed recovery time), and so can be useful for some kinds of analysis. For example, Newman uses fixed-time recovery for his seminal analysis of epidemic spreading processes.

Additional parameters and node attributes

Instead of taking a recovery probability (as defined by SIR.P_REMOVE), SIR_FixedRecovery accepts a fixed time interval over which an infected node will remain infected before being removed.

SIR_FixedRecovery.T_INFECTED = ‘tInfected’

Parameter for the time spent infected before removal/recovery.

We also record the infection time of a node explicitly:

SIR_FixedRecovery.INFECTION_TIME = ‘infection_time’

Attribute recording when a node became infected

Building the model

SIR_FixedRecovery.build(params)

Build the variant SIR model. The difference between this and the reference SIR model is that only infection events happen probabilistically, with removal events happening on a fixed schedule depending on the T_INFECTED parameter.

Parameters:params – the model parameters

Setup and events

In setting up the model, we need an additional step to make sure that any nodes initially infected are set to be removed at the appropriate simulation time.

SIR_FixedRecovery.setUp(dyn, g, params)

After setting up as normal, post remove events for any nodes that are initially infected.

Parameters:
  • dyn – the dynamics
  • g – the network
  • params – the simulation parameters

Only a single event method is needed, with SIR.remove() being inherited.

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

Perform the normal infection event, and then post an event to remove the infected node at the appropriate time.

Parameters:
  • dyn – the dynamics
  • t – the simulation time
  • g – the network
  • e – the edge transmitting the infection, susceptible-infected