Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(EpiNow2)
- library(patchwork)
- library(xlsx)
- df <- read.xlsx("Wave2_Raw.xlsx", sheetIndex = 1)
- # set number of cores to use
- old_opts <- options()
- options(mc.cores = 8)
- # construct example distributions
- generation_time <- get_generation_time(disease = "SARS-CoV-2", source = "ganyani")
- incubation_period <- get_incubation_period(disease = "SARS-CoV-2", source = "lauer")
- reporting_delay <- list(mean = convert_to_logmean(3,1),
- mean_sd = 0.1,
- sd = convert_to_logsd(3,1),
- sd_sd = 0.1, max = 15)
- # example case data
- reported_cases <- df[1:35, ]
- # estimate Rt and nowcast/forecast cases by date of infection
- out1 <- epinow(
- horizon = 15,
- reported_cases = reported_cases,
- generation_time = generation_time,
- delays = delay_opts(incubation_period, reporting_delay),
- rt = rt_opts(prior = list(mean = 2, sd = 0.2), future = "project"),
- stan = stan_opts(cores = 12),
- verbose = interactive()
- )
- # summary of the latest estimates
- summary(out1)
- # plot estimates
- plot(out1)
Advertisement
Add Comment
Please, Sign In to add comment