What is Hierarchical Bayesian Modeling?

Hierarchical Bayesian modeling is a statistical approach in which parameters for related groups, such as markets, channels or customer segments, are modeled as draws from a shared higher-level distribution. Each group gets its own estimate, but groups with little data borrow strength from the others. This is called partial pooling.

Understanding the basics

Simple regression models assume that all observations come from one population with one set of parameters. Marketing data rarely work that way: customer behavior varies by region, seasonality differs by product category, and channels perform differently across markets. Hierarchical models, also called multilevel models, represent these natural groupings explicitly (Gelman & Hill, 2007).

"Hierarchical" refers to the levels of parameters. For example, channel-level ROI parameters can be nested within a shared distribution that describes how ROI varies across all channels. "Bayesian" means the model uses prior distributions and expresses all estimates as posterior distributions. For background, see What is Bayesian statistics?

No pooling, complete pooling and partial pooling

Consider a Bayesian marketing mix model (MMM) that estimates the return on investment (ROI) of ten marketing channels. There are three ways to set up the ROI parameters (Gelman & Hill, 2007):

  1. No pooling: estimate each channel separately, with its own prior. This gives ten separate ROI estimates, but estimates for small channels with little data may be unstable.
  2. Complete pooling: estimate one ROI for all channels. The estimate is stable and may describe the overall effectiveness of marketing, but it is useless for budget allocation between channels.
  3. Partial pooling: estimate a separate ROI for each channel, but draw all of them from a common distribution whose mean and spread are also estimated. Channels with little data are pulled toward the shared mean, while channels with plenty of data keep estimates close to their own evidence.

A hierarchical model implements partial pooling. The amount of pooling is not fixed in advance: it is learned from how much the groups actually differ (Gelman et al., 2013).

How it is used in marketing measurement

Multiple markets or regions: rather than treating each market as completely separate or as identical, the model lets markets share information while keeping local differences. Sun et al. (2017) propose a geo-level Bayesian hierarchical MMM and report that, when sub-national data are available, it generally gives tighter credible intervals than a model using national data alone.

Multiple brands or products: pooling data from several brands within a product category gives the model more observations and more variation in media spend (Wang et al., 2017).

Marketing channels and campaigns: channels or campaigns within a channel can have their own parameters linked through a shared distribution, which stabilizes estimates for small campaigns.

Customer segments: segment-level responses can be estimated while borrowing strength from the overall population when a segment's data are limited.

For a worked comparison, see Bayesian hierarchical vs. non-hierarchical modeling compared.

Key advantages

  • Partial pooling: more stable estimates for small groups without forcing all groups to be identical.
  • Uncertainty quantification: every group-level estimate comes with a credible interval, which decision makers need to judge how much to trust a channel's or market's ROI.
  • Prior knowledge: benchmarks and experiment results can be formally incorporated as priors.
  • Unbalanced data: groups with different amounts of data can be modeled together.

Other applications

Customer lifetime value: when estimating lifetime value across customer segments or acquisition channels, hierarchical models share information between similar segments.

Experiments across markets: when the same test runs in several markets or periods, a hierarchical model can combine the results while allowing the effect to vary by context. See using cross-country incrementality evidence in MMM.

Implementation considerations

  • Computation: hierarchical Bayesian models are sampled with MCMC and can take longer to run than simple regressions, especially on large datasets.
  • Model specification: the hierarchy must reflect how the data are actually structured. Poorly specified models can have sampling problems, such as poor convergence. Switching from a centered to a non-centered parametrization often helps (Gelman et al., 2013).
  • Priors on the group-level spread: these control how strongly groups are pulled together. Too-informative priors can bias results; too-vague priors can cause computational problems.
  • Validation and communication: teams need processes for checking model assumptions and explaining uncertainty to stakeholders.

A practical path is to start with a non-hierarchical Bayesian model and a simple hierarchy, for example one channel across regions, before moving to multi-channel, multi-market models.

Key takeaways

  • Hierarchical Bayesian models estimate group-level parameters that share a common distribution.
  • Partial pooling sits between modeling each group separately and treating all groups as identical, and the data decide how much pooling to apply.
  • In MMM, hierarchies across geographies, brands or campaigns can give more stable and more precise estimates than separate or fully aggregated models.

Related terms

Further reading on Sellforte

References

  1. Gelman, A., & Hill, J. (2007). Data analysis using regression and multilevel/hierarchical models. Cambridge University Press. https://doi.org/10.1017/CBO9780511790942
  2. Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., & Rubin, D. B. (2013). Bayesian data analysis (3rd ed.). CRC Press. https://www.oreilly.com/library/view/-/9781439898222/
  3. Sun, Y., Wang, Y., Jin, Y., Chan, D., & Koehler, J. (2017). Geo-level Bayesian hierarchical media mix modeling. Google Inc. https://research.google/pubs/pub46000/
  4. Wang, Y., Jin, Y., Sun, Y., Chan, D., & Koehler, J. (2017). A hierarchical Bayesian approach to improve media mix models using category data. Google Inc. https://research.google/pubs/pub45999/

Authors

Paavo

Dr. Paavo Niskala is a Principal Engineer at Sellforte. With PhD in the field of computational plasma physics, he has over 10 years of experience in designing and building complex data-intensive systems. Paavo has especially focused on using data science in critical business applications, such as Marketing Mix Modeling, which helps businesses make better marketing decisions. Follow Paavo in LinkedIn.