These S3 methods let the insight package, and through it the easystats
packages parameters, bayestestR and modelbased, read a
bmm fit as the model you specified with bmm(): its parameters, their
formulas, the response variables and the data, rather than the brms
model that bmm builds from them. With them,
for example, parameters::model_parameters() and
bayestestR::describe_posterior() summarise each model parameter in its own
component, and for models such as sdm(),
modelbased::estimate_means(fit, by = "set_size", predict = "c") returns
the estimates of a model parameter on its native scale.
Usage
# S3 method for class 'bmmfit'
find_formula(x, verbose = TRUE, ...)
# S3 method for class 'bmmfit'
find_predictors(
x,
effects = "fixed",
component = "all",
flatten = FALSE,
verbose = TRUE,
...
)
# S3 method for class 'bmmfit'
find_response(x, combine = TRUE, ...)
# S3 method for class 'bmmfit'
get_data(
x,
effects = "all",
component = "all",
source = "frame",
verbose = FALSE,
...
)
# S3 method for class 'bmmfit'
find_parameters(
x,
effects = "all",
component = "all",
flatten = FALSE,
parameters = NULL,
...
)
# S3 method for class 'bmmfit'
get_priors(x, verbose = TRUE, ...)
# S3 method for class 'bmmfit'
model_info(x, response = NULL, ...)
# S3 method for class 'bmmfit'
link_function(x, ...)
# S3 method for class 'bmmfit'
link_inverse(x, ...)Arguments
- x
A
bmmfitobject (created bybmm()).- ...
Ignored, for consistency with the generics.
- effects
"fixed"for the population-level part of the model,"random"for the group-level part or"all"for both: coefficients forfind_parameters(), predictors forfind_predictors(), columns forget_data().find_parameters()also takes"full","random_variance"and"grouplevel", as the methods of insight for brms fits do.- component
"all","conditional","location","distributional"or"auxiliary", which all select every model parameter, or forfind_parameters()the name of a model parameter; ignored byget_data().- flatten
Should a character vector be returned instead of a list?
- combine, source, verbose
Ignored, for consistency with the generics.
- parameters
A regular expression the names of the returned parameters must match.
- response
Ignored, for consistency with the generic.
Details
Each method reshapes what the fit already stores:
find_formula()returns one formula per model parameter, and per helper parameter of a non-linear formula, with the population-level and group-level parts as separate elements (<parameter>and<parameter>_random), plus aconditionalformula of the response variables on all population-level predictors.find_predictors()returns the predictors of these formulas: the population-level predictors foreffects = "fixed", the grouping factors for"random"and both for"all". Every model parameter counts as both a location and a distributional parameter, so eachcomponentreturns the same variables.find_response()returns the names of the response columns, asget_data()returns them.get_data()returns the data the model was fitted to as you passed them: without the columns bmm adds for its own use or brms computes from the formula (such asID:sessionorlog(x)), and with the response categories of a model fitted to counts (e.g.m3()) as columns of their own. Data with one row per trial come back with the response columns you named, such as theratingcolumn ofsdt_rating()or thejudgmentandconfidencecolumns ofsdt_cdp(). The model frame stored in the fit is always the source;sourceis ignored.find_parameters()returns the names of the posterior draws in one element per model parameter (<parameter>for the population-level coefficients,<parameter>_randomfor the group-level ones), without the parameters that the brms family needs but the model does not have, such as the fixedmuof the response-time models.componentselects a model parameter by name;"all","conditional","location","distributional"and"auxiliary"select all of them.insight::get_parameters()andinsight::clean_parameters()build on it.get_priors()returns one row per population-level coefficient, group-level standard deviation and correlation, with the prior that applies to it. A parameter fixed to a constant has the distribution"constant"and the constant as its location.model_info()describes the model as not linear and as having no dispersion parameter; the family is the one of the brms model.link_function()andlink_inverse()return the link function of the first parameter that has one and its inverse. bmm models have one link per parameter, so for anything else usemodel$links.
