Multiple Hierarchy Level Modeling with Errors in PYMC

The important line of the error is:

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.