Epidemic Models

36-467/667, Fall 2020

10 November 2020 (Lecture 20)

Previously

“SIR” Epidemic Model

Stochastic form of the SIR model (1)

Stochastic form of the SIR model (2)

The SIR model is a Markov model

SIR is easy to simulate

sim.SIR <- function(n, beta, gamma, s.initial = n - 1, i.initial = 1, r.initial = 0, 
    T) {
    stopifnot(s.initial + i.initial + r.initial == n)
    states <- matrix(NA, nrow = 3, ncol = T)
    rownames(states) <- c("S", "I", "R")
    states[, 1] <- c(s.initial, i.initial, r.initial)
    for (t in 2:T) {
        contagions <- rbinom(n = 1, size = states["S", t - 1], prob = beta * states["I", 
            t - 1]/n)
        removals <- rbinom(n = 1, size = states["I", t - 1], prob = gamma)
        states["S", t] <- states["S", t - 1] - contagions
        states["I", t] <- states["I", t - 1] + contagions - removals
        states["R", t] <- states["R", t - 1] + removals
    }
    return(states)
}

What One Simulation Looks Like

Multiple Simulations with the Same Settings

What If We Make Contagion Harder?

Maybe Not Quite That Much Harder?

Go Back to the Original Ease of Contagion, But Make Removal Faster