How to limit a Geometric Discrete Distribution in a range

Hi there!
Just jumping in because I tried implementing @junpenglao’s solution with a Potential:

bike_count = pm.Geometric('bike_count', p, observed=bike_data["count"])
pm.Potential('constraint', tt.switch(bike_count > 1100, -np.inf, 0.))

This samples perfectly, but I’m not sure the constraint was applied, when looking at PPCs:

idata = az.from_pymc3(trace=trace_bike_3, prior=prior_samples, posterior_predictive=post_samples)
az.plot_ppc(idata);

This gives:


PPCs seem to still go way out of range compared to observations, don’t they?