malopezcruz / Rt_estimation

Code to test Rt estimates against synthetic data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code for analyses and figures shown in:

Practical considerations for detectingchanges in the effective reproductive number, Rt.

Code by Katie Gostic, Ed Baskerville and Lauren McGough.

Last updated 18-June-2020.

Click the above link to read the latest version of the manuscript. Contact kgostic@uchicago.edu with comments.

We will post the medRxiv doi once it becomes available.

This directory contains functions and wrappers used to perform analyses:

  • simulation.R - code to generate synthetic data using an SIR or SEIR-type model, deterministic or stochastic.
  • funs_simulation-sweep.R - wrapper functions for epidemic simulation.
  • infer_times_of_infection_observation.R - functions to infer times of observation from SEIR times of infection, and to infer times of infection from times of observation by (1) drawing samples from a known delay distribution, or (2) shifting back in time by the mean delay to observation.
  • rtlive.R and rtlive.stan together provide code to reporduce an adaptation of the Bettencourt & Ribeiro method for Rt estimation popularized by rt.live.
  • util.R - various utility functions, including wrappers to estimate Rt using the methods of Cori et al., Wallinga & Teunis, and using methods adapted from Bettencourt & Ribeiro by rt.live. The first two methods are implemented in the package EpiEstim. The final method uses the rstan implementation above.
  • caseR.R - Functions to calculate the exact case reproductive number within the synthetic data (dahsed black lines shown in Fig. 2 and Fig. B.2).
  • Rc_math.Rmd - Notes on the math used to calculate the case reproductive number exactly.

This directory contains scripts and notebooks used to run analyses and generate figures:

Workflow:

  • 01-simulate_data.R - Specify inputs, generate synthetic data and save to a directory called R0-xx/.
  • 02-Analyze_synthetic_data.Rmd - Annotated code performs the analyses and makes all plots shown in Fig. 2, 5 and 6, and appendix Fig. B.3.
  • 02-make_Fig_2_appendix.Rmd - Code performs analyses and generates Fig. B2, an alternate version of Fig. 2 in the main text, which compares the performance of Cori, Wallinga and Teunis, and Bettencourt and Ribeiro when the time series is truncated as Rt rises or falls.
  • 03-Make_Fig_4.Rmd - Annotated code performs the analyses and makes all plots shown in Fig. 4.
  • 04-Make_Fig_deconvolution.Rmd - Annotated code performs the analyses and makes the plot shown in the appendix, a tutorial on why deconvolution methods are needed.

About

Code to test Rt estimates against synthetic data


Languages

Language:R 97.0%Language:Stan 3.0%