# How do Bayesian hierarchical models adaptively learn the prior?

It seems the main difference between a hierarchical and a non hierarchical model is that the hierarchical model learns the prior. That is it adaptively comes up with a regularizing prior to be applied to all clusters/groups in the hierarchy.

This is similar to simply finding an empirical mean and variance (or other parameters) and using these to define your regularizing prior. My understanding is that this method is called empirical Bayes and ignores the uncertainty around the mean and the uncertainty around the variance (or any of the prior parameter empirical estimates). And it is reasonable clear how one comes up with these empirical estimates.

But how does allowing a hyperparameter to be distributed by some hyperprior allow the model to learn from all the other clusters/groups and find the ideal parameters to regularize?

I am reading McElreath's Statistical Rethinking and have a sense how to mechanical set up a sampling chain, however I seem to be missing the intuition on how the model can transfer information from cluster to cluster.

A hierarchical Bayes structure is a special form of prior structure in that, if $$\theta|\eta\sim\pi_1(\theta|\eta)\quad\text{and}\quad\eta\sim\pi_2(\eta)$$ then$$\theta\sim\int \pi_1(\theta|\eta)\pi_2(\eta)\text{d}\eta\tag{1}$$ In this (mathematical) sense, the prior does not "learn" from the data in that it remains a prior. (And "adaptively" sounds redundant in this setting.) Obviously, the hyperparameter $$\eta$$ also enjoys a posterior distribution $$\pi_2(\eta|x^\text{obs})$$, which exploits the information brought on $$\eta$$ by the observation $$x^\text{obs}$$ through $$\theta$$. But the big difference with an "empirical Bayes" non-Bayesian approach is that the latter uses a plug-in $$\pi_1(\theta|\hat\eta(x^ \text{obs}))$$ instead of (1)