# SIR Compartmental Model

The SIR model is a compartmental model which is comprised of three main compartments: susceptible (S), infected (I), and recovered (R). Additionally, discovered (D) and hidden (H) compartments keep track of the number of infected or recovered that have been discovered. The population is divided into “groups” which interact with one another. Every generation in the simulation, some people move from susceptible to infected based on internal group interactions and an external outside rate of infection. The length of a generation is referred to as a generation time. A person infected in one generation will be recovered by the next. Furthermore, people move from hidden to discovered based on an infection discovery and recovered discovery fraction. The infection discovery fraction denotes the fraction of infected population that is discovered in the generation in which they are infected. The recovered discovery fraction denotes the fraction of the hidden recovered population that become discovered in every generation. This is non-standard and arises from a desire to model the “discovery” of infections as a result of testing.

Mathematically, let be the number of groups and be the
number generations to simulate. Let , , ,
, and be by matrices such that
is the number of people in group susceptible during
generation . State variables in SIR models are usually **fractions**
of an overall population but these are **counts**. Let be a
by matrix encoding the interactions between groups such that
is the number of infections in group caused by a
single infection in group . Let be the vector representing
the outside rate of infection such that is the count of infections
per generation time occurring in group as a result of outside
infection. Lastly, let and be the vectors representing the
infection and recovered discovery fractions respectively.

Given a state at generation , the following state at generation is given as follows.

The `simpar.sim`

module implements this exact SIR model.