Averages the area-level predictions across multiple fitted HBMs.
Weights may be supplied manually or computed automatically
from leave-one-out cross-validation via
loo_model_weights – the canonical Bayesian
stacking / pseudo-BMA approach of Yao et al.\ (2018).
Usage
model_average(
...,
weights = NULL,
method = c("manual", "stacking", "pseudobma"),
newdata = NULL
)Arguments
- ...
Two or more
hbmfitobjects.- weights
Numeric weights of the same length as the number of models, or
NULL. WhenNULLandmethod = "manual", equal weights are used.- method
Character. Weighting method:
"manual"(default),"stacking"(Yao et al. 2018), or"pseudobma". When"stacking"or"pseudobma",weightsmust beNULL; an error is raised otherwise.- newdata
Optional new
data.frameforwarded tosae_predict.
Value
An hbsae_results object of averaged predictions. The
computed weights are attached as an attribute "weights".
Details
Three weighting modes are supported:
method = "manual"(default whenweightsis supplied): use the user-suppliedweightsvector directly. Internally normalised to sum to 1.method = "stacking": weights are obtained fromloo::loo_model_weights(loo_list, method = "stacking"), which optimises a log-score over a simplex. Recommended when models are well-specified but capture different features of the data (Yao et al.\ 2018).method = "pseudobma": weights are obtained fromloo::loo_model_weights(loo_list, method = "pseudobma"), a smoothed pseudo-BMA+ that resembles classical BMA but uses PSIS-LOO log scores. Use as a robust default when one model is much better than the others.
Internally calls sae_predict on each model and then
sae_aggregate with method = "weighted".
References
Yao, Y., Vehtari, A., Simpson, D., & Gelman, A. (2018). Using stacking to average Bayesian predictive distributions (with discussion). Bayesian Analysis, 13(3), 917–1007. doi:10.1214/17-BA1091
Vehtari, A., Gelman, A., & Gabry, J. (2017). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing, 27(5), 1413–1432.