MCMC sampling does not work when execute

Metropolis-Hastings certainly doesn’t work well in general for combinatorially hard problems like variable selection where there are exponentially many variable configurations and a very high degree of dependency.

In many models that can be expressed using integer parameters, it’s almost always more efficient and robust in Stan or in other systems, to marginalize them out if it’s tractable.

For something like missing Poisson data, Metropolis might work. The problem you’ll have is that HMC is very sensitive to its tuning parameters and changing the discrete parameters changes the continuous part of the posterior conditionally. You can code this in PyMC3, but you should be careful in checking conergence. As far as I know, they haven’t extensively evaluated whether these models work. For instance, you’ll want to be careful about divergences which will indicate potential bias in estimates (don’t know if PyMC3 reports these, but they probably do). The way to test more generally is to generate fake data from the model then make sure you can recover the model parameters to within posterior intervals. And please report back if you’re successful—I’m curious as to how something like this will go in PyMC3.

1 Like