posterior_average.brmsfit {brms} | R Documentation |
Extract posterior samples 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, ..., pars = NULL, weights = "stacking", nsamples = NULL, missing = NULL, model_names = NULL, control = list(), seed = NULL ) posterior_average(x, ...)
x |
A |
... |
More |
pars |
Names of parameters for which to average across models. Only those parameters can be averaged that appear in every model. Defaults to all overlapping parameters. |
weights |
Name of the criterion to compute weights from. Should be one
of |
nsamples |
Total number of posterior samples to use. |
missing |
An optional numeric value or a named list of numeric values
to use if a model does not contain a parameter for which posterior samples
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 samples. Samples are rows
and parameters are columns.
## 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)