# Infection Modeling — Part 1

An infected node is removed from the network after r time-steps, signifying either recovery and post-infection immunity, or death, depending on the pathogen being modeled and/or how optimistic you, the modeler, are feeling.Unlike the population-based SIR model, this is a stochastic process to be modeled via Monte Carlo simulation: repeated simulations with varying input parameters to generate a distribution of possible outcomes, rather than generating a single deterministic outcome..That is, p and r are generated from a probability distribution for each node, resulting in different outcomes for each simulation.Construct the Infection SimulationAs an example of this, we will use a 62 node social network constructed from interactions within a pod of dolphins..Let’s take the example of an infection that has an average recovery time r of 30 days (standard deviation of 8 days), and an average transmission probability p of 6% (standard deviation of 1%) that decays by 10% each day of a node’s infection..Let’s further take the scenario that two nodes (n=2), chosen randomly, are the source of the infection in the network.Following the modeling procedure above, and repeated 1,000 times, results in an average SIR response shown in the top graph of Figure 2..The probability density function of the total number of infected nodes during the epidemic is shown in the lower graph.Figure 2: (above) averaged predictions of fraction of the population susceptible, infected, and removed..(below) PDF of the total number of nodes infected during the outbreak..The time span of the simulation is 150 days.The averaged SIR response from the Monte Carlo simulations is quite dramatic, with nearly 80 percent of the population becoming infected at some point..The PDF of the final “removed” number shows how it is distributed among the 1,000 simulations..As can be seen in Figure 3, it roughly fits to a skewed normal distribution, with an average total number of infected nodes of 50 (standard deviation of 3.5).Figure 3: PDF of total infected nodes roughly fits to a skewed normal distributionThe worst case scenario was the infection reaching 59 out of the 62 nodes..But as far as tail events go, the lower-impact outliers seem to be more prevalent in the simulated outcomes than the high-impact outliers.Solving the SIR differential equations in (1) for beta and gamma lead to the equations shown below in (2)..As t increases, beta and gamma converge to their respective values.Equation 2: Solving SIR equations from (1) for beta and gammaWith beta and gamma calculated from the Monte Carlo simulation results, we can then calculate the R0 value for each simulation to get an idea of how infections this pathogen may be in the local population..The PDF of the calculated R0 values for the simulations is shown below in Figure 4.Figure 4: Probability distribution of R0 calculated from Monte Carlo simulationsThe Monte Carlo simulations show that the R0 value for this pathogen in the network can be is most likely to be between 2 and 3, comparative to that of the H1N1 Flu of 1918.. More details