Skip to content

Commit

Permalink
Issue #398: Make documentation consistent across models (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
athowes authored Nov 19, 2024
1 parent 590838d commit 153b4cc
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 40 deletions.
2 changes: 1 addition & 1 deletion R/epidist.R
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 9 additions & 6 deletions R/latent_model.R
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions R/naive_model.R
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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")
}
3 changes: 2 additions & 1 deletion man/as_epidist_latent_model.Rd

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

23 changes: 23 additions & 0 deletions man/as_epidist_latent_model.epidist_linelist_data.Rd

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

2 changes: 1 addition & 1 deletion man/as_epidist_naive_model.Rd

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

2 changes: 1 addition & 1 deletion man/epidist.Rd

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

2 changes: 1 addition & 1 deletion man/epidist.default.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_family.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_family_model.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_family_model.default.Rd

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

3 changes: 2 additions & 1 deletion man/epidist_family_model.epidist_latent_model.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_formula.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_formula_model.default.Rd

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

11 changes: 8 additions & 3 deletions man/epidist_formula_model.epidist_latent_model.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_model_prior.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_model_prior.default.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_prior.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_stancode.Rd

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

2 changes: 1 addition & 1 deletion man/epidist_stancode.default.Rd

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

3 changes: 2 additions & 1 deletion man/is_epidist_latent_model.Rd

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

2 changes: 1 addition & 1 deletion man/is_epidist_naive_model.Rd

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

3 changes: 2 additions & 1 deletion man/new_epidist_latent_model.Rd

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

2 changes: 1 addition & 1 deletion man/new_epidist_naive_model.Rd

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

0 comments on commit 153b4cc

Please sign in to comment.