From 0a8692bf4eaecccb4836cfc4153166cfb2f94711 Mon Sep 17 00:00:00 2001 From: Naeem Model Date: Wed, 29 Jan 2025 01:32:27 +0000 Subject: Update vignettes and create 'Get started' vignette --- vignettes/Rnaught.Rmd | 86 ++++++++++++++++++++++++++++++++++++++++++++ vignettes/seq_bayes_post.Rmd | 9 ++--- vignettes/wp_serial.Rmd | 4 +-- 3 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 vignettes/Rnaught.Rmd diff --git a/vignettes/Rnaught.Rmd b/vignettes/Rnaught.Rmd new file mode 100644 index 0000000..4eb129d --- /dev/null +++ b/vignettes/Rnaught.Rmd @@ -0,0 +1,86 @@ +--- +title: "Introduction to Rnaught" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Introduction to Rnaught} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +The goal of Rnaught is to provide a a collection of methods for estimating the +[basic reproduction number]( +https://en.wikipedia.org/wiki/Basic_reproduction_number) ($R_0$) of infectious +diseases. + + +## Estimators + +The following estimators are currently available: + + * `id()`: Incidence Decay (ID) + * `idea()`: Incidence Decay and Exponential Adjustment (IDEA) + * `seq_bayes()`: Sequential Bayes (seqB) + * `wp()`: White and Pagano (WP) + +Every estimator employs its own model, has its own set of parameters, and is +better suited to particular scenarios. You should consult each method's +documentation for technical details. Below is a short example computing +estimates for a given set of case counts. + +```{r} +library(Rnaught) + +# Weekly case counts. +cases <- c(1, 4, 10, 5, 3, 4, 19, 3, 3, 14, 4) + +# Compute estimates of R0, assuming a serial interval of five days. +mu <- 5 / 7 + +id(cases, mu) +idea(cases, mu) +seq_bayes(cases, mu) +wp(cases, mu) +``` + + +## Web Application + +This serves as a graphical interface for the package. An instance is available +at . It can also be run locally by +invoking the `web()` function. + +Datasets can be uploaded as a CSV file, or entered manually. The data is +visualized in the application through plots that show the case counts (either +daily or weekly). If multiple datasets are added, the trends corresponding to +these datasets are populated in the same plot. This plot can be exported as a +PNG image. Furthermore, the datasets entered can be exported as a CSV. + +Two sample datasets are included: weekly Canadian COVID-19 case count data from +March 3rd, 2020 to March 31st, 2020, and weekly Ontario COVID-19 case count data +from March 3rd, 2020 to March 31st, 2020. + +To estimate the basic reproductive number, the user can choose their preferred +estimator, and if applicable, must enter the known +[serial interval](https://en.wikipedia.org/wiki/Serial_interval) prior to +estimation. If multiple estimates of the basic reproductive number are +calculated, they are all included in a table where each row represents an +estimate. If multiple datasets are being considered, the basic reproduction +number is estimated for all datasets and the columns of the table correspond to +the different datasets. The table also consists of a column corresponding to the +value of the serial interval. This table can also be exported as a CSV. + + +## Datasets + +The package includes two datasets provided by the [COVID-19 Canada Open Data +Working Group](https://github.com/ccodwg/CovidTimelineCanada). +These report the national and provincial case counts of COVID-19 in Canada. For +details, see `?COVIDCanada` and `?COVIDCanadaPT`. They are also available as +[CSV files](https://github.com/MI2YorkU/Rnaught/tree/master/inst/extdata). diff --git a/vignettes/seq_bayes_post.Rmd b/vignettes/seq_bayes_post.Rmd index 7c614ba..4a97874 100644 --- a/vignettes/seq_bayes_post.Rmd +++ b/vignettes/seq_bayes_post.Rmd @@ -19,10 +19,11 @@ library(Rnaught) ``` In the Sequential Bayes method, the probability distribution of R0 is updated -sequentially from one case count to the next, starting from a (discretized) uniform prior. By -default, the function `seq_bayes` returns the mean of the last updated posterior -distribution as its estimate of R0. However, by setting the parameter `post` to -`TRUE`, it is possible to return the final distribution itself: +sequentially from one case count to the next, starting from a (discretized) +uniform prior. By default, the function `seq_bayes()` returns the mean of the +last updated posterior distribution as its estimate of R0. However, by setting +the parameter `post` to `TRUE`, it is possible to return the final distribution +itself: ```{r} # Daily case counts. diff --git a/vignettes/wp_serial.Rmd b/vignettes/wp_serial.Rmd index 63f89a7..6a87be8 100644 --- a/vignettes/wp_serial.Rmd +++ b/vignettes/wp_serial.Rmd @@ -24,8 +24,8 @@ when another individual who is infected by the infector becomes symptomatic. The serial interval refers to a range of likely values from this distribution, although it is typically reported as the mean. -In the White and Pagano method, the serial distribution is assumed to be a -discretized, finite version of a gamma distribution. Setting the parameter +In the White and Pagano method, `wp()`, the serial distribution is assumed to be +a discretized, finite version of a gamma distribution. Setting the parameter `serial` to `TRUE` causes this discretized distribution to be returned in addition to the estimate of R0. Furthermore, the method can be used whether or not the serial interval (specified as the parameter `mu`) is known. When `mu` is -- cgit v1.2.3