Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Nov 19, 2024
1 parent 1fa1cfe commit edc98f6
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 129 deletions.
2 changes: 1 addition & 1 deletion R/methods_aod.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#' `"conditional"` or `"full"` (for `MuMIn::model.avg()`) or `"all"`. See section
#' _Model components_ for an overview of possible options for `component`.
#' @inheritParams model_parameters.default
#' @inheritParams model_parameters.stanreg
#' @inheritParams model_parameters.brmsfit
#' @inheritParams simulate_model
#'
#' @seealso [insight::standardize_names()] to rename columns into a consistent,
Expand Down
1 change: 1 addition & 0 deletions R/methods_base.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#' @rdname model_parameters.brmsfit
#' @export
model_parameters.data.frame <- function(model,
as_draws = FALSE,
Expand Down
65 changes: 65 additions & 0 deletions R/methods_brms.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,69 @@
#' @title Parameters from Bayesian Models
#' @name model_parameters.brmsfit
#'
#' @description
#' Model parameters from Bayesian models. This function internally calls
#' [`bayestestR::describe_posterior()`] to get the relvant information for
#' the output.
#'
#' @param model Bayesian model (including SEM from **blavaan**. May also be
#' a data frame with posterior samples, however, `as_draws` must be set to
#' `TRUE` (else, for data frames `NULL` is returned).
#' @param ci Credible Interval (CI) level. Default to `0.95` (`95%`). See
#' [bayestestR::ci()] for further details.
#' @param group_level Logical, for multilevel models (i.e. models with random
#' effects) and when `effects = "all"` or `effects = "random"`,
#' include the parameters for each group level from random effects. If
#' `group_level = FALSE` (the default), only information on SD and COR
#' are shown.
#' @param component Which type of parameters to return, such as parameters for the
#' conditional model, the zero-inflation part of the model, the dispersion
#' term, or other auxiliary parameters be returned? Applies to models with
#' zero-inflation and/or dispersion formula, or if parameters such as `sigma`
#' should be included. 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`, or `smooth_terms`, 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`, or `beta`
#' (and other auxiliary parameters) are returned.
#' @param as_draws Logical, if `TRUE` and `model` is of class `data.frame`,
#' the data frame is treated as posterior samples and handled similar to
#' Bayesian models. All arguments in `...` are passed to
#' `model_parameters.draws()`.
#' @inheritParams model_parameters.default
#' @inheritParams bayestestR::describe_posterior
#' @inheritParams insight::get_parameters
#'
#' @seealso [insight::standardize_names()] to rename columns into a consistent,
#' standardized naming scheme.
#'
#' @note When `standardize = "refit"`, columns `diagnostic`, `bf_prior` and
#' `priors` refer to the *original* `model`. If `model` is a data frame,
#' arguments `diagnostic`, `bf_prior` and `priors` are ignored.
#'
#' There is also a
#' [`plot()`-method](https://easystats.github.io/see/articles/parameters.html)
#' implemented in the [**see**-package](https://easystats.github.io/see/).
#'
#' @inheritSection model_parameters Confidence intervals and approximation of degrees of freedom
#'
#' @inheritSection model_parameters.zcpglm Model components
#'
#' @examples
#' \donttest{
#' library(parameters)
#' if (require("rstanarm")) {
#' model <- suppressWarnings(stan_glm(
#' Sepal.Length ~ Petal.Length * Species,
#' data = iris, iter = 500, refresh = 0
#' ))
#' model_parameters(model)
#' }
#' }
#' @return A data frame of indices related to the model's parameters.
#' @export
model_parameters.brmsfit <- function(model,
centrality = "median",
Expand Down
2 changes: 1 addition & 1 deletion R/methods_glmmTMB.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#' up computation of the summary table.
#'
#' @inheritParams model_parameters.default
#' @inheritParams model_parameters.stanreg
#' @inheritParams model_parameters.brmsfit
#' @inheritParams simulate_model
#'
#' @inheritSection model_parameters.zcpglm Model components
Expand Down
7 changes: 3 additions & 4 deletions R/methods_hclust.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#' Format cluster models obtained for example by [kmeans()].
#'
#' @param model Cluster model.
#' @inheritParams model_parameters.default
#' @param data A data frame.
#' @param clusters A vector with clusters assignments (must be same length as
#' rows in data).
#' @param ... Arguments passed to or from other methods.
#'
#' @examplesIf require("factoextra", quietly = TRUE) && require("dbscan", quietly = TRUE) && require("cluster", quietly = TRUE) && require("fpc", quietly = TRUE)
Expand Down Expand Up @@ -123,9 +125,6 @@ model_parameters.hclust <- function(model, data = NULL, clusters = NULL, ...) {
}




#' @inheritParams n_clusters
#' @export
model_parameters.pvclust <- function(model, data = NULL, clusters = NULL, ci = 0.95, ...) {
if (is.null(data)) {
Expand Down
62 changes: 0 additions & 62 deletions R/methods_rstanarm.R
Original file line number Diff line number Diff line change
@@ -1,65 +1,3 @@
#' Parameters from Bayesian Models
#'
#' Parameters from Bayesian models.
#'
#' @param model Bayesian model (including SEM from **blavaan**. May also be
#' a data frame with posterior samples, however, `as_draws` must be set to
#' `TRUE` (else, for data frames `NULL` is returned).
#' @param ci Credible Interval (CI) level. Default to `0.95` (`95%`). See
#' [bayestestR::ci()] for further details.
#' @param group_level Logical, for multilevel models (i.e. models with random
#' effects) and when `effects = "all"` or `effects = "random"`,
#' include the parameters for each group level from random effects. If
#' `group_level = FALSE` (the default), only information on SD and COR
#' are shown.
#' @param component Which type of parameters to return, such as parameters for the
#' conditional model, the zero-inflation part of the model, the dispersion
#' term, or other auxiliary parameters be returned? Applies to models with
#' zero-inflation and/or dispersion formula, or if parameters such as `sigma`
#' should be included. 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`, or `smooth_terms`, 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`, or `beta`
#' (and other auxiliary parameters) are returned.
#' @param as_draws Logical, if `TRUE` and `model` is of class `data.frame`,
#' the data frame is treated as posterior samples and handled similar to
#' Bayesian models. All arguments in `...` are passed to
#' `model_parameters.draws()`.
#' @inheritParams model_parameters.default
#' @inheritParams bayestestR::describe_posterior
#' @inheritParams insight::get_parameters
#'
#' @seealso [insight::standardize_names()] to rename columns into a consistent,
#' standardized naming scheme.
#'
#' @note When `standardize = "refit"`, columns `diagnostic`, `bf_prior` and
#' `priors` refer to the *original* `model`. If `model` is a data frame,
#' arguments `diagnostic`, `bf_prior` and `priors` are ignored.
#'
#' There is also a
#' [`plot()`-method](https://easystats.github.io/see/articles/parameters.html)
#' implemented in the [**see**-package](https://easystats.github.io/see/).
#'
#' @inheritSection model_parameters Confidence intervals and approximation of degrees of freedom
#'
#' @inheritSection model_parameters.zcpglm Model components
#'
#' @examples
#' \donttest{
#' library(parameters)
#' if (require("rstanarm")) {
#' model <- suppressWarnings(stan_glm(
#' Sepal.Length ~ Petal.Length * Species,
#' data = iris, iter = 500, refresh = 0
#' ))
#' model_parameters(model)
#' }
#' }
#' @return A data frame of indices related to the model's parameters.
#' @export
model_parameters.stanreg <- function(model,
centrality = "median",
Expand Down
5 changes: 5 additions & 0 deletions man/cluster_performance.Rd

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

134 changes: 73 additions & 61 deletions man/model_parameters.stanreg.Rd → man/model_parameters.brmsfit.Rd

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

5 changes: 5 additions & 0 deletions man/model_parameters.hclust.Rd

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

0 comments on commit edc98f6

Please sign in to comment.