# How do updates of parameters in bayesian hierarchical models work?

I'm starting my way in the bayesian data analysis and I'm struggling to understand one thing. Let's say we define a hierarchical model like this one:

$$y_i| \theta _{g_{i}} \sigma ^2 ∼ N(\theta_{g_{i}} , \sigma ^2), i\in \{1...50\}, {g_{i}} \in \{1,...,5\}$$ $$\theta _{g}| \mu, \tau^2 ∼ N(\mu , \tau^2), {g} \in \{1,...,5\}$$ $$\mu ∼ N(0, 1000)$$ $$\tau^2 ∼ InvGamma(1, 1)$$ $$\sigma^2 ∼ InvGamma(1, 1)$$

It's a hierarchical model for economic growth for 50 companies belonging to 5 different sectors. There is a mean for each group ($$\theta_g$$) and a global mean for all companies ($$\mu$$). As far as I know, it's a simple hierarchical model.

My question is how parameters are updated. I mean, let's suppose that I fit the model to the dataset obtaining posterior distribution for all parameters. And let's suppose that I receive 20 observations more. Now, given that I have an updated distribution for all $$\theta_g$$, should I use this distribution as an starting point? If so, the "global parameters" $$\mu$$ and $$\tau$$ won't play any role in this new update of the parameters of the model?

I am very confused about this. To rephrase it, I see $$\mu$$ and $$\tau$$ only as a way of defining my prior distribution for $$\theta_g$$, but once I have an updated posterior distribution for the mean across each sector, I don't see how to use $$\mu$$ and $$\tau$$ (in case I have to use them).

I hope my question make sense... Thanks a lot in advance.

## 1 Answer

There doesn't seem to be any growth here, but none the less the question can be answered.

Typically, if you can write down the closed form of the posterior distribution, then that becomes your prior when you go onto condition on new data. Gelman and co-authors present a very similar model in chapter 5 of Bayesian Data Analysis known as the 8 schools model. You're free to reference their analysis to see how the marginal posterior for $$\mu$$ and $$\tau$$ can be obtained and how similar the posterior looks to your present model, suggesting how the updating can be done.

If instead you wish to use something like Stan or pyMC to compute the posterior, things become a little different. Although in principle we can use the posterior as our prior in subsequent analysis, in practice it is often easier to just refit the model with all new data. No need to approximate the marginal posteriors and write a new model.

• Thank you very much for your response. I'll check that out. Anyway, just to see if I undestood correctly, $\mu$ and $\tau$ only have a role for specifying the prior distribution of $\theta_g$, so that once that I have a posterior for $\theta_g$ they won´t be needed anymore (unless, for example, a new group appears). Is this correct? Jan 7 at 10:00