pp_average.brmsfit {brms} | R Documentation |
Compute posterior predictive samples 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' pp_average( x, ..., weights = "stacking", method = "posterior_predict", nsamples = NULL, summary = TRUE, probs = c(0.025, 0.975), robust = FALSE, model_names = NULL, control = list(), seed = NULL ) pp_average(x, ...)
x |
A |
... |
More |
weights |
Name of the criterion to compute weights from. Should be one
of |
method |
Method used to obtain predictions to average over. Should be
one of |
nsamples |
Total number of posterior samples to use. |
summary |
Should summary statistics
(i.e. means, sds, and 95% intervals) be returned
instead of the raw values? Default is |
probs |
The percentiles to be computed by the |
robust |
If |
model_names |
If |
control |
Optional |
seed |
A single numeric value passed to |
Weights are computed with the model_weights
method.
Same as the output of the method specified
in argument method
.
model_weights
, posterior_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 predicted values (df <- unique(inhaler[, c("treat", "period", "carry")])) pp_average(fit1, fit2, newdata = df) # compute model-averaged fitted values pp_average(fit1, fit2, method = "fitted", newdata = df) ## End(Not run)