Description Usage Arguments Value Examples
Estimate the time varying R0 - using EpiEstim
1 2 3 4 5 6 7 8 9 10 11  | 
cases | 
 A dataframe containing a list of local cases with the following variables:   | 
generation_times | 
 A matrix with columns representing samples and rows representing the probability of the generation timebeing on that day.  | 
rt_prior | 
 A list defining the reproduction number prior containing the mean (  | 
windows | 
 Numeric vector, windows over which to estimate time-varying R. The best performing window will be selected per serial interval sample by default (based on which window best forecasts current cases).  | 
gt_samples | 
 Numeric, the number of samples to take from the generaiton times supplied  | 
rt_samples | 
 Numeric, the number of samples to take from the estimated R distribution for each time point.  | 
min_est_date | 
 Date to begin estimation.  | 
forecast_model | 
 An uninitialised bsts model passed to   | 
horizon | 
 Numeric, defaults to 0. The horizon over which to forecast Rts and cases.  | 
A list of data.table's containing the date and summarised R estimate and optionally a case forecast
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  | ## Nowcast Rts                  
estimates <- estimate_R0(cases = EpiSoon::example_obs_cases, 
                         generation_times = as.matrix(EpiNow::covid_generation_times[,2]), 
                         rt_prior = list(mean_prior = 2.6, std_prior = 2),
                         windows = c(1, 3, 7), rt_samples = 10, gt_samples = 1)
                         
                         
estimates$rts
 
## Not run:  
## Nowcast Rts, forecast Rts and the forecast cases
estimates <- estimate_R0(cases = EpiSoon::example_obs_cases, 
                         generation_times = as.matrix(EpiNow::covid_generation_times[,1]), 
                         rt_prior = list(mean_prior = 2.6, std_prior = 2),
                         windows = c(1, 3, 7), rt_samples = 10, gt_samples = 20,
                         min_est_date =  as.Date("2020-02-18"),
                         forecast_model = function(...){
                              EpiSoon::fable_model(model = fable::ETS(y ~ trend("A")), ...)
                              },
                         horizon = 14)
                                           
## Rt estimates and forecasts
estimates$rts
## Case forecasts
estimates$cases
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.