# Updating a hierarchical model in the face of new data

**URL:** <https://discourse.mc-stan.org/t/updating-a-hierarchical-model-in-the-face-of-new-data/6971>\
**Category:** Modeling\
**Created:** [December 14, 2018, 11:25am UTC](https://discourse.mc-stan.org/t/updating-a-hierarchical-model-in-the-face-of-new-data/6971 "2018-12-14T11:25:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![riccardopinosio](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@riccardopinosio](https://discourse.mc-stan.org/u/riccardopinosio)\
**Post date:** [December 14, 2018, 11:25am UTC](https://discourse.mc-stan.org/t/updating-a-hierarchical-model-in-the-face-of-new-data/6971/1 "2018-12-14T11:25:09Z")

</div>

Hello!

I have the following problem. I have data with an hierarchical structure and I know the parameter values change over time. I get new data every month and I would like to update the model with the new data, where the new data has a higher weight than the previous data points.

Suppose we start with the following hierarchical model:

y\_{ij} \sim N(\alpha\_j, \sigma\_y) \\ \alpha\_j \sim N(\mu\_\alpha, \sigma\_\alpha) \\ \mu\_{\alpha} \sim N(0, 1000)

where j \in \{1, ..., N\} are N groups.

I train this model on an initial dataset, and obtain posterior distributions for the parameters \{\alpha\_j \mid j \in N\}, \mu\_\alpha, \sigma\_\alpha.

I would then like to update the model with data from the next month. Ideally, the hierarchical structure would be preserved. However, assuming I want to update the hierarchical distribution by using the posteriors as priors, I don’t see how to incorporate the information on the alphas that I learned in the earlier stage.

Currently, I lose the hierarchical structure after the initial model training, and use the posteriors on the alphas as priors for the new model, estimating a separate (non-hierarchical) model for each of the groups. To assign more weight to the new month, the standard deviation of the posterior is multiplied by a small factor.

I would rather not abandon the initial hierarchical structure; but I cannot come up with a model that retains it while preserving the information on the individual alphas at the same time. Could you please give suggestions on how to do this?
