A hierarchical model captures grouped data with multiple levels of variation, organized in a hierarchy. The datapoint
The key is that we want to allow variation between groups. Extending the ๐๏ธ Normal Model, we have
where the mean
This accounts for variation within each group with
Known Variance
First, letโs assume
The prior for
With these priors, our joint posterior is
Breaking this down, the group meansโ conditional posterior is
where
The conditional posterior for global mean is
Finally, the marginal posterior for
which requires ๐งฑ Grid Sampling.
Interpretation
The group means
On the other hand, with
Sampling
To sample from this hierarchical model, we perform the steps below:
- Select grid of values for
. - Calculate
for each grid value. - Sample grid value with probability
. - Sample
. - For each group
, sample . - If we want posterior predictions for group
, sample . - If we want a new group, sample
and .