I’m trying to launch a Metropolis-Hastings likelihood with a custom distribution function as :

```
dist = getattr(scipy.stats, dist_func)
y_obs = dist.rvs(loc=loc, scale=scale, *arg, size = 10)
def custom(sigma):
y = dist.rvs(loc=loc, scale=scale, *arg, size = 10) + (np.random.uniform(-1, 1, 10) * sigma)
return y
with pm.Model() as model:
sigma = pm.Uniform("sigma", 0, 90, testval=45)
custom = pm.DensityDist('custom', sigma=sigma, observed=y_obs) # likelihood
trace = pm.sample(
draws=2000,
tune=5000,
chains=2,
cores=1,
target_accept=0.9,
return_inferencedata=True,
init="adapt_full",
)
```

However, it tells me that I do not have logp function. I’m very new and I guess that I’m missing something huge. May I have some help ?

Note that :

dist.rvs

is not defined, as the theorical law changes through each loop (not mentionned above)