Skip to content

Commit

Permalink
Adding tags and other documentation such that pkgdown site is working
Browse files Browse the repository at this point in the history
  • Loading branch information
athowes committed Jun 5, 2024
1 parent 785cde1 commit 54047e7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
6 changes: 6 additions & 0 deletions R/ltcad.R
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -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(
Expand All @@ -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),
Expand Down
33 changes: 20 additions & 13 deletions R/methods.R
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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"))
Expand All @@ -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")
}
}
3 changes: 3 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
11 changes: 9 additions & 2 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -40,3 +44,6 @@ reference:
desc: Data included with the package
contents:
- has_concept("data")
- title: Utility functions
contents:
- has_concept("utils")

0 comments on commit 54047e7

Please sign in to comment.