diff --git a/DESCRIPTION b/DESCRIPTION index d998b9a..f90b3b3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: bennu Title: Bayesian Estimation of Naloxone Kit Number Under-Reporting -Version: 0.1.0 +Version: 0.2.1.9000 Authors@R: c( person(given = "Mike", family = "Irvine", @@ -12,7 +12,7 @@ Authors@R: c( Description: Bayesian model and associated tools for generating estimates of total naloxone kit numbers distributed and used from naloxone kit orders data. Provides functions for generating simulated data of naloxone kit use - and functions for generating samples from the posterior + and functions for generating samples from the posterior. License: MIT + file LICENSE Encoding: UTF-8 LazyData: true diff --git a/LICENSE b/LICENSE index 4c4f57f..b4be7c9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,2 @@ -MIT License - -Copyright (c) 2022 bennu authors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +YEAR: 2023 +COPYRIGHT HOLDER: Michael Irvine diff --git a/LICENSE.md b/LICENSE.md index 8681d31..c29941d 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # MIT License -Copyright (c) 2022 bennu authors +Copyright (c) 2023 Michael Irvine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/NEWS.md b/NEWS.md index c227e42..2cf563f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# bennu (development version) + +# bennu 0.2.1 + +# bennu 0.2.0 + # bennu 0.1.0 * `est_naloxone` can accept `psi_vector` of variable length and additionally diff --git a/R/est_naloxone.R b/R/est_naloxone.R index 233970e..26e027d 100644 --- a/R/est_naloxone.R +++ b/R/est_naloxone.R @@ -28,6 +28,7 @@ #' @param adapt_delta (double, between 0 and 1, defaults to 0.8) #' @param ... other parameters to pass to [rstan::sampling] #' @family inference +#' @return An S4 stanfit class object containing the fitted model #' @export est_naloxone_vec <- function(N_region, N_t, N_distributed, regions, times, Orders2D, Reported_Distributed, @@ -126,6 +127,7 @@ est_naloxone_vec <- function(N_region, N_t, N_distributed, regions, #' \item{region_name}{Optional label for region} #' } #' @examples +#' \dontrun{ #' library(rstan) #' library(bayesplot) #' @@ -138,8 +140,10 @@ est_naloxone_vec <- function(N_region, N_t, N_distributed, regions, #' pars = c("sigma", "mu0"), #' off_diag_args = list(size = 1, alpha = 0.5) #' ) +#' } #' @inheritParams est_naloxone_vec #' @family inference +#' @return An S4 stanfit class object containing the fitted model #' @export est_naloxone <- function(d, psi_vec = c(0.7, 0.2, 0.1), diff --git a/R/generate_model_data.R b/R/generate_model_data.R index d1dd119..c9adbb3 100644 --- a/R/generate_model_data.R +++ b/R/generate_model_data.R @@ -18,6 +18,17 @@ #' @param c_region logit probability of kit use per region #' @param reporting_freq The frequency that distribution data is provided. #' If `NULL` distribution frequency matches orders frequency +#' @return A tibble +#' \describe{ +#' \item{Orders}{Kit orders per time and region} +#' \item{regions}{Numeric index indicating region of orders and distributions} +#' \item{Reported_Used}{Number of kits reported as used} +#' \item{Reported_Distributed}{Number of kits reported as distributed} +#' \item{p_use}{Probability that a kit was used} +#' \item{p_reported}{Probability that a distributed kit was reported} +#' \item{times}{Index for time} +#' \item{region_name}{String index for the region} +#' } #' @export #' @importFrom stats rbinom rnorm #' @family data generation diff --git a/man/est_naloxone.Rd b/man/est_naloxone.Rd index 7a3f87f..5794cde 100644 --- a/man/est_naloxone.Rd +++ b/man/est_naloxone.Rd @@ -56,10 +56,14 @@ for each chain (including warmup). The default is 2000.} \item{...}{other parameters to pass to \link[rstan:stanmodel-method-sampling]{rstan::sampling}} } +\value{ +An S4 stanfit class object containing the fitted model +} \description{ Samples from Bayesian model using input from data frame } \examples{ +\dontrun{ library(rstan) library(bayesplot) @@ -73,6 +77,7 @@ mcmc_pairs(fit, off_diag_args = list(size = 1, alpha = 0.5) ) } +} \seealso{ Other inference: \code{\link{est_naloxone_vec}()} diff --git a/man/est_naloxone_vec.Rd b/man/est_naloxone_vec.Rd index 4309bba..97f05ee 100644 --- a/man/est_naloxone_vec.Rd +++ b/man/est_naloxone_vec.Rd @@ -72,6 +72,9 @@ for each chain (including warmup). The default is 2000.} \item{...}{other parameters to pass to \link[rstan:stanmodel-method-sampling]{rstan::sampling}} } +\value{ +An S4 stanfit class object containing the fitted model +} \description{ Samples from Bayesian model } diff --git a/man/generate_model_data.Rd b/man/generate_model_data.Rd index b59809c..36c6901 100644 --- a/man/generate_model_data.Rd +++ b/man/generate_model_data.Rd @@ -21,6 +21,19 @@ generate_model_data( \item{reporting_freq}{The frequency that distribution data is provided. If \code{NULL} distribution frequency matches orders frequency} } +\value{ +A tibble +\describe{ +\item{Orders}{Kit orders per time and region} +\item{regions}{Numeric index indicating region of orders and distributions} +\item{Reported_Used}{Number of kits reported as used} +\item{Reported_Distributed}{Number of kits reported as distributed} +\item{p_use}{Probability that a kit was used} +\item{p_reported}{Probability that a distributed kit was reported} +\item{times}{Index for time} +\item{region_name}{String index for the region} +} +} \description{ Simulate kits ordered and kits distributed for a set number of regions and time-points.