Get model parameters from Bayesian models
Returns the coefficients (or posterior samples for Bayesian models) from a model.
## S3 method for class 'BGGM' get_parameters( x, component = c("correlation", "conditional", "intercept", "all"), summary = FALSE, centrality = "mean", ... ) ## S3 method for class 'MCMCglmm' get_parameters( x, effects = c("fixed", "random", "all"), summary = FALSE, centrality = "mean", ... ) ## S3 method for class 'BFBayesFactor' get_parameters( x, effects = c("all", "fixed", "random"), component = c("all", "extra"), iterations = 4000, progress = FALSE, verbose = TRUE, summary = FALSE, centrality = "mean", ... ) ## S3 method for class 'stanmvreg' get_parameters( x, effects = c("fixed", "random", "all"), parameters = NULL, summary = FALSE, centrality = "mean", ... ) ## S3 method for class 'brmsfit' get_parameters( x, effects = "fixed", component = "all", parameters = NULL, summary = FALSE, centrality = "mean", ... ) ## S3 method for class 'stanreg' get_parameters( x, effects = c("fixed", "random", "all"), component = c("location", "all", "conditional", "smooth_terms", "sigma", "distributional", "auxiliary"), parameters = NULL, summary = FALSE, centrality = "mean", ... ) ## S3 method for class 'bayesx' get_parameters( x, component = c("conditional", "smooth_terms", "all"), summary = FALSE, centrality = "mean", ... ) ## S3 method for class 'bamlss' get_parameters( x, component = c("all", "conditional", "smooth_terms", "location", "distributional", "auxiliary"), parameters = NULL, summary = FALSE, centrality = "mean", ... ) ## S3 method for class 'sim.merMod' get_parameters( x, effects = c("fixed", "random", "all"), parameters = NULL, summary = FALSE, centrality = "mean", ... ) ## S3 method for class 'sim' get_parameters(x, parameters = NULL, summary = FALSE, centrality = "mean", ...)
x |
A fitted model. |
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:
|
summary |
Logical, indicates whether the full posterior samples
( |
centrality |
Only for models with posterior samples, and when
|
... |
Currently not used. |
effects |
Should parameters for fixed effects, random effects or both be returned? Only applies to mixed models. May be abbreviated. |
iterations |
Number of posterior draws. |
progress |
Display progress. |
verbose |
Toggle messages and warnings. |
parameters |
Regular expression pattern that describes the parameters that should be returned. |
In most cases when models either return different "effects" (fixed,
random) or "components" (conditional, zero-inflated, ...), the arguments
effects
and component
can be used.
The posterior samples from the requested parameters as data frame.
If summary = TRUE
, returns a data frame with two columns: the
parameter names and the related point estimates (based on centrality
).
Note that for BFBayesFactor
models (from the BayesFactor
package), posteriors are only extracted from the first numerator model (i.e.,
model[1]
). If you want to apply some function foo()
to another
model stored in the BFBayesFactor
object, index it directly, e.g.
foo(model[2])
, foo(1/model[5])
, etc.
See also weighted_posteriors
.
data(mtcars) m <- lm(mpg ~ wt + cyl + vs, data = mtcars) get_parameters(m)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.