Skip to content

Commit

Permalink
removed possible_epidist_params() and added info to epidist() doc
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwlambert committed May 31, 2023
1 parent db6fcfc commit a203ee2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 50 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export(lnorm_meanlogsdlog2meansd)
export(lnorm_meansd2meanlogsdlog)
export(nbinom_meandisp2probdisp)
export(nbinom_probdisp2meandisp)
export(possible_epidist_params)
export(validate_epidist)
export(validate_vb_epidist)
export(vb_epidist)
Expand Down
2 changes: 1 addition & 1 deletion R/check_epidist.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ check_epidist_params <- function(prob_dist, prob_dist_params) {

stopifnot(
"distribution parameters must have valid names,
use possible_epidist_params() to see valid names" =
see epidist() documentation for valid names" =
is_epidist_params(prob_dist_params)
)

Expand Down
8 changes: 8 additions & 0 deletions R/epidist.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ new_epidist <- function(disease = list(),
#' pipelines. This is where the `epidist()` function can be used to fill out
#' each field for which information is known.
#'
#' @details Accepted `<epidist>` distribution parameterisations are:
#' - Gamma must be either 'shape' and 'scale' or 'shape' and 'rate'
#' - Weibull must be 'shape' and 'scale'
#' - Lognormal must be 'mealog' and 'sdlog' or 'mu' and 'sigma'
#' - Negative Binomial must be either 'mean' and 'dispersion' or 'n' and 'p'
#' - Geometric must be either 'mean' or 'prob'
#' - Poisson must be 'mean'
#'
#' @param disease A character string with name of the infectious disease.
#' @param pathogen A character string with the name of the causative agent of
#' disease, or NULL if not known.
Expand Down
21 changes: 0 additions & 21 deletions R/epidist_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -519,27 +519,6 @@ is_epidist_params <- function(prob_dist_params) {
is_valid_params
}

#' Print accepted distribution parameters
#'
#' Helper function that prints the distribution parameters accepted by
#' `epiparameter`
#'
#' @return Nothing, prints to console
#' @export
#'
#' @examples
#' possible_epidist_params()
possible_epidist_params <- function() {
cat(
"Gamma or Weibull must be either 'shape' and 'scale' or 'shape' and 'rate'",
"Lognormal must be 'mealog' and 'sdlog' or 'mu' and 'sigma'",
"Negative Binomial must be 'mean' and 'dispersion'",
"Poisson must be 'mean'",
"Geometric must be 'prob'",
sep = "\n"
)
}

clean_epidist_params <- function(prob_dist_params, ...) {
UseMethod("clean_epidist_params")
}
Expand Down
5 changes: 0 additions & 5 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ reference:
- clean_disease
- clean_epidist_name

- title: Check valid parameterisation
desc: Check parameters are valid for `<epidist>`
contents:
- possible_epidist_params

- title: Utility function
contents:
- calc_disc_dist_quantile
Expand Down
11 changes: 11 additions & 0 deletions man/epidist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions man/possible_epidist_params.Rd

This file was deleted.

4 changes: 0 additions & 4 deletions tests/testthat/test-epidist_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ test_that("create_epidist_citation works with PMID", {
)
})

test_that("possible_epidist_params works as expected", {
expect_output(possible_epidist_params())
})

test_that("clean_epidist_params fails when gamma parameters are incorrect", {
gamma_params <- c(meanlog = 1, sdlog = 1)
class(gamma_params) <- "gamma"
Expand Down

0 comments on commit a203ee2

Please sign in to comment.