ABC function works independently - but fails in ```pm.Simulator```

Hi @ricardoV94, @jessegrabowski

Checking pm.Categorical outputs solves the problem.

Apologies for my late answer - conference travel preparations came in the way for a bit.
However, thanks to pointers from both of you - I was able to pin down the problem to my use of pm.Categorical - which outputs invalid values that are not within the size set on initialisation. As shared by @jessegrabowski - in this post when within a pm.Model it seems like pm.Categorical also draws invalid values every now and then - and this messes up any kind of indexing. However, when pm.draw is used outside of a model - all output values are within bounds.

My solution was along the lines of the post’s suggestion to use pm.math.clip to only input
values that are sensible:

with pm.Model() as model1:
    scenario_num = pm.Categorical('scenario_num', p=np.tile(1/7,7))
    scenario_checked = pm.math.clip(scenario_num, 0,6)
    ... 
    ...

Now I have a model that runs without errors - but I’m not entirely sure if it would affect the behind-the-scenes accounting?

@ricardoV94 : It would definitely help having some more documentation - to make the input types for pm.Simulator clear. Also, pointing out to the user that the discrete distributions may occasionally provide out-of-bounds outputs within a pm.Model would also be helpful too.