I am trying to code a model in PyMC3 within which I would like to draw N points from a custom distribution. I would like to do something like
with pm.Model() as model: a = pm.Normal('a', mu=1.0, sd=1.0) b = pm.Normal('b', mu=1.0, sd=1.0) my_dist = MyDist('MyDist', a, b, shape=(nval)) pred = f(my_dist) obs = pm.Poisson('obs', mu=pred, observed=my_values) trace = pm.sample()
In my case “MyDist” is a custom distribution which is basically a power law with an exponential cut-off multiplied by an error function, and f(my_dist) is some arithmetic operation with the values drawn from the custom distribution. Basically the line calling MyDist would be equivalent to using some built-in distribution here and drawing from it. I looked into pm.DensityDist and pm.Potential but I couldn’t find a way to use them other than as a custom likelihood (i.e. with observed data). Can someone help me out?