# Custom likelihood for multinomial model

**URL:** <https://discourse.pymc.io/t/custom-likelihood-for-multinomial-model/12433>\
**Category:** v5\
**Tags:** modeling\
**Created:** [July 3, 2023, 1:13pm UTC](https://discourse.pymc.io/t/custom-likelihood-for-multinomial-model/12433 "2023-07-03T13:13:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandonhorsley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/brandonhorsley/32/6693_2.png) [@brandonhorsley](https://discourse.pymc.io/u/brandonhorsley)\
**Post date:** [July 3, 2023, 1:13pm UTC](https://discourse.pymc.io/t/custom-likelihood-for-multinomial-model/12433/1 "2023-07-03T13:13:48Z")

</div>

Hello all, I am relatively new to PyMC and have a question about the result of some code that i have drafted up. Essentially my code is as follows:  
[Neville\_thesis\_8.py](https://discourse.pymc.io/uploads/short-url/7wUeXPwuYItVE22K5Doy4AGVPSS.py) (6.7 KB)  
(hopefully this attachment works)

So my question is that i am using a numpy blackbox function for the likelihood where it takes in a given value for my hyperparameters to produce the probabilities p that dictate the multinomial function. But a came across this page in the example gallery:

> **[Using a “black box” likelihood function (numpy)](https://www.pymc.io/projects/examples/en/latest/case_studies/blackbox_external_likelihood_numpy.html)**
>
> Introduction: PyMC is a great tool for doing Bayesian inference and parameter estimation. It has a load of in-built probability distributions that you can use to set up priors and likelihood functi...

which suggests that this approach shouldn’t work but when i run my code i get a plot out so I am curious if it is the use of the shape argument of the likelihood in the model context manager that is meaning it still works or if it is just sampling the priors I am not 100% sure!

Any help would be appreciated and am happy to answer further questions to help explain the process if need be. Thanks in advance!
