# Multiple Hierarchy Level Modeling with Errors in PYMC

**URL:** <https://discourse.pymc.io/t/multiple-hierarchy-level-modeling-with-errors-in-pymc/14431>\
**Category:** v5\
**Tags:** bug, modeling\
**Created:** [May 14, 2024, 10:44pm UTC](https://discourse.pymc.io/t/multiple-hierarchy-level-modeling-with-errors-in-pymc/14431 "2024-05-14T22:44:54Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jessegrabowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jessegrabowski/32/5010_2.png) [@jessegrabowski](https://discourse.pymc.io/u/jessegrabowski)\
**Post date:** [May 15, 2024, 4:09am UTC](https://discourse.pymc.io/t/multiple-hierarchy-level-modeling-with-errors-in-pymc/14431/4 "2024-05-15T04:09:14Z")

</div>

The important line of the error is:

```auto
ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between arg 0 with shape (3,) and arg 1 with shape (2530,).

```

Via your coords, you declared that the shape of `cvemun` is 3, but via `mu_cve_ent[idx_cveent]`, you gave it a mean vector with shape 2530. These don’t match, so you get an error.

To do this kind of nested or telescoping hierarchy, you need to create mapping between the unique values at each level. You don’t actually want to expand to the level of the observation until after you’ve done all the nesting. Some comments [here](https://discourse.pymc.io/t/hierarchical-model-with-uneven-categories/14206/3).

---

_[View the full topic](https://discourse.pymc.io/t/multiple-hierarchy-level-modeling-with-errors-in-pymc/14431)._
