## Calculate the herd immunity threshold for a specific value of the
## reproduction number (here 2)
R02herd_immunity_threshold(2)
## plot the relationship between R0 and herd immunity threshold
x <- seq(1.01, 15, 0.01)
plot(x, R02herd_immunity_threshold(x), type = "l",
xlab = "R0", ylab = "Herd immunity threshold")
Run the code above in your browser using DataLab