Last active
April 25, 2020 17:27
-
-
Save vjcitn/48fdf3ecd17d15bcf6771e8f1efd2fbe to your computer and use it in GitHub Desktop.
highly specialized function to demonstrate how to produce an estimated Rt based on JHU confirmed case time-series
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sars2pack) | |
easyRt = function(alpha3="ITA", src = (suppressWarnings(enriched_jhu_data())), | |
init = "2020-03-01", ...) { | |
cur = cumulative_events_ejhu(src, eventtype="confirmed", | |
alpha3=alpha3) | |
inc = form_incident_events( trim_from (cur, init ) ) | |
newd = data.frame(I=inc$count, dates=inc$dates) | |
EpiEstim::estimate_R(newd, ...) | |
} | |
rtBya3 = function(a3="ITA") { | |
data("Flu2009", package="EpiEstim") | |
easyRt(alpha3=a3, method = "non_parametric_si", | |
config = EpiEstim::make_config(list(si_distr = Flu2009$si_distr))) | |
} | |
chk = rtBya3() | |
plot(chk) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment