# \#mixture

**URL:** https://discourse.mc-stan.org/tag/mixture/127.md?match_all_tags=true&page=1&tags%5B%5D=mixture

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

**Page:** 2

---

## [Parameter recovery issues with normal mixture model](https://discourse.mc-stan.org/t/parameter-recovery-issues-with-normal-mixture-model/27835)

<div class="topic-metadata">

**Author:** [@Thomass](https://discourse.mc-stan.org/u/Thomass)\
**Replies:** 3\
**Last updated:** [June 16, 2022, 6:51am UTC](https://discourse.mc-stan.org/t/parameter-recovery-issues-with-normal-mixture-model/27835 "2022-06-16T06:51:39Z")

</div>

Hello everyone, I’m trying to fit my model (a class of mixture model) to simulated data, and I have trouble in recovering the model parameters. To this end, I followed the 9th suggestion provided by the Stan Team and mo…

---

## [Convergence issues with gamma mixture models in brms: intercepts keep "swapping"](https://discourse.mc-stan.org/t/convergence-issues-with-gamma-mixture-models-in-brms-intercepts-keep-swapping/27221)

<div class="topic-metadata">

**Author:** [@qdread](https://discourse.mc-stan.org/u/qdread)\
**Replies:** 6\
**Last updated:** [April 27, 2022, 7:52am UTC](https://discourse.mc-stan.org/t/convergence-issues-with-gamma-mixture-models-in-brms-intercepts-keep-swapping/27221 "2022-04-27T07:52:00Z")

</div>

This is a closely related post but I am specifically looking for help with gamma mixture models. I was able to achieve convergence on a gamma mixture model by setting lb and ub on the intercept priors so that the interc…

---

## [Reduce\_sum and finite mixture (log\_mix)](https://discourse.mc-stan.org/t/reduce-sum-and-finite-mixture-log-mix/27136)

<div class="topic-metadata">

**Author:** [@sonicking](https://discourse.mc-stan.org/u/sonicking)\
**Replies:** 8\
**Last updated:** [April 16, 2022, 12:36pm UTC](https://discourse.mc-stan.org/t/reduce-sum-and-finite-mixture-log-mix/27136 "2022-04-16T12:36:59Z")

</div>

Hello, I did reduce\_sum before following the wonderful case study tutorial. In that example, the likelihood can be vectorized. Is it still possible to use reduce\_sum when the likelihood cannot be vectorized? Specifical…

---

## [Hierarchical hurdle model in Stan?](https://discourse.mc-stan.org/t/hierarchical-hurdle-model-in-stan/26978)

<div class="topic-metadata">

**Author:** [@Rosina](https://discourse.mc-stan.org/u/Rosina)\
**Replies:** 9\
**Last updated:** [April 4, 2022, 9:13am UTC](https://discourse.mc-stan.org/t/hierarchical-hurdle-model-in-stan/26978 "2022-04-04T09:13:16Z")

</div>

Hello! I have N observations, divided unequally between J subjects. Each observation y\[i\] is sampled from a Poisson distribution, with the mean lambda varying according to the subject. The subject-specific lambdas are sa…

---

## [Exp-Gamma mixture model](https://discourse.mc-stan.org/t/exp-gamma-mixture-model/18331)

<div class="topic-metadata">

**Author:** [@dariato](https://discourse.mc-stan.org/u/dariato)\
**Replies:** 5\
**Last updated:** [January 26, 2022, 8:10pm UTC](https://discourse.mc-stan.org/t/exp-gamma-mixture-model/18331 "2022-01-26T20:10:20Z")

</div>

Dear all, I’m a new entry of probabilistic programming community and I’m trying to fit in a proper way a weird distribution of data that looks like this: Because of this “bimodal” and strictly positive shape, I though…

---

## [Soft k-means model syntax error](https://discourse.mc-stan.org/t/soft-k-means-model-syntax-error/25955)

<div class="topic-metadata">

**Author:** [@datarichard](https://discourse.mc-stan.org/u/datarichard)\
**Replies:** 3\
**Last updated:** [January 13, 2022, 6:37am UTC](https://discourse.mc-stan.org/t/soft-k-means-model-syntax-error/25955 "2022-01-13T06:37:58Z")

</div>

hi, I’m trying to work out how to use Stan for time series clustering. I thought I would start with the soft k-means example in the User guide and github. However it seems that array is not a valid syntax to declare ar…

---

## [When is log\_mix preferable to log\_sum\_exp for mixtures?](https://discourse.mc-stan.org/t/when-is-log-mix-preferable-to-log-sum-exp-for-mixtures/25877)

<div class="topic-metadata">

**Author:** [@Alanocallaghan](https://discourse.mc-stan.org/u/Alanocallaghan)\
**Replies:** 3\
**Last updated:** [January 6, 2022, 10:03am UTC](https://discourse.mc-stan.org/t/when-is-log-mix-preferable-to-log-sum-exp-for-mixtures/25877 "2022-01-06T10:03:35Z")

</div>

I’ve been working with some models that contain mixture components, and I’m trying to see if the new (ish) log\_mix interfaces can squeeze out a bit more performance over the usual log\_sum\_exp approach. So far things are …

---

## [Enforcing order for mixture of transition matrices](https://discourse.mc-stan.org/t/enforcing-order-for-mixture-of-transition-matrices/23029)

<div class="topic-metadata">

**Author:** [@Joseph\_Dean](https://discourse.mc-stan.org/u/Joseph_Dean)\
**Replies:** 2\
**Last updated:** [June 24, 2021, 3:15pm UTC](https://discourse.mc-stan.org/t/enforcing-order-for-mixture-of-transition-matrices/23029 "2021-06-24T15:15:10Z")

</div>

I’m trying to fit a mixture of transition matrices but I’m a bit stuck on how I can “order” the k matrices. I’ve basically just adapted the normal mixture from the documentation here but the ordered part is tripping me …

---

## [Mixture-Model Inference: how to report hidden states, rather than state proportions?](https://discourse.mc-stan.org/t/mixture-model-inference-how-to-report-hidden-states-rather-than-state-proportions/23038)

<div class="topic-metadata">

**Author:** [@McBaunzy](https://discourse.mc-stan.org/u/McBaunzy)\
**Replies:** 6\
**Last updated:** [June 17, 2021, 8:35pm UTC](https://discourse.mc-stan.org/t/mixture-model-inference-how-to-report-hidden-states-rather-than-state-proportions/23038 "2021-06-17T20:35:09Z")

</div>

Dear wonderful Stan community, I’m conducting a simulation study of a simple mixture model of two Poisson distributions, parameterized \\lambda\_1 and \\lambda\_2. Each of the N observations comes from one of these two dist…

---

## [Mixture of Normals as distribution for latent variable](https://discourse.mc-stan.org/t/mixture-of-normals-as-distribution-for-latent-variable/21971)

<div class="topic-metadata">

**Author:** [@KostasKalog](https://discourse.mc-stan.org/u/KostasKalog)\
**Replies:** 4\
**Last updated:** [April 29, 2021, 7:59pm UTC](https://discourse.mc-stan.org/t/mixture-of-normals-as-distribution-for-latent-variable/21971 "2021-04-29T19:59:38Z")

</div>

Hi, First of all congratulations for creating this wonderful community! I have a quick question. Is it possible to use normal mixtures in Stan as distributions for latent variables? In all the examples I have seen so f…

---

## [How to decide on whether to use a Multivariate Gaussian Mixture model?](https://discourse.mc-stan.org/t/how-to-decide-on-whether-to-use-a-multivariate-gaussian-mixture-model/21221)

<div class="topic-metadata">

**Author:** [@xenia](https://discourse.mc-stan.org/u/xenia)\
**Replies:** 7\
**Last updated:** [March 10, 2021, 4:17pm UTC](https://discourse.mc-stan.org/t/how-to-decide-on-whether-to-use-a-multivariate-gaussian-mixture-model/21221 "2021-03-10T16:17:57Z")

</div>

Hi, I am new to stan and bayesian analysis and looking at modelling some spectroscopic data (UV-Vis), do you think for this kind of ‘signal’ data with discrete counts over a range of energies and a number of peaks (some…

---

## [Beta binomial mixture model](https://discourse.mc-stan.org/t/beta-binomial-mixture-model/21048)

<div class="topic-metadata">

**Author:** [@Yulia\_Sidi](https://discourse.mc-stan.org/u/Yulia_Sidi)\
**Replies:** 5\
**Last updated:** [March 4, 2021, 1:28am UTC](https://discourse.mc-stan.org/t/beta-binomial-mixture-model/21048 "2021-03-04T01:28:46Z")

</div>

I am trying to fit a beta binomial mixture model with weights as a random variable (hyper parameter) with two parts. The likelihood results is in between the two priors. However, in the posterior distributions do not mo…

---

## [STAN scaling limitations](https://discourse.mc-stan.org/t/stan-scaling-limitations/20404)

<div class="topic-metadata">

**Author:** [@GabeTheEngineer](https://discourse.mc-stan.org/u/GabeTheEngineer)\
**Replies:** 15\
**Last updated:** [February 18, 2021, 3:46pm UTC](https://discourse.mc-stan.org/t/stan-scaling-limitations/20404 "2021-02-18T15:46:07Z")

</div>

What is a practical limit for the amount of data stan is able to scale to? I have a population of people each taking a set of questions. The data is a set 1,186,766 measurements of 149 questions and 215,032 people. E…

---

## [Membership of Mixture Model](https://discourse.mc-stan.org/t/membership-of-mixture-model/20829)

<div class="topic-metadata">

**Author:** [@dwi](https://discourse.mc-stan.org/u/dwi)\
**Replies:** 3\
**Last updated:** [February 17, 2021, 3:02pm UTC](https://discourse.mc-stan.org/t/membership-of-mixture-model/20829 "2021-02-17T15:02:14Z")

</div>

hello, I just entered the forum. I have data, then I model it with the mixture. After getting the number of components of the mixture, the proportion of each component of the mixture, then how to know which each observ…

---

## [Using a single mixture weight parameter in a multivariate mixture model](https://discourse.mc-stan.org/t/using-a-single-mixture-weight-parameter-in-a-multivariate-mixture-model/20288)

<div class="topic-metadata">

**Author:** [@jobi](https://discourse.mc-stan.org/u/jobi)\
**Replies:** 3\
**Last updated:** [February 5, 2021, 9:37am UTC](https://discourse.mc-stan.org/t/using-a-single-mixture-weight-parameter-in-a-multivariate-mixture-model/20288 "2021-02-05T09:37:29Z")

</div>

I am working with data where around 30% of observations are measured incorrectly and are 2x larger than they should have been recorded. I want to use a mixture model to identify these observations to recover their actual…

---

## [Finite mixture model where the sum of a group's characteristics is known](https://discourse.mc-stan.org/t/finite-mixture-model-where-the-sum-of-a-groups-characteristics-is-known/20146)

<div class="topic-metadata">

**Author:** [@gfgm](https://discourse.mc-stan.org/u/gfgm)\
**Replies:** 2\
**Last updated:** [January 17, 2021, 9:42am UTC](https://discourse.mc-stan.org/t/finite-mixture-model-where-the-sum-of-a-groups-characteristics-is-known/20146 "2021-01-17T09:42:07Z")

</div>

I am working on an unusual finite mixture model to try to tackle an historical source. The problem combines a normal 2 component finite mixture with some additional information, and I am unsure how to incorporate the add…

---

## [Specifying joint mixture model](https://discourse.mc-stan.org/t/specifying-joint-mixture-model/20128)

<div class="topic-metadata">

**Author:** [@Benjamin.Larue](https://discourse.mc-stan.org/u/Benjamin.Larue)\
**Replies:** 2\
**Last updated:** [January 15, 2021, 3:38pm UTC](https://discourse.mc-stan.org/t/specifying-joint-mixture-model/20128 "2021-01-15T15:38:15Z")

</div>

Hi, I would like to fit joint mixture models to determine life-history trajectories in mammal populations. I am interested in knowing if the probability that individuals belong to a cluster depends on three different re…

---

## [Individual level estimates for mixture models (zero & one inflated beta)](https://discourse.mc-stan.org/t/individual-level-estimates-for-mixture-models-zero-one-inflated-beta/19098)

<div class="topic-metadata">

**Author:** [@fusaroli](https://discourse.mc-stan.org/u/fusaroli)\
**Replies:** 1\
**Last updated:** [November 9, 2020, 8:17am UTC](https://discourse.mc-stan.org/t/individual-level-estimates-for-mixture-models-zero-one-inflated-beta/19098 "2020-11-09T08:17:04Z")

</div>

I have a multilevel mixture (zero and one inflated) model and I would like to extract individual level estimates of the different parameters in an automated way. The model is model\_f \<- bf( Outcome ~ 0 + Diagnosis +…

---

## [Hurdle lognormal distribution](https://discourse.mc-stan.org/t/hurdle-lognormal-distribution/18528)

<div class="topic-metadata">

**Author:** [@bowei\_kang](https://discourse.mc-stan.org/u/bowei_kang)\
**Replies:** 11\
**Last updated:** [October 9, 2020, 10:16pm UTC](https://discourse.mc-stan.org/t/hurdle-lognormal-distribution/18528 "2020-10-09T22:16:14Z")

</div>

Hi everyone! I read from the user guide that Stan does not support the zero-inflated model for continuous distribution for now. I am wondering if there is a way out or around? For example, a simplified problem may look …

---

## [Multivariate mixtures in brms](https://discourse.mc-stan.org/t/multivariate-mixtures-in-brms/18217)

<div class="topic-metadata">

**Author:** [@Zacco](https://discourse.mc-stan.org/u/Zacco)\
**Replies:** 3\
**Last updated:** [October 2, 2020, 9:31am UTC](https://discourse.mc-stan.org/t/multivariate-mixtures-in-brms/18217 "2020-10-02T09:31:29Z")

</div>

Hi folks, I’m having a lot of trouble setting up a multivariate mixture model in brms. Here’s a simple example: set.seed(1234) dat \<- data.frame( x = c(rnorm(200), rnorm(100, -6)), y = c(rnorm(200), rnorm(100, 6))…

---

## [Using log\_mix in Zero-inflated poisson model](https://discourse.mc-stan.org/t/using-log-mix-in-zero-inflated-poisson-model/18295)

<div class="topic-metadata">

**Author:** [@Tikavdm](https://discourse.mc-stan.org/u/Tikavdm)\
**Replies:** 2\
**Last updated:** [September 30, 2020, 2:51pm UTC](https://discourse.mc-stan.org/t/using-log-mix-in-zero-inflated-poisson-model/18295 "2020-09-30T14:51:51Z")

</div>

For a zero-inflated model Poisson model, if you observe y=0, then the likelihood is a mixture: \\begin{align\*} \\text{Pr} (0 | p, \\lambda) & = \\text{Pr} (\\text{Zero generating process} | p) \* (1) + \\text{Pr} (\\text{Other …

---

## [Insufficient convergence in mixture Generalized Partial Credit Model](https://discourse.mc-stan.org/t/insufficient-convergence-in-mixture-generalized-partial-credit-model/17277)

<div class="topic-metadata">

**Author:** [@abeeisnotabug](https://discourse.mc-stan.org/u/abeeisnotabug)\
**Replies:** 5\
**Last updated:** [August 10, 2020, 6:27pm UTC](https://discourse.mc-stan.org/t/insufficient-convergence-in-mixture-generalized-partial-credit-model/17277 "2020-08-10T18:27:14Z")

</div>

Dear Stan community, I have trouble fitting a mixture Generalized Partial Credit Model (belonging to the IRT class of models). This is going to be a rather long post, so I added sections. 1. The model Let I, K, J\\in\\m…

---

## [HELP Iris dataset pystan GMM with dimensionality reduction by linear regression - max\_treedepth HELP](https://discourse.mc-stan.org/t/help-iris-dataset-pystan-gmm-with-dimensionality-reduction-by-linear-regression-max-treedepth-help/16564)

<div class="topic-metadata">

**Author:** [@himelbrand](https://discourse.mc-stan.org/u/himelbrand)\
**Replies:** 2\
**Last updated:** [July 30, 2020, 1:03pm UTC](https://discourse.mc-stan.org/t/help-iris-dataset-pystan-gmm-with-dimensionality-reduction-by-linear-regression-max-treedepth-help/16564 "2020-07-30T13:03:56Z")

</div>

Hi I’m using the Iris dataset, to try and do inference on the mixtures for each of the 3 species. I’m using pystan. They Idea is as followed: the input i the 150x4 matrix, 4d features of the plants. I want to find a 4d…

---

## [Mixture models with different number of parameters. List-like datastructure?](https://discourse.mc-stan.org/t/mixture-models-with-different-number-of-parameters-list-like-datastructure/15945)

<div class="topic-metadata">

**Author:** [@RJTK](https://discourse.mc-stan.org/u/RJTK)\
**Replies:** 6\
**Last updated:** [June 26, 2020, 2:45pm UTC](https://discourse.mc-stan.org/t/mixture-models-with-different-number-of-parameters-list-like-datastructure/15945 "2020-06-26T14:45:06Z")

</div>

I am fairly new to stan and learning by just playing around with a few different models, but I’ve now run into a difficulty with the programming constructs available. I’m looking at an AR(p) model (you can see all the c…

---

## [Fitting a Negative Binomial distribution as a Gamma Mixture of Poisson distributions with brms](https://discourse.mc-stan.org/t/fitting-a-negative-binomial-distribution-as-a-gamma-mixture-of-poisson-distributions-with-brms/15989)

<div class="topic-metadata">

**Author:** [@stevejburr](https://discourse.mc-stan.org/u/stevejburr)\
**Replies:** 2\
**Last updated:** [June 16, 2020, 8:11pm UTC](https://discourse.mc-stan.org/t/fitting-a-negative-binomial-distribution-as-a-gamma-mixture-of-poisson-distributions-with-brms/15989 "2020-06-16T20:11:58Z")

</div>

I have some data which I know should be approximately negative binomial distributed. These are counts, with corresponding ids. At the moment, I have a single observation for each id and no additional covariates but I am …

---

## [Identification for mixture model or HMM with covariate(s)?](https://discourse.mc-stan.org/t/identification-for-mixture-model-or-hmm-with-covariate-s/15057)

<div class="topic-metadata">

**Author:** [@sonicking](https://discourse.mc-stan.org/u/sonicking)\
**Replies:** 4\
**Last updated:** [June 2, 2020, 8:35am UTC](https://discourse.mc-stan.org/t/identification-for-mixture-model-or-hmm-with-covariate-s/15057 "2020-06-02T08:35:22Z")

</div>

Hi, how does one identify mixture model or HMM with covariates? I understand the identification issue in the non-covariate case can be handled by: ordered\[S\] mu; //S is the number of mixture, let’s say S=2, this ensur…

---

## [Mixture Model Fitting](https://discourse.mc-stan.org/t/mixture-model-fitting/15479)

<div class="topic-metadata">

**Author:** [@xhackerz](https://discourse.mc-stan.org/u/xhackerz)\
**Replies:** 6\
**Last updated:** [May 31, 2020, 6:47am UTC](https://discourse.mc-stan.org/t/mixture-model-fitting/15479 "2020-05-31T06:47:24Z")

</div>

I’m trying to fit a mixture model to data below. data.R (55.0 KB) This is what I’ve got so far. How can I improve even more? I’m not sure what to do on the left part of the plot. Any help is appreciated. data { i…

---

## [Best practice for selecting number of mixture model components](https://discourse.mc-stan.org/t/best-practice-for-selecting-number-of-mixture-model-components/15034)

<div class="topic-metadata">

**Author:** [@samvaughan](https://discourse.mc-stan.org/u/samvaughan)\
**Replies:** 3\
**Last updated:** [May 12, 2020, 5:20pm UTC](https://discourse.mc-stan.org/t/best-practice-for-selecting-number-of-mixture-model-components/15034 "2020-05-12T17:20:43Z")

</div>

Hi, I have a number of datasets with values constrained to lie between 0 and 1. I’ve set up a mixture model of two beta distributions which fits well in Stan. However I’d like to quantitatively decide in each case wheth…

---

## [IRT Mixture Bernoulli](https://discourse.mc-stan.org/t/irt-mixture-bernoulli/14989)

<div class="topic-metadata">

**Author:** [@pbcacao](https://discourse.mc-stan.org/u/pbcacao)\
**Replies:** 3\
**Last updated:** [May 11, 2020, 1:55pm UTC](https://discourse.mc-stan.org/t/irt-mixture-bernoulli/14989 "2020-05-11T13:55:07Z")

</div>

Hello, I’m using the following model with one class. I would like to integrate mixture parameters to isolate specific groups. Would you have an idea of how to change the code below so that it includes groups parameters…

---

## [Specifying a model for inflated event timings](https://discourse.mc-stan.org/t/specifying-a-model-for-inflated-event-timings/14472)

<div class="topic-metadata">

**Author:** [@odaniel1](https://discourse.mc-stan.org/u/odaniel1)\
**Replies:** 2\
**Last updated:** [May 6, 2020, 9:05am UTC](https://discourse.mc-stan.org/t/specifying-a-model-for-inflated-event-timings/14472 "2020-05-06T09:05:11Z")

</div>

I have data representing the time it takes for an activity to complete; however this data is noisy and sometimes the stop watch fails so that timings are inflated. The model I am looking to fit assumes the observed data…

[Previous page](https://discourse.mc-stan.org/tag/mixture/127.md?match_all_tags=true&tags%5B%5D=mixture)

[Next page](https://discourse.mc-stan.org/tag/mixture/127.md?match_all_tags=true&page=2&tags%5B%5D=mixture)
