# Mixture Models with heterogeneous mixtures

**URL:** <https://discourse.mc-stan.org/t/mixture-models-with-heterogeneous-mixtures/33354>\
**Category:** Modeling\
**Created:** [November 16, 2023, 12:01pm UTC](https://discourse.mc-stan.org/t/mixture-models-with-heterogeneous-mixtures/33354 "2023-11-16T12:01:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Corey.Plate](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/corey.plate/32/20600_2.png) [@Corey.Plate](https://discourse.mc-stan.org/u/Corey.Plate)\
**Post date:** [November 16, 2023, 8:04pm UTC](https://discourse.mc-stan.org/t/mixture-models-with-heterogeneous-mixtures/33354/2 "2023-11-16T20:04:48Z")

</div>

If I understand correctly, you are trying to condition the distribution that increments the model on the presence or absence of some feature of the data. Have you considered nesting a conditional statment in your for loop?

```stan
model {
  for (n in 1:N) { 
    real C = col(P,n)' * lambda;
    vector[K] lps;  
    for (k in 1:K){
      if (condition) {

      } else {

      }
    }
    target += log_sum_exp(lps);
  }

```

---

_[View the full topic](https://discourse.mc-stan.org/t/mixture-models-with-heterogeneous-mixtures/33354)._
