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 3c5b699 commit cd73d6d
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 116 deletions.
10 changes: 4 additions & 6 deletions R/find_parameters_mixed.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#' @inheritParams find_predictors
#'
#' @return A list of parameter names. The returned list may have following
#' elements:
#' elements, usually returned based on the combination of the `effects` and
#' `component` arguments:
#'
#' - `conditional`, the "fixed effects" part from the model.
#' - `random`, the "random effects" part from the model.
Expand Down Expand Up @@ -410,11 +411,8 @@ find_parameters.glimML <- function(x, effects = "all", flatten = FALSE, ...) {


#' @export
find_parameters.mixor <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
effects <- match.arg(effects)
find_parameters.mixor <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))
coefs <- x$Model
random_start <- grep("(\\(Intercept\\) \\(Intercept\\)|Random\\.\\(Intercept\\))", rownames(coefs))
thresholds <- grep("Threshold\\d", rownames(coefs))
Expand Down
58 changes: 23 additions & 35 deletions R/find_parameters_other.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
#' @inheritParams find_predictors
#'
#' @return A list of parameter names. The returned list may have following
#' elements:
#' elements, usually requested via the `component` argument:
#'
#' - `conditional`, the "fixed effects" part from the model.
#' - `full`, parameters from the full model.
#' - `precision` for models of class `betareg`.
#' - `survival` for model of class `mjoint`.
#' - `extra` for models of class `glmx`.
#'
#' @examples
#' data(mtcars)
#' m <- lm(mpg ~ wt + cyl + vs, data = mtcars)
#' find_parameters(m)
#' @export
find_parameters.averaging <- function(x,
component = c("conditional", "full"),
flatten = FALSE,
...) {
component <- match.arg(component)
find_parameters.averaging <- function(x, component = "conditional", flatten = FALSE, ...) {
component <- validate_argument(component, c("conditional", "full"))
cf <- stats::coef(x, full = component == "full")
out <- list(conditional = text_remove_backticks(names(cf)))

Expand All @@ -36,13 +36,9 @@ find_parameters.averaging <- function(x,
}


#' @rdname find_parameters.averaging
#' @export
find_parameters.glmgee <- function(x,
component = c("all", "conditional", "dispersion"),
flatten = FALSE,
...) {
component <- match.arg(component)
find_parameters.glmgee <- function(x, component = "all", flatten = FALSE, ...) {
component <- validate_argument(component, c("all", "conditional", "dispersion"))

junk <- utils::capture.output({
cs <- suppressWarnings(stats::coef(summary(x, corr = FALSE)))
Expand All @@ -64,13 +60,13 @@ find_parameters.glmgee <- function(x,
}


#' @rdname find_parameters.averaging
#' @export
find_parameters.betareg <- function(x,
component = c("all", "conditional", "precision", "location", "distributional", "auxiliary"),
flatten = FALSE,
...) {
component <- match.arg(component)
find_parameters.betareg <- function(x, component = "all", flatten = FALSE, ...) {
component <- validate_argument(
component,
c("all", "conditional", "precision", "location", "distributional", "auxiliary")
)

pars <- list(
conditional = names(x$coefficients$mean),
precision = names(x$coefficients$precision)
Expand All @@ -87,13 +83,12 @@ find_parameters.betareg <- function(x,
}


#' @rdname find_parameters.averaging
#' @export
find_parameters.DirichletRegModel <- function(x,
component = c("all", "conditional", "precision", "location", "distributional", "auxiliary"),
flatten = FALSE,
...) {
component <- match.arg(component)
find_parameters.DirichletRegModel <- function(x, component = "all", flatten = FALSE, ...) {
component <- validate_argument(
component,
c("all", "conditional", "precision", "location", "distributional", "auxiliary")
)
if (x$parametrization == "common") {
pars <- list(conditional = names(unlist(stats::coef(x))))
} else {
Expand All @@ -116,13 +111,9 @@ find_parameters.DirichletRegModel <- function(x,
}


#' @rdname find_parameters.averaging
#' @export
find_parameters.mjoint <- function(x,
component = c("all", "conditional", "survival"),
flatten = FALSE,
...) {
component <- match.arg(component)
find_parameters.mjoint <- function(x, component = "all", flatten = FALSE, ...) {
component <- validate_argument(component, c("all", "conditional", "survival"))
s <- summary(x)

out <- list(
Expand All @@ -140,12 +131,9 @@ find_parameters.mjoint <- function(x,
}


#' @rdname find_parameters.averaging
#' @export
find_parameters.glmx <- function(x,
component = c("all", "conditional", "extra"),
flatten = FALSE,
...) {
find_parameters.glmx <- function(x, component = "all", flatten = FALSE, ...) {
component <- validate_argument(component, c("all", "conditional", "extra"))
cf <- stats::coef(summary(x))

out <- list(
Expand Down
11 changes: 6 additions & 5 deletions R/find_predictors.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@
#'
#' **Special models**
#'
#' Some model classes also allow rather uncommon options. These are:#'
#' - `mhurdle`, which also can have the components `"infrequent_purchase"`,
#' `"ip"`, and `"auxiliary"`.
#' - `BGGM`, which also allows options `"correlation"` and `"intercept"`.
#' - `BGBFBayesFactorGM`, which also allows the option `"extra"`.
#' 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"`
#'
#' @section Parameters, Variables, Predictors and Terms:
#' There are four functions that return information about the variables in a
Expand Down
11 changes: 6 additions & 5 deletions man/find_parameters.Rd

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

49 changes: 5 additions & 44 deletions man/find_parameters.averaging.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/find_parameters.glmmTMB.Rd

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

11 changes: 6 additions & 5 deletions man/find_predictors.Rd

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

11 changes: 6 additions & 5 deletions man/find_variables.Rd

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

11 changes: 6 additions & 5 deletions man/get_data.Rd

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

11 changes: 6 additions & 5 deletions man/get_parameters.Rd

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

0 comments on commit cd73d6d

Please sign in to comment.