How to deal with a variable size of the 'observed' variable

You might find this post helpful where I was trying to explain the mechanism of DensityDist.