ModelSIRMixing

Contents

ModelSIRMixing#

class epiworldpy.epimodels.ModelSIRMixing(self: epiworldpy._core.epimodels.ModelSIRMixing, vname: str, n: SupportsInt | SupportsIndex, prevalence: SupportsFloat | SupportsIndex, transmission_rate: SupportsFloat | SupportsIndex, recovery_rate: SupportsFloat | SupportsIndex, contact_matrix: collections.abc.Sequence[SupportsFloat | SupportsIndex])#

Bases: Model

Susceptible-Infected-Recovered (SIR) model with mixing between groups.

States: Susceptible, Infected, Recovered.

Agents are split into groups with Entity objects (add them with add_entity() before running), and contacts between groups follow contact_matrix. The model creates its n agents itself.

Create a SIR model with mixing.

Parameters:
  • vname (str) – Name of the virus.

  • n (int) – Number of agents.

  • prevalence (float) – Initial proportion of agents with the virus.

  • transmission_rate (float) – Probability of transmission per contact, between 0 and 1.

  • recovery_rate (float) – Daily probability of recovery, between 0 and 1.

  • contact_matrix (list of float) – Flattened G x G matrix, where G is the number of entities; entry (i, j) is the expected number of daily contacts an agent in group i has with agents in group j, so the row sums are the expected contacts per day of each group. The matrix is stored by columns: flatten a NumPy array with m.flatten(order="F").