diff --git a/R/ltcad.R b/R/ltcad.R index ec1fd8bb0..2ea933a27 100644 --- a/R/ltcad.R +++ b/R/ltcad.R @@ -1,4 +1,5 @@ #' @method epidist_prepare epidist_ltcad +#' @family ltcad #' @export epidist_prepare.epidist_ltcad <- function(data) { data <- data.table::as.data.table(data) @@ -22,6 +23,7 @@ epidist_prepare.epidist_ltcad <- function(data) { } #' @method epidist_stancode epidist_ltcad +#' @family ltcad #' @export epidist_stancode.epidist_ltcad <- function(data, family = "lognormal") { stanvars_version <- epidist_version_stanvar() @@ -72,6 +74,7 @@ epidist_stancode.epidist_ltcad <- function(data, family = "lognormal") { } #' @method epidist_priors epidist_ltcad +#' @family ltcad #' @export epidist_priors.epidist_ltcad <- function(data) { return(NULL) @@ -83,6 +86,7 @@ epidist_priors.epidist_ltcad <- function(data) { #' @param sigma Formula for the delay standard deviation. Defaults to intercept #' only. #' @method epidist_formula epidist_ltcad +#' @family ltcad #' @export epidist_formula.epidist_ltcad <- function(data, delay_central = ~ 1, sigma = ~ 1) { @@ -97,6 +101,7 @@ epidist_formula.epidist_ltcad <- function(data, delay_central = ~ 1, } #' @method epidist_family epidist_ltcad +#' @family ltcad #' @export epidist_family.epidist_ltcad <- function(data) { brms::custom_family( @@ -112,6 +117,7 @@ epidist_family.epidist_ltcad <- function(data) { } #' @method epidist epidist_ltcad +#' @family ltcad #' @export epidist.epidist_ltcad <- function(data, formula = epidist_formula(data), family = epidist_family(data), diff --git a/R/methods.R b/R/methods.R index 60f6b1a1b..d6322bc81 100644 --- a/R/methods.R +++ b/R/methods.R @@ -1,7 +1,8 @@ #' Prepare data for modelling #' -#' @param data A dataframe to be used for modelling +#' @param data A dataframe to be used for modelling. #' @rdname epidist_prepare +#' @family methods #' @export epidist_prepare <- function(data, ...) { UseMethod("epidist_prepare") @@ -11,10 +12,11 @@ epidist_prepare <- function(data, ...) { #' #' @param model Character string, model type to prepare to use. #' Supported options are "ltcad". -#' @param ... Additional arguments passed to model specific epidist_prepare +#' @param ... Additional arguments passed to model specific `epidist_prepare` #' functions #' @rdname epidist_prepare #' @method epidist_prepare default +#' @family methods #' @export epidist_prepare.default <- function(data, model, ...) { model <- match.arg(model, choices = c("ltcad")) @@ -24,53 +26,58 @@ epidist_prepare.default <- function(data, model, ...) { #' Define a model specific formula #' -#' @export -#' @inheritParams epidist_priors +#' @inheritParams epidist_prepare #' @param ... Additional arguments for method. +#' @family methods +#' @export epidist_formula <- function(data, ...) { UseMethod("epidist_formula") } #' Define model specific family #' -#' @export -#' @inheritParams epidist_priors +#' @inheritParams epidist_prepare #' @param ... Additional arguments for method. +#' @family methods +#' @export epidist_family <- function(data, ...) { UseMethod("epidist_family") } #' Define model specific priors #' -#' @export -#' @inheritParams epidist +#' @inheritParams epidist_prepare #' @param ... Additional arguments for method. #' @rdname epidist_priors +#' @family methods +#' @export epidist_priors <- function(data, ...) { UseMethod("epidist_priors") } #' Define model specific stancode #' -#' @export -#' @inheritParams epidist_priors +#' @inheritParams epidist_prepare #' @param ... Additional arguments for method. #' @rdname id_stancode +#' @family methods +#' @export epidist_stancode <- function(data, ...) { UseMethod("epidist_stancode") } #' Interface using `brms` #' -#' @param data ... -#' @param formula ... +#' @param formula A formula as defined using [epidist_formula()] #' @param family ... #' @param priors ... #' @param custom_stancode ... #' @param fn Likely `brms::brm`. Also possible to be `brms::make_stancode` or #' `brms::make_standata`. +#' @inheritParams epidist_prepare #' @param ... Additional arguments for method. +#' @family methods #' @export epidist <- function(data, formula, family, priors, custom_stancode, fn, ...) { UseMethod("epidist") -} \ No newline at end of file +} diff --git a/R/utils.R b/R/utils.R index 918d36d6d..bc6c7760d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -3,6 +3,7 @@ #' @param path The path within the "stan" folder of the installed epidist #' package to the Stan code chunk of interest. #' @return A character string containing the Stan code chunk of interest. +#' @family utils #' @export epidist_stan_chunk <- function(path) { local_path <- system.file(paste0("stan/", path), package = "epidist") @@ -13,6 +14,8 @@ epidist_stan_chunk <- function(path) { #' #' @return A brms stanvar chunk containing the package version used to build #' the Stan code. +#' @family utils +#' @export epidist_version_stanvar <- function() { version <- utils::packageVersion("epidist") comment <- paste0("// code chunks used from epidist ", version, "\n") diff --git a/_pkgdown.yml b/_pkgdown.yml index 4cdffc8a7..99fa9d9d3 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -24,10 +24,14 @@ reference: desc: Functions for observing data contents: - has_concept("observe") -- title: Model +- title: Methods desc: Functions for estimating epidemiological delays contents: - - has_concept("model") + - has_concept("methods") +- title: Latent truncation censoring adjusted delay model + desc: Model-specific functions + contents: + - has_concept("ltcad") - title: Postprocess desc: Functions for postprocessing model output contents: @@ -40,3 +44,6 @@ reference: desc: Data included with the package contents: - has_concept("data") +- title: Utility functions + contents: + - has_concept("utils")