knitr::opts_chunk$set(echo = FALSE)
library(RtD3) library(here) library(data.table) library(sf)
City level estimates of the time-varying reproduction number of Covid-19 produced using EpiNow2 based on data from brazil.io. Regional estimates for Brazil (along with a national estimate) are available here. Detail of the method used is given here, though the estimates shown here were derived using an approximate approach (direct de-convolution of observed cases) rather than the exact method used on epiforecasts.io and therefore should be considered indicative. The code and data supporting these estimates is available here. Estimates are available in a summarised form here.
Case data is extracted from: brazil.io
Estimates were only produced for cities with at least 1000 cases, and 90 days of data, since the start of the data extraction. All time series were truncated by 3 days to account for delayed reporting (the delay from original report to reporting in this dataset not the adjusted for delay from onset to original report). Estimates are only shown from the date when a given region reported at least 10 cases on a single day.
Data on the delay from onset to report were extracted for Brazil from here: github.com/beoutbreakprepared/nCoV2019
The delay from onset to report was assumed to be log normal and fit using a subsampled bootstrap in order to better represent the uncertainty in the distribution at any time point. See here for details.
Estimates for the incubation period and the generation time were based on those used here: epiforecasts.io
today <- Sys.Date()
# dropped as RtD3 is not functional without a shapefile and with a shapefile makes this to big to add to github. # Load shapefile geoData <- readRDS(here::here("data", "shapefile", "brazil-admin-2.rds")) # Load case data cases <- data.table::fread(here::here("data", "cases", paste0(today, ".csv"))) cases <- cases[, .(sovereignt = city, code = city_ibge_code)][, .SD[1,], by = code] # Link shapefile with case data to get region geoData <- merge(geoData, cases, by = "sovereignt", all.x = FALSE) # Load estimates rtData <- list("Cases" = RtD3::readInEpiNow2(path = here::here("data", "rt", today))) # Make interactive widget RtD3::summaryWidget(rtData = rtData, activeArea = "São Paulo", downloadUrl = "https://github.com/epiforecasts/covid-rt-brazil-subregional")
latest_date <- readRDS(here::here("data","rt", today, "latest_date.rds")) case_def <- "case" region_path <- NULL standalone <- TRUE interactive <- TRUE report_forecast <- TRUE summary_path <- file.path("data","rt", today)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.