# Mixture regression

**URL:** <https://discourse.pymc.io/t/mixture-regression/2603>\
**Category:** Questions\
**Created:** [January 29, 2019, 4:55pm UTC](https://discourse.pymc.io/t/mixture-regression/2603 "2019-01-29T16:55:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jack\_c](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jack\_c](https://discourse.pymc.io/u/jack_c)\
**Post date:** [January 29, 2019, 4:55pm UTC](https://discourse.pymc.io/t/mixture-regression/2603/1 "2019-01-29T16:55:04Z")

</div>

Hi,  
I’d really appreciate any help with modelling this data.

![Isochron_Mix](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/b/b428b49ea5c1c073f2fe3607dc0f1c3bebee3d44.png)

The plot above is the x and y with a colour map determined by the temperature and for each datapoint. I’ve drawn on two lines to show the linear models I am trying to estimate. A linear relationship that describes both the low temperature steps and one that fits the high temperature steps. Identifying x and y intercepts and gradients in both cases.  
I have tried to treat the data with the following hierarchical model. But this model isn’t achieving my aims.

 ![Python_code](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/b/bc13045d92e545fa4d2c12db419303d76ccb73c8.png)

and here is the data

[mix\_iso.csv](https://discourse.pymc.io/uploads/pymc3/original/2X/e/efa844a88d36ae7a0e458c1852621675ba10898f.csv) (981 Bytes)

Any help would be greatly appreciated, thanks

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [January 29, 2019, 7:26pm UTC](https://discourse.pymc.io/t/mixture-regression/2603/2 "2019-01-29T19:26:09Z")

</div>

You can have a look at this discussion: [Gaussian Mixture of regression](https://discourse.pymc.io/t/gaussian-mixture-of-regression/537/) However, I think in your case you dont have enough information (i.e., data point) to identify the two slopes, you might need pretty strong prior to make this work.

---

<div class="post-metadata">

**Author:** ![jack\_c](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jack\_c](https://discourse.pymc.io/u/jack_c)\
**Post date:** [January 29, 2019, 7:51pm UTC](https://discourse.pymc.io/t/mixture-regression/2603/3 "2019-01-29T19:51:09Z")

</div>

Thanks. I’ll have a play around with more restrictive priors.
