Skip to content

Instantly share code, notes, and snippets.

View ybryan's full-sized avatar
🤘

Bryan Yu ybryan

🤘
View GitHub Profile
library(ggplot2)
library(deSolve)
library(tidyr)
theme_set(theme_minimal())
# I: infected, S: susceptible, R: recovered
sir <- function(t, state, pars) {
with(as.list(c(state, pars)), {
N <- S + I + R
dSdt <- -b * I/N * S