# How to define new likelihood by myself using pymc3

**URL:** <https://discourse.pymc.io/t/how-to-define-new-likelihood-by-myself-using-pymc3/13194>\
**Category:** v3\
**Created:** [October 29, 2023, 10:05am UTC](https://discourse.pymc.io/t/how-to-define-new-likelihood-by-myself-using-pymc3/13194 "2023-10-29T10:05:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![majf](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@majf](https://discourse.pymc.io/u/majf)\
**Post date:** [October 29, 2023, 10:05am UTC](https://discourse.pymc.io/t/how-to-define-new-likelihood-by-myself-using-pymc3/13194/1 "2023-10-29T10:05:46Z")

</div>

I’m using pymc3 to process some experimental data.I need to define a likelihood by myself to remove background signal.But I don’t know how. I want to define a new likelihood, The expression of likelihood is,which is a sum of a series of normal likelihood, they have different mu and their sigma are same.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/d/d444a641d9e4b3488584f10cb631bb57203efc41.png)  
The expression of the posterior is  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/8/8218cac3dea8d90f36a67e50cd474caa5550647f.png)  
I don’t know how to define a likelihood like that.If I use CustomDist to define it, which kind of Generator Function should I choose?If there are other ways to achieve this?I’m a new user of pymc3, so any advice is helpful.

---

<div class="post-metadata">

**Author:** ![cluhmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cluhmann/32/3083_2.png) [@cluhmann](https://discourse.pymc.io/u/cluhmann)\
**Post date:** [October 30, 2023, 5:59pm UTC](https://discourse.pymc.io/t/how-to-define-new-likelihood-by-myself-using-pymc3/13194/2 "2023-10-30T17:59:08Z")

</div>

Can you generate simulated data that mirrors the sum of a series of normals? That’s sometimes a good place to begin.
