This repository contains estimates of the time-varying reproduction number for every country in the world listed in the ECDC Covid-19 data source and subnational estimates for 9 countries.
Summarised estimates as csv's can be found in the **/summary folders. National estimates can be found in the national folder and subnational estimates in the subnational/country subfolder depending on the country of interest.
All regions have Rt estimates based on case counts. In some regions, we also separately estimate Rt using counts of hospital admissions or deaths. The differences between each of these estimates might suggest uneven or changing transmission by age and/or severity in the general population. For more on the influence and different uses of data source on Rt, see here.
This repository only stored the most recent forecasts (a rolling 14-day window). To reconstruct a complete historical time series of all forecasts (e.g., for retrospective forecast evaluation), you can use the R function in this gist which:
- Queries the git history for all commits that modified a given forecast CSV file
- Downloads the data from each historical commit
- Combines overlapping estimates by taking medians
Example usage:
# Install required packages
# install.packages(c("gh", "readr", "dplyr", "tidyr"))
source("https://gist.githubusercontent.com/sbfnk/d2900c745312219e3e48e08adde47cde/raw/get_covid19_nowcasts.R")
# Get historical Rt estimates for a country
estimates <- get_covid19_nowcasts(
dataset = "national/cases",
variable = "rt",
earliest_date = "2020-08-30"
)If you have any questions about reconstructing historical data, please open an issue.
Estimates are generated using {EpiNow2} and presented on epiforecasts.io/covid (which also outlines the method used). If using these estimates please consider citing our associated paper.
To confirm the latest version check the production date in the metadata tab on the relevant github link. Alternatively check the Version tab to see how recently it was produced (Note EST timezone).
- Clone the repository (This results in shallow clone with just the HEAD commit, remove the
--depthflag for a full clone but note that this will take some time as the full history is large).
git clone --depth 1 https://github.com/epiforecasts/covid-rt-estimates.gitRun the following on the command line replacing path-to-key, username@public-ip-of-server, github-username, and github-pat with your information. Note this is not a secure way of transferring your GitHub PAT.
curl --fail https://raw.githubusercontent.com/epiforecasts/covid-rt-estimates/master/bin/update-via-ssh.sh > update-via-ssh.sh
sudo bash update-via-ssh.sh path-to-key username@public-ip-of-server github-username github-patSee bin/update-via-ssh.sh for details on what this script is doing and the more detailed step by step instructions below.
- Log in to GitHub Docker package repository.
docker login docker.pkg.github.com- (Optional - must be done at least once) Update the docker container (by default this pulls a built image passing
"build"instead triggers a build based on local files).
sudo bash bin/update-docker.sh- Run the following in a bash terminal (see
docker logs covidrtestimatesfor runtime information).
sudo bash bin/update-via-docker.sh- (Optional) Build the docker container locally.
docker build . -t covidrtestimates- (Optional). Alternatively pull the built docker container.
docker pull docker.pkg.github.com/epiforecasts/covid-rt-estimates/covidrtestimates:latest
docker tag docker.pkg.github.com/epiforecasts/covid-rt-estimates/covidrtestimates:latest covidrtestimates- Update the estimates (see
docker logs covidrtestimatesfor runtime information).
# This command uses the code that ships with in the docker image. You can use
# your own version by mounting it in the container
sudo docker run -d --user rstudio --name covidrtestimates covidrtestimates /bin/bash bin/update-estimates.sh- Install dependencies.
devtools::install_dev_deps()- Run
Rscript R/run-region-updates.R.
Adding --help will show documentation and the command options. This can run all or some regions and subregions, control logging, exclude unstable regions and set the maximum execution time for each set of analysis.
Note: Currently regions are either global or country level but the region/subregion pattern could be reused on any level of parent/child geographic dataset.
A timing log will be output and updated in runtimes.csv. Times of -1 = error and 999999 = killed by timeout
This analysis was developed in a docker container based on the epinow2 docker image.
To build the docker image run (from the covid-rt-estimates directory):
docker build . -t covidrtestimatesAlternatively to use the prebuilt image first login into the GitHub package repository using your GitHub credentials (if you have not already done so) and then run the following:
# docker login docker.pkg.github.com
docker pull docker.pkg.github.com/epiforecasts/covid-rt-estimates/covidrtestimates:latest
docker tag docker.pkg.github.com/epiforecasts/covid-rt-estimates/covidrtestimates:latest covidrtestimatesTo run the docker image run:
docker run -d -p 8787:8787 --name covidrtestimates -e USER=covidrtestimates -e PASSWORD=covidrtestimates covidrtestimatesThe rstudio client can be found on port :8787 at your local machines ip. The default username:password is covidrtestimates:covidrtestimates, set the user with -e USER=username, and the password with - e PASSWORD=newpasswordhere. The default is to save the analysis files into the user directory.
To mount a folder (from your current working directory - here assumed to
be tmp) in the docker container to your local system use the following
in the above docker run command (as given mounts the whole covidrtestimates
directory to tmp).
--mount type=bind,source=$(pwd)/tmp,target=/home/covidrtestimatesTo access the command line run the following:
docker exec -ti covidrtestimates bashTo add another country see SMG.md