Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Nov 6, 2024
1 parent cb260d8 commit 260d2e5
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 96 deletions.
32 changes: 16 additions & 16 deletions R/find_parameter_zi.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@
#' - `conditional`, the "fixed effects" part from the model.
#' - `zero_inflated`, the "fixed effects" part from the zero-inflation
#' component of the model.
#' - Special models are `mhurdle`, which also can have the components
#' `infrequent_purchase`, `ip`, and `auxiliary`.
#'
#' @examples
#' data(mtcars)
#' m <- lm(mpg ~ wt + cyl + vs, data = mtcars)
#' find_parameters(m)
#' @export
find_parameters.zeroinfl <- function(x,
component = c("all", "conditional", "zi", "zero_inflated"),
flatten = FALSE,
...) {
find_parameters.zeroinfl <- function(x, component = "all", flatten = FALSE, ...) {
cf <- names(stats::coef(x))
component <- match.arg(component)
component <- validate_argument(component, c("all", "conditional", "zi", "zero_inflated"))

l <- compact_list(list(
conditional = cf[startsWith(cf, "count_")],
Expand All @@ -50,12 +49,9 @@ find_parameters.zerotrunc <- find_parameters.zeroinfl


#' @export
find_parameters.zcpglm <- function(x,
component = c("all", "conditional", "zi", "zero_inflated"),
flatten = FALSE,
...) {
find_parameters.zcpglm <- function(x, component = "all", flatten = FALSE, ...) {
cf <- stats::coef(x)
component <- match.arg(component)
component <- validate_argument(component, c("all", "conditional", "zi", "zero_inflated"))

l <- compact_list(list(
conditional = names(cf$tweedie),
Expand All @@ -72,15 +68,19 @@ find_parameters.zcpglm <- function(x,
}


#' @rdname find_parameters.zeroinfl
#' @export
find_parameters.mhurdle <- function(x,
component = c("all", "conditional", "zi", "zero_inflated", "infrequent_purchase", "ip", "auxiliary"),
flatten = FALSE,
...) {
component <- match.arg(component)
find_parameters.mhurdle <- function(x, component = "all", flatten = FALSE, ...) {
component <- validate_argument(
component,
c("all", "conditional", "zi", "zero_inflated", "infrequent_purchase", "ip", "auxiliary", "distributional")
)
cf <- stats::coef(x)

# handle alias
if (component == "distributional") {
component <- "auxiliary"
}

cond_pars <- which(startsWith(names(cf), "h2."))
zi_pars <- which(startsWith(names(cf), "h1."))
ip_pars <- which(startsWith(names(cf), "h3."))
Expand Down
21 changes: 13 additions & 8 deletions R/find_predictors.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
#' @param x A fitted model.
#' @param effects Should variables for fixed effects, random effects
#' or both be returned? Only applies to mixed models. May be abbreviated.
#' @param component Should all predictor variables, predictor variables for the
#' conditional model, the zero-inflated part of the model, the dispersion
#' term or the instrumental variables be returned? Applies to models
#' with zero-inflated and/or dispersion formula, or to models with instrumental
#' variable (so called fixed-effects regressions). May be abbreviated. Note that the
#' *conditional* component is also called *count* or *mean*
#' component, depending on the model.
#' @param component Indicates which model component shoild be returned. E.g.,
#' should all predictor variables, predictor variables for the conditional
#' model, the zero-inflated part of the model, the dispersion term or the
#' instrumental variables be returned? See section _Model Components_ for futher
#' details. May be abbreviated. Note that the *conditional* component is also
#' called *count* or *mean* component, depending on the model.
#' @param flatten Logical, if `TRUE`, the values are returned
#' as character vector, not as list. Duplicated values are removed.
#' @param verbose Toggle warnings.
Expand Down Expand Up @@ -47,6 +46,8 @@
#' auxiliary parameters).
#' - `"distributional"` (or `"auxiliary"`): components like `sigma`, `dispersion`,
#' `beta` or `precision` (and other auxiliary parameters) are returned.
#' - Special models are `mhurdle`, which also can have the components
#' `"infrequent_purchase"`, `"ip"`, and `"auxiliary"`.
#'
#' @section Parameters, Variables, Predictors and Terms:
#' There are four functions that return information about the variables in a
Expand Down Expand Up @@ -74,7 +75,7 @@
#'
#' @return A list of character vectors that represent the name(s) of the
#' predictor variables. Depending on the combination of the arguments
#' `effects` and `component`, the returned list has following elements:
#' `effects` and `component`, the returned list can have following elements:
#'
#' - `conditional`, the "fixed effects" terms from the model
#' - `random`, the "random effects" terms from the model
Expand All @@ -87,6 +88,10 @@
#' the instrumental variables
#' - `correlation`, for models with correlation-component like `gls`, the
#' variables used to describe the correlation structure
#' - `nonlinear`, for non-linear models (like models of class `nlmerMod` or
#' `nls`), the staring estimates for the nonlinear parameters
#' - `smooth_terms` returns smooth terms, only applies to GAMs (or similar
#' models that may contain smooth terms)
#'
#' @examples
#' data(mtcars)
Expand Down
13 changes: 6 additions & 7 deletions man/find_interactions.Rd

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

2 changes: 2 additions & 0 deletions man/find_parameters.Rd

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

18 changes: 3 additions & 15 deletions man/find_parameters.zeroinfl.Rd

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

21 changes: 13 additions & 8 deletions man/find_predictors.Rd

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

15 changes: 8 additions & 7 deletions man/find_variables.Rd

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

15 changes: 8 additions & 7 deletions man/get_data.Rd

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

2 changes: 2 additions & 0 deletions man/get_parameters.Rd

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

13 changes: 6 additions & 7 deletions man/get_parameters.betamfx.Rd

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

13 changes: 6 additions & 7 deletions man/get_parameters.betareg.Rd

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

13 changes: 6 additions & 7 deletions man/get_parameters.gamm.Rd

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

13 changes: 6 additions & 7 deletions man/get_parameters.zeroinfl.Rd

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

0 comments on commit 260d2e5

Please sign in to comment.