]> nmode's Git Repositories - Rnaught/blobdiff - R/ID.R
Create .Rbuildignore
[Rnaught] / R / ID.R
diff --git a/R/ID.R b/R/ID.R
index 7b0a1b97815cce42f9606c51aa57cd4dc685809d..cd991a43ce6e07a93be86a7833839930c22a8b24 100644 (file)
--- a/R/ID.R
+++ b/R/ID.R
@@ -9,37 +9,31 @@
 #' This method is based on an approximation of the SIR model, which is most valid at the beginning of an epidemic.\r
 #' The method assumes that the mean of the serial distribution (sometimes called the serial interval) is known.\r
 #' The final estimate can be quite sensitive to this value, so sensitivity testing is strongly recommended.\r
-#' Users should be careful about units of time (e.g. are counts observed daily or weekly?) when implementing.\r
+#' Users should be careful about units of time (e.g., are counts observed daily or weekly?) when implementing.\r
 #'\r
-#' @param NT Vector of case counts\r
-#' @param mu Mean of the serial distribution (needs to match case counts in time units; for example, if case counts are\r
-#'           weekly and the serial distribution has a mean of seven days, then \code{mu} should be set to one, if case\r
-#'           counts are daily and the serial distribution has a mean of seven days, then \code{mu} should be set to seven)\r
+#' @param NT Vector of case counts.\r
+#' @param mu Mean of the serial distribution. This needs to match case counts in time units. For example, if case counts\r
+#'           are weekly and the serial distribution has a mean of seven days, then \code{mu} should be set to one If case\r
+#'           counts are daily and the serial distribution has a mean of seven days, then \code{mu} should be set to seven.\r
 #'\r
-#' @return \code{ID} returns a list containing the following components:  \code{Rhat} is the estimate of R0 and\r
-#'         \code{inputs} is a list of the original input variables \code{NT, mu}.\r
+#' @return \code{ID} returns a single value, the estimate of R0.\r
 #'\r
 #' @examples\r
-#'\r
 #' ## ===================================================== ##\r
 #' ## Illustrate on weekly data                             ##\r
 #' ## ===================================================== ##\r
 #'\r
 #' NT <- c(1, 4, 10, 5, 3, 4, 19, 3, 3, 14, 4)\r
 #' ## obtain Rhat when serial distribution has mean of five days\r
-#' res1 <- ID(NT=NT, mu=5/7)\r
-#' res1$Rhat\r
+#' ID(NT=NT, mu=5/7)\r
 #' ## obtain Rhat when serial distribution has mean of three days\r
-#' res2        <- ID(NT=NT, mu=3/7)\r
-#' res2$Rhat\r
+#' ID(NT=NT, mu=3/7)\r
 #'\r
 #' ## ========================================================= ##\r
 #' ## Compute Rhat using only the first five weeks of data      ##\r
 #' ## ========================================================= ##\r
 #'\r
-#'\r
-#' res3 <- ID(NT=NT[1:5], mu=5/7)              # serial distribution has mean of five days\r
-#' res3$Rhat\r
+#' ID(NT=NT[1:5], mu=5/7) # serial distribution has mean of five days\r
 #'\r
 #' @export\r
 ID <- function(NT, mu) {\r
@@ -50,5 +44,5 @@ ID <- function(NT, mu) {
 \r
     R0_ID <- exp(sum(y) / TT)\r
 \r
-    return(list=c(Rhat=R0_ID, inputs=list(NT=NT, mu=mu)))\r
+    return(R0_ID)\r
 }\r