diff --git a/R/epidist.R b/R/epidist.R index c7d5035ae..358e8f965 100644 --- a/R/epidist.R +++ b/R/epidist.R @@ -1,6 +1,6 @@ #' Fit epidemiological delay distributions using a `brms` interface #' -#' @param data A `data.frame` containing line list data. +#' @param data An object with class corresponding to an implemented model. #' @param formula An object of class [stats::formula] or [brms::brmsformula] #' (or one that can be coerced to those classes). A symbolic description of the #' model to be fitted. A formula must be provided for the distributional diff --git a/R/latent_model.R b/R/latent_model.R index 8b1ca946f..99ccdd5c9 100644 --- a/R/latent_model.R +++ b/R/latent_model.R @@ -1,12 +1,16 @@ #' Convert an object to an `epidist_latent_model` object #' -#' @param data A `data.frame` containing line list data +#' @param data An object to be converted to the class `epidist_latent_model` #' @family latent_model #' @export as_epidist_latent_model <- function(data) { UseMethod("as_epidist_latent_model") } + +#' The latent model method for `epidist_linelist_data` objects +#' +#' @param data An `epidist_linelist_data` object #' @method as_epidist_latent_model epidist_linelist_data #' @family latent_model #' @autoglobal @@ -33,7 +37,7 @@ as_epidist_latent_model.epidist_linelist_data <- function(data) { #' Class constructor for `epidist_latent_model` objects #' -#' @param data A data.frame to convert +#' @param data An object to be set with the class `epidist_latent_model` #' @returns An object of class `epidist_latent_model` #' @family latent_model #' @export @@ -44,7 +48,7 @@ new_epidist_latent_model <- function(data) { #' Check if data has the `epidist_latent_model` class #' -#' @param data A `data.frame` containing line list data +#' @param data An object #' @family latent_model #' @export is_epidist_latent_model <- function(data) { @@ -93,9 +97,8 @@ epidist_family_model.epidist_latent_model <- function( #' Define the model-specific component of an `epidist` custom formula #' -#' @param data A `data.frame` containing line list data -#' @param formula As produced by [brms::brmsformula()] -#' @param ... ... +#' @inheritParams epidist_formula_model +#' @param ... Additional arguments passed to method. #' @method epidist_formula_model epidist_latent_model #' @family latent_model #' @export diff --git a/R/naive_model.R b/R/naive_model.R index ba81e5ee4..8439926da 100644 --- a/R/naive_model.R +++ b/R/naive_model.R @@ -1,6 +1,6 @@ #' Prepare naive model to pass through to `brms` #' -#' @param data A `data.frame` containing line list data +#' @param data An object to be converted to the class `epidist_naive_model` #' @family naive_model #' @export as_epidist_naive_model <- function(data) { @@ -27,7 +27,7 @@ as_epidist_naive_model.epidist_linelist_data <- function(data) { #' Class constructor for `epidist_naive_model` objects #' -#' @param data A data.frame to convert +#' @param data An object to be set with the class `epidist_naive_model` #' @returns An object of class `epidist_naive_model` #' @family naive_model #' @export @@ -36,6 +36,15 @@ new_epidist_naive_model <- function(data) { return(data) } +#' Check if data has the `epidist_naive_model` class +#' +#' @param data An object +#' @family naive_model +#' @export +is_epidist_naive_model <- function(data) { + inherits(data, "epidist_naive_model") +} + #' @method assert_epidist epidist_naive_model #' @family naive_model #' @export @@ -44,12 +53,3 @@ assert_epidist.epidist_naive_model <- function(data, ...) { assert_names(names(data), must.include = "delay") assert_numeric(data$delay, lower = 0) } - -#' Check if data has the `epidist_naive_model` class -#' -#' @param data A `data.frame` containing line list data -#' @family naive_model -#' @export -is_epidist_naive_model <- function(data) { - inherits(data, "epidist_naive_model") -} diff --git a/man/as_epidist_latent_model.Rd b/man/as_epidist_latent_model.Rd index 8427e15fc..fb2329eda 100644 --- a/man/as_epidist_latent_model.Rd +++ b/man/as_epidist_latent_model.Rd @@ -7,13 +7,14 @@ as_epidist_latent_model(data) } \arguments{ -\item{data}{A \code{data.frame} containing line list data} +\item{data}{An object to be converted to the class \code{epidist_latent_model}} } \description{ Convert an object to an \code{epidist_latent_model} object } \seealso{ Other latent_model: +\code{\link{as_epidist_latent_model.epidist_linelist_data}()}, \code{\link{epidist_family_model.epidist_latent_model}()}, \code{\link{epidist_formula_model.epidist_latent_model}()}, \code{\link{is_epidist_latent_model}()}, diff --git a/man/as_epidist_latent_model.epidist_linelist_data.Rd b/man/as_epidist_latent_model.epidist_linelist_data.Rd new file mode 100644 index 000000000..ca3c6acf0 --- /dev/null +++ b/man/as_epidist_latent_model.epidist_linelist_data.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/latent_model.R +\name{as_epidist_latent_model.epidist_linelist_data} +\alias{as_epidist_latent_model.epidist_linelist_data} +\title{The latent model method for \code{epidist_linelist_data} objects} +\usage{ +\method{as_epidist_latent_model}{epidist_linelist_data}(data) +} +\arguments{ +\item{data}{An \code{epidist_linelist_data} object} +} +\description{ +The latent model method for \code{epidist_linelist_data} objects +} +\seealso{ +Other latent_model: +\code{\link{as_epidist_latent_model}()}, +\code{\link{epidist_family_model.epidist_latent_model}()}, +\code{\link{epidist_formula_model.epidist_latent_model}()}, +\code{\link{is_epidist_latent_model}()}, +\code{\link{new_epidist_latent_model}()} +} +\concept{latent_model} diff --git a/man/as_epidist_naive_model.Rd b/man/as_epidist_naive_model.Rd index 4bea9e144..2b31b4d21 100644 --- a/man/as_epidist_naive_model.Rd +++ b/man/as_epidist_naive_model.Rd @@ -7,7 +7,7 @@ as_epidist_naive_model(data) } \arguments{ -\item{data}{A \code{data.frame} containing line list data} +\item{data}{An object to be converted to the class \code{epidist_naive_model}} } \description{ Prepare naive model to pass through to \code{brms} diff --git a/man/epidist.Rd b/man/epidist.Rd index a9a4ab7c0..1372c522f 100644 --- a/man/epidist.Rd +++ b/man/epidist.Rd @@ -7,7 +7,7 @@ epidist(data, formula, family, prior, fn, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{formula}{An object of class \link[stats:formula]{stats::formula} or \link[brms:brmsformula]{brms::brmsformula} (or one that can be coerced to those classes). A symbolic description of the diff --git a/man/epidist.default.Rd b/man/epidist.default.Rd index 3de4f4b8f..5c85cff0b 100644 --- a/man/epidist.default.Rd +++ b/man/epidist.default.Rd @@ -14,7 +14,7 @@ ) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{formula}{An object of class \link[stats:formula]{stats::formula} or \link[brms:brmsformula]{brms::brmsformula} (or one that can be coerced to those classes). A symbolic description of the diff --git a/man/epidist_family.Rd b/man/epidist_family.Rd index ba7960fc7..e7272bec3 100644 --- a/man/epidist_family.Rd +++ b/man/epidist_family.Rd @@ -7,7 +7,7 @@ epidist_family(data, family = lognormal(), ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{family}{A description of the response distribution and link function to be used in the model. Every family function has a link argument allowing diff --git a/man/epidist_family_model.Rd b/man/epidist_family_model.Rd index 08608529e..708d1e4db 100644 --- a/man/epidist_family_model.Rd +++ b/man/epidist_family_model.Rd @@ -10,7 +10,7 @@ epidist_family_model(data, family, ...) epidist_formula_model(data, formula, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{family}{Output of a call to \code{brms::brmsfamily()} with additional information as provided by \code{.add_dpar_info()}} diff --git a/man/epidist_family_model.default.Rd b/man/epidist_family_model.default.Rd index c7cde1af9..13a036730 100644 --- a/man/epidist_family_model.default.Rd +++ b/man/epidist_family_model.default.Rd @@ -7,7 +7,7 @@ \method{epidist_family_model}{default}(data, family, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{family}{Output of a call to \code{brms::brmsfamily()} with additional information as provided by \code{.add_dpar_info()}} diff --git a/man/epidist_family_model.epidist_latent_model.Rd b/man/epidist_family_model.epidist_latent_model.Rd index 32e7da2e7..ae3dae26b 100644 --- a/man/epidist_family_model.epidist_latent_model.Rd +++ b/man/epidist_family_model.epidist_latent_model.Rd @@ -7,7 +7,7 @@ \method{epidist_family_model}{epidist_latent_model}(data, family, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{family}{Output of a call to \code{brms::brmsfamily()} with additional information as provided by \code{.add_dpar_info()}} @@ -20,6 +20,7 @@ Create the model-specific component of an \code{epidist} custom family \seealso{ Other latent_model: \code{\link{as_epidist_latent_model}()}, +\code{\link{as_epidist_latent_model.epidist_linelist_data}()}, \code{\link{epidist_formula_model.epidist_latent_model}()}, \code{\link{is_epidist_latent_model}()}, \code{\link{new_epidist_latent_model}()} diff --git a/man/epidist_formula.Rd b/man/epidist_formula.Rd index a1a94cad4..f7d683700 100644 --- a/man/epidist_formula.Rd +++ b/man/epidist_formula.Rd @@ -7,7 +7,7 @@ epidist_formula(data, family, formula, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{family}{A description of the response distribution and link function to be used in the model created using \code{\link[=epidist_family]{epidist_family()}}.} diff --git a/man/epidist_formula_model.default.Rd b/man/epidist_formula_model.default.Rd index 7c8e7bbb2..e00f07826 100644 --- a/man/epidist_formula_model.default.Rd +++ b/man/epidist_formula_model.default.Rd @@ -7,7 +7,7 @@ \method{epidist_formula_model}{default}(data, formula, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{formula}{An object of class \link[stats:formula]{stats::formula} or \link[brms:brmsformula]{brms::brmsformula} (or one that can be coerced to those classes). A symbolic description of the diff --git a/man/epidist_formula_model.epidist_latent_model.Rd b/man/epidist_formula_model.epidist_latent_model.Rd index a1fcced3e..5811233df 100644 --- a/man/epidist_formula_model.epidist_latent_model.Rd +++ b/man/epidist_formula_model.epidist_latent_model.Rd @@ -7,11 +7,15 @@ \method{epidist_formula_model}{epidist_latent_model}(data, formula, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data} +\item{data}{An object with class corresponding to an implemented model.} -\item{formula}{As produced by \code{\link[brms:brmsformula]{brms::brmsformula()}}} +\item{formula}{An object of class \link[stats:formula]{stats::formula} or \link[brms:brmsformula]{brms::brmsformula} +(or one that can be coerced to those classes). A symbolic description of the +model to be fitted. A formula must be provided for the distributional +parameter \code{mu}, and may optionally be provided for other distributional +parameters.} -\item{...}{...} +\item{...}{Additional arguments passed to method.} } \description{ Define the model-specific component of an \code{epidist} custom formula @@ -19,6 +23,7 @@ Define the model-specific component of an \code{epidist} custom formula \seealso{ Other latent_model: \code{\link{as_epidist_latent_model}()}, +\code{\link{as_epidist_latent_model.epidist_linelist_data}()}, \code{\link{epidist_family_model.epidist_latent_model}()}, \code{\link{is_epidist_latent_model}()}, \code{\link{new_epidist_latent_model}()} diff --git a/man/epidist_model_prior.Rd b/man/epidist_model_prior.Rd index df28ea733..44dcdbae2 100644 --- a/man/epidist_model_prior.Rd +++ b/man/epidist_model_prior.Rd @@ -7,7 +7,7 @@ epidist_model_prior(data, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{...}{Additional arguments passed to \code{fn} method.} } diff --git a/man/epidist_model_prior.default.Rd b/man/epidist_model_prior.default.Rd index 27035bc07..34e47048a 100644 --- a/man/epidist_model_prior.default.Rd +++ b/man/epidist_model_prior.default.Rd @@ -7,7 +7,7 @@ \method{epidist_model_prior}{default}(data, formula, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{formula}{An object of class \link[stats:formula]{stats::formula} or \link[brms:brmsformula]{brms::brmsformula} (or one that can be coerced to those classes). A symbolic description of the diff --git a/man/epidist_prior.Rd b/man/epidist_prior.Rd index d61aed716..7863ed3b7 100644 --- a/man/epidist_prior.Rd +++ b/man/epidist_prior.Rd @@ -8,7 +8,7 @@ family specific priors, and user provided priors} epidist_prior(data, family, formula, prior) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{family}{A description of the response distribution and link function to be used in the model created using \code{\link[=epidist_family]{epidist_family()}}.} diff --git a/man/epidist_stancode.Rd b/man/epidist_stancode.Rd index 31a58e5b5..bf704688c 100644 --- a/man/epidist_stancode.Rd +++ b/man/epidist_stancode.Rd @@ -7,7 +7,7 @@ epidist_stancode(data, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{...}{Additional arguments passed to \code{fn} method.} } diff --git a/man/epidist_stancode.default.Rd b/man/epidist_stancode.default.Rd index ef2f21f18..cbb67de7e 100644 --- a/man/epidist_stancode.default.Rd +++ b/man/epidist_stancode.default.Rd @@ -7,7 +7,7 @@ \method{epidist_stancode}{default}(data, ...) } \arguments{ -\item{data}{A \code{data.frame} containing line list data.} +\item{data}{An object with class corresponding to an implemented model.} \item{...}{Additional arguments passed to \code{fn} method.} } diff --git a/man/is_epidist_latent_model.Rd b/man/is_epidist_latent_model.Rd index bc02f76f2..b9c4115ae 100644 --- a/man/is_epidist_latent_model.Rd +++ b/man/is_epidist_latent_model.Rd @@ -7,7 +7,7 @@ is_epidist_latent_model(data) } \arguments{ -\item{data}{A \code{data.frame} containing line list data} +\item{data}{An object} } \description{ Check if data has the \code{epidist_latent_model} class @@ -15,6 +15,7 @@ Check if data has the \code{epidist_latent_model} class \seealso{ Other latent_model: \code{\link{as_epidist_latent_model}()}, +\code{\link{as_epidist_latent_model.epidist_linelist_data}()}, \code{\link{epidist_family_model.epidist_latent_model}()}, \code{\link{epidist_formula_model.epidist_latent_model}()}, \code{\link{new_epidist_latent_model}()} diff --git a/man/is_epidist_naive_model.Rd b/man/is_epidist_naive_model.Rd index 391f17823..a16c05f4f 100644 --- a/man/is_epidist_naive_model.Rd +++ b/man/is_epidist_naive_model.Rd @@ -7,7 +7,7 @@ is_epidist_naive_model(data) } \arguments{ -\item{data}{A \code{data.frame} containing line list data} +\item{data}{An object} } \description{ Check if data has the \code{epidist_naive_model} class diff --git a/man/new_epidist_latent_model.Rd b/man/new_epidist_latent_model.Rd index df7f754f4..02841df23 100644 --- a/man/new_epidist_latent_model.Rd +++ b/man/new_epidist_latent_model.Rd @@ -7,7 +7,7 @@ new_epidist_latent_model(data) } \arguments{ -\item{data}{A data.frame to convert} +\item{data}{An object to be set with the class \code{epidist_latent_model}} } \value{ An object of class \code{epidist_latent_model} @@ -18,6 +18,7 @@ Class constructor for \code{epidist_latent_model} objects \seealso{ Other latent_model: \code{\link{as_epidist_latent_model}()}, +\code{\link{as_epidist_latent_model.epidist_linelist_data}()}, \code{\link{epidist_family_model.epidist_latent_model}()}, \code{\link{epidist_formula_model.epidist_latent_model}()}, \code{\link{is_epidist_latent_model}()} diff --git a/man/new_epidist_naive_model.Rd b/man/new_epidist_naive_model.Rd index 95bdce719..433fe4e45 100644 --- a/man/new_epidist_naive_model.Rd +++ b/man/new_epidist_naive_model.Rd @@ -7,7 +7,7 @@ new_epidist_naive_model(data) } \arguments{ -\item{data}{A data.frame to convert} +\item{data}{An object to be set with the class \code{epidist_naive_model}} } \value{ An object of class \code{epidist_naive_model}