Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify docs #963

Merged
merged 7 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ S3method(get_parameters,glimML)
S3method(get_parameters,glmgee)
S3method(get_parameters,glmm)
S3method(get_parameters,glmmTMB)
S3method(get_parameters,glmmadmb)
S3method(get_parameters,glmmTMBadmb)
S3method(get_parameters,glmx)
S3method(get_parameters,hglm)
S3method(get_parameters,htest)
Expand Down
2 changes: 0 additions & 2 deletions R/find_parameters_bayesian.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#'
#' @param parameters Regular expression pattern that describes the parameters that
#' should be returned.
#' @param effects Should parameters for fixed effects, random effects
#' or both be returned? Only applies to mixed models. May be abbreviated.
#' @param ... Currently not used.
#' @inheritParams find_parameters
#' @inheritParams find_parameters.betamfx
Expand Down
36 changes: 20 additions & 16 deletions R/find_parameters_mfx.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,31 @@
#' @name find_parameters.betamfx
#'
#' @description Returns the names of model parameters, like they typically
#' appear in the `summary()` output.
#' appear in the `summary()` output.
#'
#' @param component Which type of parameters to return, such as parameters for the
#' conditional model, the zero-inflated part of the model, the dispersion
#' term, the instrumental variables or marginal effects be returned? Applies
#' to models with zero-inflated and/or dispersion formula, or to models with
#' instrumental variables (so called fixed-effects regressions), or models
#' with marginal effects from **mfx**. May be abbreviated. Note that the
#' *conditional* component is also called *count* or *mean*
#' component, depending on the model. There are three convenient shortcuts:
#' `component = "all"` returns all possible parameters.
#' If `component = "location"`, location parameters such as `conditional`,
#' `zero_inflated`, `smooth_terms`, or `instruments` are returned
#' (everything that are fixed or random effects - depending on the `effects`
#' argument - but no auxiliary parameters). For `component = "distributional"`
#' (or `"auxiliary"`), components like `sigma`, `dispersion`,
#' `beta` or `precision` (and other auxiliary parameters) are returned.
#' @param component Which type of parameters to return, such as parameters for
#' the conditional model, the zero-inflated part of the model, the dispersion
#' term, the instrumental variables or marginal effects be returned? Applies to
#' models with zero-inflated and/or dispersion formula, or to models with
#' instrumental variables (so called fixed-effects regressions), or models with
#' marginal effects from **mfx**. See details in section _Model Components_ .May
#' be abbreviated. Note that the *conditional* component also refers to the
#' *count* or *mean* component - names may differ, depending on the modeling
#' package. There are three convenient shortcuts:
#' - `component = "all"` returns all possible parameters.
#' - If `component = "location"`, location parameters such as `conditional`,
#' `zero_inflated`, `smooth_terms`, or `instruments` are returned (everything
#' that are fixed or random effects - depending on the `effects` argument -
#' but no auxiliary parameters).
#' - For `component = "distributional"` (or `"auxiliary"`), components like
#' `sigma`, `dispersion`, `beta` or `precision` (and other auxiliary
#' parameters) are returned.
#' @param ... Currently not used.
#' @inheritParams find_parameters
#' @inheritParams find_predictors
#'
#' @inheritSection find_predictors Model components
#'
#' @return A list of parameter names. The returned list may have following
#' elements:
#'
Expand Down
15 changes: 12 additions & 3 deletions R/find_parameters_mixed.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
#' are fixed or random effects - depending on the `effects` argument -
#' but no auxiliary parameters). For `component = "distributional"` (or
#' `"auxiliary"`), components like `sigma` or `dispersion` (and
#' other auxiliary parameters) are returned.
#' other auxiliary parameters) are returned. See section _Model Component_
#' for details.
#' @param ... Currently not used.
#' @inheritParams find_parameters
#' @inheritParams find_parameters.betamfx
#' @inheritParams find_parameters.BGGM
#' @inheritParams find_predictors
#'
#' @inheritSection find_predictors Model components
#'
#' @return A list of parameter names. The returned list may have following
#' elements, usually returned based on the combination of the `effects` and
#' `component` arguments:
Expand All @@ -47,7 +50,10 @@
#' @export
find_parameters.glmmTMB <- function(x, effects = "all", component = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))
component <- validate_argument(component, c("all", "conditional", "zi", "zero_inflated", "dispersion"))
component <- validate_argument(
component,
c("all", "conditional", "zi", "zero_inflated", "dispersion", "location", "distributional", "auxiliary")
)

# installed
check_if_installed("lme4")
Expand Down Expand Up @@ -151,7 +157,10 @@ find_parameters.nlmerMod <- function(x, effects = "all", component = "all", flat
#' @export
find_parameters.hglm <- function(x, effects = "all", component = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))
component <- validate_argument(component, c("all", "conditional", "dispersion"))
component <- validate_argument(
component,
c("all", "conditional", "dispersion", "location", "distributional", "auxiliary")
)

fe <- x$fixef
re <- x$ranef
Expand Down
2 changes: 2 additions & 0 deletions R/find_parameters_zi.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#' @inheritParams find_parameters.betamfx
#' @inheritParams find_predictors
#'
#' @inheritSection find_predictors Model components
#'
#' @return A list of parameter names. The returned list may have following
#' elements:
#'
Expand Down
20 changes: 13 additions & 7 deletions R/find_predictors.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#' the original variable names from the data that was used to fit the model.
#'
#' @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 effects Should variables for fixed effects (`"fixed"`), random effects
#' (`"random"`) or both (`"all"`) be returned? Only applies to mixed models. May
#' be abbreviated.
#' @param component Indicates which model component should 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
Expand Down Expand Up @@ -49,11 +50,16 @@
#' **Special models**
#'
#' Some model classes also allow rather uncommon options. These are:
#' - `mhurdle`: `"infrequent_purchase"`, `"ip"`, and `"auxiliary"`
#' - `BGGM`: `"correlation"` and `"intercept"`
#' - `BFBayesFactor`, `glmx`: `"extra"`
#' - `averaging`:`"conditional"` and `"full"`
#' - `mjoint`: `"survival"`
#' - **mhurdle**: `"infrequent_purchase"`, `"ip"`, and `"auxiliary"`
#' - **BGGM**: `"correlation"` and `"intercept"`
#' - **BFBayesFactor**, **glmx**: `"extra"`
#' - **averaging**:`"conditional"` and `"full"`
#' - **mjoint**: `"survival"`
#' - **mfx**: `"precision"`, `"marginal"`
#'
#' For models of class `brmsfit` (package **brms**), `component`, even more
#' options are possible for the `component` argument, which are not all
#' documented in detail here.
#'
#' @section Parameters, Variables, Predictors and Terms:
#' There are four functions that return information about the variables in a
Expand Down
2 changes: 1 addition & 1 deletion R/get_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' - [Estimated marginal means][get_parameters.emmGrid] (**emmeans**)
#' - [Generalized additive models][get_parameters.gamm] (**mgcv**, **VGAM**, ...)
#' - [Marginal effects models][get_parameters.betamfx] (**mfx**)
#' - [Mixed models][get_parameters.glmm] (**lme4**, **glmmTMB**, **GLMMadaptive**, ...)
#' - [Mixed models][get_parameters.glmmTMB] (**lme4**, **glmmTMB**, **GLMMadaptive**, ...)
#' - [Zero-inflated and hurdle models][get_parameters.zeroinfl] (**pscl**, ...)
#' - [Models with special components][get_parameters.betareg] (**betareg**, **MuMIn**, ...)
#' - [Hypothesis tests][get_parameters.htest] (`htest`)
Expand Down
Loading
Loading