diff --git a/R/epiparameter-utils.R b/R/epiparameter-utils.R index e8d306266..7896fb5a0 100644 --- a/R/epiparameter-utils.R +++ b/R/epiparameter-utils.R @@ -484,7 +484,7 @@ create_method_assess <- function(censored = NA, #' This check for valid parameters is independent of whether the distribution #' is truncated or discretised. #' -#' @inheritParams epiparameter +#' @inheritParams create_prob_distribution #' #' @return A boolean `logical`. #' @export diff --git a/man/create_prob_distribution.Rd b/man/create_prob_distribution.Rd index 164333b28..3c9adb308 100644 --- a/man/create_prob_distribution.Rd +++ b/man/create_prob_distribution.Rd @@ -22,8 +22,8 @@ geometric is \code{geom}).} parameters.} \item{discretise}{A boolean \code{logical} whether the distribution is -discretised. -Default is FALSE which assumes a continuous probability distribution} +discretised. Default is \code{FALSE} which assumes a continuous probability +distribution.} \item{truncation}{A \code{numeric} specifying the truncation point if the inferred distribution was truncated, \code{NA} if not or unknown.} diff --git a/man/dot-calc_dist_params.Rd b/man/dot-calc_dist_params.Rd index a185160c1..ea6f8f14f 100644 --- a/man/dot-calc_dist_params.Rd +++ b/man/dot-calc_dist_params.Rd @@ -8,10 +8,11 @@ summary statistics} .calc_dist_params(prob_distribution, summary_stats, sample_size) } \arguments{ -\item{prob_distribution}{A \code{character} string specifying the probability -distribution. This should match the \R naming convention of probability -distributions (e.g. lognormal is \code{lnorm}, negative binomial is \code{nbinom}, and -geometric is \code{geom}).} +\item{prob_distribution}{An S3 class containing the probability +distribution or a character string if the parameters of the probability +distribution are unknown but the name of the distribution is known, or \code{NA} +if the distribution name and parameters are unknown. Use +\code{\link[=create_prob_distribution]{create_prob_distribution()}} to create \code{prob_distribution}.} \item{summary_stats}{A list of summary statistics, use \code{\link[=create_summary_stats]{create_summary_stats()}} to create list. This list can include diff --git a/man/dot-clean_params.Rd b/man/dot-clean_params.Rd index c2af46247..409aeb3d6 100644 --- a/man/dot-clean_params.Rd +++ b/man/dot-clean_params.Rd @@ -28,7 +28,12 @@ .clean_params_exp(prob_dist_params) } \arguments{ -\item{prob_dist_params}{A named vector of probability distribution +\item{prob_distribution}{A \code{character} string specifying the probability +distribution. This should match the \R naming convention of probability +distributions (e.g. lognormal is \code{lnorm}, negative binomial is \code{nbinom}, and +geometric is \code{geom}).} + +\item{prob_distribution_params}{A named vector of probability distribution parameters.} } \value{ diff --git a/man/epiparameter.Rd b/man/epiparameter.Rd index 67c23cd50..a302612fa 100644 --- a/man/epiparameter.Rd +++ b/man/epiparameter.Rd @@ -8,17 +8,14 @@ epiparameter( disease, pathogen = NA_character_, epi_dist, - prob_distribution = NA_character_, - prob_distribution_params = NA_real_, + prob_distribution = create_prob_distribution(prob_distribution = NA_character_), uncertainty = create_uncertainty(), summary_stats = create_summary_stats(), - auto_calc_params = TRUE, citation = create_citation(), metadata = create_metadata(), method_assess = create_method_assess(), - discretise = FALSE, - truncation = NA_real_, notes = NULL, + auto_calc_params = TRUE, ... ) } @@ -31,13 +28,11 @@ disease, or \code{NA} if not known.} \item{epi_dist}{A \code{character} string with the name of the epidemiological distribution type.} -\item{prob_distribution}{A \code{character} string specifying the probability -distribution. This should match the \R naming convention of probability -distributions (e.g. lognormal is \code{lnorm}, negative binomial is \code{nbinom}, and -geometric is \code{geom}).} - -\item{prob_distribution_params}{A named vector of probability distribution -parameters.} +\item{prob_distribution}{An S3 class containing the probability +distribution or a character string if the parameters of the probability +distribution are unknown but the name of the distribution is known, or \code{NA} +if the distribution name and parameters are unknown. Use +\code{\link[=create_prob_distribution]{create_prob_distribution()}} to create \code{prob_distribution}.} \item{uncertainty}{A list of named vectors with the uncertainty around the probability distribution parameters. If uncertainty around the parameter @@ -53,13 +48,6 @@ data used to fit the distribution such as lower and upper range. The summary statistics can also include uncertainty around metrics such as confidence interval around mean and standard deviation.} -\item{auto_calc_params}{A boolean \code{logical} determining whether to try and -calculate the probability distribution parameters from summary statistics if -distribution parameters are not provided. Default is \code{TRUE}. In the case when -sufficient summary statistics are provided and the parameter(s) of the -distribution are not, the \code{\link[=.calc_dist_params]{.calc_dist_params()}} function is called to -calculate the parameters and add them to the \code{epiparameter} object created.} - \item{citation}{A \verb{} with the citation of the source of the data or the paper that inferred the distribution parameters, use \code{\link[=create_citation]{create_citation()}} to create citation.} @@ -76,16 +64,16 @@ delay distribution such as extrinsic incubation period) unless the distribution, use \code{\link[=create_method_assess]{create_method_assess()}} to create method assessment.} -\item{discretise}{A boolean \code{logical} whether the distribution is -discretised. -Default is FALSE which assumes a continuous probability distribution} - -\item{truncation}{A \code{numeric} specifying the truncation point if the inferred -distribution was truncated, \code{NA} if not or unknown.} - \item{notes}{A \code{character} string with any additional information about the data, inference method or disease.} +\item{auto_calc_params}{A boolean \code{logical} determining whether to try and +calculate the probability distribution parameters from summary statistics if +distribution parameters are not provided. Default is \code{TRUE}. In the case when +sufficient summary statistics are provided and the parameter(s) of the +distribution are not, the \code{\link[=.calc_dist_params]{.calc_dist_params()}} function is called to +calculate the parameters and add them to the \code{epiparameter} object created.} + \item{...}{\link{dots} Extra arguments to be passed to internal functions. This is most commonly used to pass arguments to \code{\link[distcrete:distcrete]{distcrete::distcrete()}} diff --git a/man/new_epiparameter.Rd b/man/new_epiparameter.Rd index 7719ff079..f5e39bc30 100644 --- a/man/new_epiparameter.Rd +++ b/man/new_epiparameter.Rd @@ -8,17 +8,14 @@ new_epiparameter( disease = character(), pathogen = character(), epi_dist = character(), - prob_dist = list(), - prob_dist_params = numeric(), + prob_distribution = list(), uncertainty = list(), summary_stats = list(), - auto_calc_params = logical(), citation = character(), metadata = list(), method_assess = list(), - discretise = logical(), - truncation = numeric(), notes = character(), + auto_calc_params = logical(), ... ) } @@ -31,13 +28,11 @@ disease, or \code{NA} if not known.} \item{epi_dist}{A \code{character} string with the name of the epidemiological distribution type.} -\item{prob_dist}{A character string specifying the probability -distribution. This should match the R naming convention of probability -distributions (e.g. lognormal is \code{lnorm}, negative binomial is \code{nbinom}, and -geometric is \code{geom}).} - -\item{prob_dist_params}{A named vector of probability distribution -parameters.} +\item{prob_distribution}{An S3 class containing the probability +distribution or a character string if the parameters of the probability +distribution are unknown but the name of the distribution is known, or \code{NA} +if the distribution name and parameters are unknown. Use +\code{\link[=create_prob_distribution]{create_prob_distribution()}} to create \code{prob_distribution}.} \item{uncertainty}{A list of named vectors with the uncertainty around the probability distribution parameters. If uncertainty around the parameter @@ -53,13 +48,6 @@ data used to fit the distribution such as lower and upper range. The summary statistics can also include uncertainty around metrics such as confidence interval around mean and standard deviation.} -\item{auto_calc_params}{A boolean \code{logical} determining whether to try and -calculate the probability distribution parameters from summary statistics if -distribution parameters are not provided. Default is \code{TRUE}. In the case when -sufficient summary statistics are provided and the parameter(s) of the -distribution are not, the \code{\link[=.calc_dist_params]{.calc_dist_params()}} function is called to -calculate the parameters and add them to the \code{epiparameter} object created.} - \item{citation}{A \verb{} with the citation of the source of the data or the paper that inferred the distribution parameters, use \code{\link[=create_citation]{create_citation()}} to create citation.} @@ -76,22 +64,30 @@ delay distribution such as extrinsic incubation period) unless the distribution, use \code{\link[=create_method_assess]{create_method_assess()}} to create method assessment.} -\item{discretise}{A boolean \code{logical} whether the distribution is -discretised. -Default is FALSE which assumes a continuous probability distribution} - -\item{truncation}{A \code{numeric} specifying the truncation point if the inferred -distribution was truncated, \code{NA} if not or unknown.} - \item{notes}{A \code{character} string with any additional information about the data, inference method or disease.} +\item{auto_calc_params}{A boolean \code{logical} determining whether to try and +calculate the probability distribution parameters from summary statistics if +distribution parameters are not provided. Default is \code{TRUE}. In the case when +sufficient summary statistics are provided and the parameter(s) of the +distribution are not, the \code{\link[=.calc_dist_params]{.calc_dist_params()}} function is called to +calculate the parameters and add them to the \code{epiparameter} object created.} + \item{...}{\link{dots} Extra arguments to be passed to internal functions. This is most commonly used to pass arguments to \code{\link[distcrete:distcrete]{distcrete::distcrete()}} that construct the discretised distribution S3 object. To see which arguments can be adjusted for discretised distributions see \code{\link[distcrete:distcrete]{distcrete::distcrete()}}.} + +\item{prob_dist}{A character string specifying the probability +distribution. This should match the R naming convention of probability +distributions (e.g. lognormal is \code{lnorm}, negative binomial is \code{nbinom}, and +geometric is \code{geom}).} + +\item{prob_dist_params}{A named vector of probability distribution +parameters.} } \value{ An \verb{} object.