View source: R/model_weights.R
posterior_average.brmsfit | R Documentation |
Extract posterior draws of parameters averaged across models. Weighting can be done in various ways, for instance using Akaike weights based on information criteria or marginal likelihoods.
## S3 method for class 'brmsfit'
posterior_average(
x,
...,
variable = NULL,
pars = NULL,
weights = "stacking",
ndraws = NULL,
nsamples = NULL,
missing = NULL,
model_names = NULL,
control = list(),
seed = NULL
)
posterior_average(x, ...)
x |
A |
... |
More |
variable |
Names of variables (parameters) for which to average across models. Only those variables can be averaged that appear in every model. Defaults to all overlapping variables. |
pars |
Deprecated alias of |
weights |
Name of the criterion to compute weights from. Should be one
of |
ndraws |
Total number of posterior draws to use. |
nsamples |
Deprecated alias of |
missing |
An optional numeric value or a named list of numeric values
to use if a model does not contain a variable for which posterior draws
should be averaged. Defaults to |
model_names |
If |
control |
Optional |
seed |
A single numeric value passed to |
Weights are computed with the model_weights
method.
A data.frame
of posterior draws.
model_weights
, pp_average
## Not run:
# model with 'treat' as predictor
fit1 <- brm(rating ~ treat + period + carry, data = inhaler)
summary(fit1)
# model without 'treat' as predictor
fit2 <- brm(rating ~ period + carry, data = inhaler)
summary(fit2)
# compute model-averaged posteriors of overlapping parameters
posterior_average(fit1, fit2, weights = "waic")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.