bulk_estimate_Rt | R Documentation |
This function can estimate R(t) curves for all locations in a case-tracking dataset and return a stacked data.frame with the location details included. It is a convenience function for getting R(t) over a large dataset. Right now, nothing is done in "parallel", so this function is not going to be much (or any) faster than running on each location in a case-tracking dataset independently and then combining.
bulk_estimate_Rt( df, grouping_columns = setdiff(colnames(df), c(cases_column, date_column)), cases_column = "count", date_column = "date", ... )
df |
a data.frame containing at least a date column and a cases column, describing the cumulative cases at each date. The data.frame may contain additional columns that can be used to "group" the dates and cases to produce a set of R(t) curves. |
grouping_columns |
character() vector specifying the grouping columns that
will break |
cases_column |
character(1) the column in |
date_column |
character(1) the column in |
... |
passed on to |
A "stacked" data.frame with the outputs from the R(t) estimation process
and associated location information. The actual columns returned for the
R(t) estimate will depend on the estimation_family
parameter as well
as other parameters specific to each method.
Sean Davis seandavi@gmail.com
Other analysis:
estimate_Rt()
Other case-tracking:
align_to_baseline()
,
beoutbreakprepared_data()
,
combined_us_cases_data()
,
coronadatascraper_data()
,
covidtracker_data()
,
ecdc_data()
,
estimate_Rt()
,
jhu_data()
,
nytimes_county_data()
,
owid_data()
,
plot_epicurve()
,
test_and_trace_data()
,
usa_facts_data()
,
who_cases()
library(dplyr) nyt = nytimes_state_data() %>% dplyr::filter(subset=='confirmed') %>% dplyr::arrange(state,date) head(nyt) # this may produce warnings, but the processing # will still be correct.... res = bulk_estimate_Rt(head(nyt,500), estimation_family='epiestim',method = 'parametric_si', config = list(mean_si=3.96, std_si=4.75)) head(res) colnames(res) library(ggplot2) ggplot(res, aes(x=date_start,y=1/`Mean(R)`,color=state)) + geom_smooth(se=FALSE) + ylim(c(0,1.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.