]> nmode's Git Repositories - Rnaught/commitdiff
Update seqB documentation
authorNaeem Model <me@nmode.ca>
Mon, 12 Feb 2024 00:05:56 +0000 (00:05 +0000)
committerNaeem Model <me@nmode.ca>
Mon, 12 Feb 2024 00:05:56 +0000 (00:05 +0000)
R/seq_bayes.R
man/seq_bayes.Rd

index 2f871211a085f210215abc0dbef8ce1fff6bd764..59b7b4b0a107f1bec314ea3fa63b69cbc235632a 100644 (file)
@@ -45,7 +45,7 @@
 #' @return If `post` is identical to `TRUE`, a list containing the following
 #'   components is returned:
 #'   * `supp` - the support of the posterior distribution of R0
-#'   * `pmf` - the probability mass function of the posterior distribution
+#'   * `pmf` - the probability mass function of the posterior distribution of R0
 #'
 #'   Otherwise, if `post` is identical to `FALSE`, only the estimate of R0 is
 #'   returned. Note that the estimate is equal to `sum(supp * pmf)` (i.e., the
 #' # believed to be at most 4.
 #' estimate <- seq_bayes(cases, mu = 1, kappa = 4)
 #'
-#' # Same as above, but return the posterior distribution instead of the
+#' # Same as above, but return the posterior distribution of R0 instead of the
 #' # estimate.
 #' posterior <- seq_bayes(cases, mu = 1, kappa = 4, post = TRUE)
 #'
+#' # Display the support and probability mass function of the posterior.
+#' posterior$supp
+#' posterior$pmf
+#'
 #' # Note that the following always holds:
 #' estimate == sum(posterior$supp * posterior$pmf)
 seq_bayes <- function(cases, mu, kappa = 20, post = FALSE) {
index 8dc824c1c064c1c6fe11e221ba72b80f073a4933..9cb6db99cc1fdc5b5acaa1ccceefb381b64a5b95 100644 (file)
@@ -30,7 +30,7 @@ If \code{post} is identical to \code{TRUE}, a list containing the following
 components is returned:
 \itemize{
 \item \code{supp} - the support of the posterior distribution of R0
-\item \code{pmf} - the probability mass function of the posterior distribution
+\item \code{pmf} - the probability mass function of the posterior distribution of R0
 }
 
 Otherwise, if \code{post} is identical to \code{FALSE}, only the estimate of R0 is
@@ -80,10 +80,14 @@ seq_bayes(cases, mu = 3 / 7)
 # believed to be at most 4.
 estimate <- seq_bayes(cases, mu = 1, kappa = 4)
 
-# Same as above, but return the posterior distribution instead of the
+# Same as above, but return the posterior distribution of R0 instead of the
 # estimate.
 posterior <- seq_bayes(cases, mu = 1, kappa = 4, post = TRUE)
 
+# Display the support and probability mass function of the posterior.
+posterior$supp
+posterior$pmf
+
 # Note that the following always holds:
 estimate == sum(posterior$supp * posterior$pmf)
 }