Functions for Hierarchical Bayesian Estimation: A Flexible Approach