# Truncate NormalMixture between 1 and 12

**URL:** https://discourse.pymc.io/t/truncate-normalmixture-between-1-and-12/8603
**Category:** Questions
**Created:** [January 16, 2022, 3:29pm UTC](https://discourse.pymc.io/t/truncate-normalmixture-between-1-and-12/8603 "2022-01-16T15:29:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![luiswilbert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/luiswilbert/32/4700_2.png) [@luiswilbert](https://discourse.pymc.io/u/luiswilbert)
#### Post date: [January 16, 2022, 3:29pm UTC](https://discourse.pymc.io/t/truncate-normalmixture-between-1-and-12/8603/1 "2022-01-16T15:29:20Z")

</div>

Dear community,

Hope you are well!

I’m trying to create a bimodal distribution that represents peak sales during the year (blue line in the figure below).

 ![Peak sales](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/2/2384c662db5f509e016884e3949263f822103b32.png)

I have used the following code to fit the distribution:

```python
n_components = 2
data=df['c2']

with pm.Model() as gauss_mix:

    μ = pm.Normal("μ",data.mean(),10,shape=n_components)
    σ = pm.HalfNormal("σ", 10, shape=n_components)

    weights = pm.Dirichlet("w", np.ones(n_components))

    pm.NormalMixture("y", w=weights, mu=μ, sigma=σ, observed=data)

    trace = pm.sample(draws=1000, tune=2000, target_accept=0.95)

```

The results are :

![Results](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/f/f46b0810baa3f9014ac2c273624c909a48faa26d.png)

However, as you can see in the figure, the distributions is bounded between 1 and 12 (because it’s months). I’m trying to use pm.Bound(pm.NormalMixture, lower=1,upper=12) but it’s not working.

My question: how can I bound the NormalMixture bertween 1 and 12?

Thank you

---

<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: [January 18, 2022, 2:23am UTC](https://discourse.pymc.io/t/truncate-normalmixture-between-1-and-12/8603/2 "2022-01-18T02:23:47Z")

</div>

> [@luiswilbert](#):
>
> I’m trying to use pm.Bound(pm.NormalMixture, lower=1,upper=12) but it’s not working.

Can you say more about what exactly is not working?
