knitr::opts_chunk$set(echo = TRUE)
library(dplyr) library(tibble) library(ggplot2) library(lubridate) library(patchwork) library(EpiEstim) a <- tibble(R= (2.5 - (1:100)/50), I=round((1:100)^R), dates=ymd("2020-01-01") + days(1:100), cumI=cumsum(I), col = if_else(I == max(I), 1, 0)) estR <- estimate_R(select(a, dates, I), method="parametric_si", config = make_config(list( mean_si = 7.0, std_si = 3.0))) p0 <- ggplot(a, aes(x=cumI, y=I, col=col)) + geom_point() + scale_y_log10() + scale_x_log10() + labs(title="Log-log") p1 <- ggplot(a, aes(x=cumI, y=I, col=col)) + geom_point() + scale_y_continuous() + scale_x_continuous() + labs(title="Lin-Lin") p2 <- ggplot(a, aes(x=dates, y=I, col=col)) + geom_point() + labs(title="Linear incidence vs time") p3 <- ggplot(a, aes(x=dates, y=R, col=col)) + geom_point() + labs(title="Generating R vs time") p0 / p1 / p2 / p3 / plot(estR, "R") + scale_y_log10()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.