Hey @xhackerz, welcome! To me your data doesn’t look Gaussian (normal). First thing I notice is that your data is positive only; and that it looks spiky on the left. Also, I guess mix_weight is suppose to be theta.

Try a mixture of gamma distributions instead. If you have a look at the wikipedia article, it looks to me like you can reparameterise a gamma to use mean and variance, so then you can use your ordering trick like you did with the normals. E.g.

\mu=\frac{\alpha}{\beta}, \sigma=\frac{\alpha}{\beta^2}, so \beta=\frac{\mu}{\sigma},\alpha=\frac{\mu^2}{\sigma}

If youre luckly a mixture of 3 gamma’s may also account for that big spike you see on the left too. Here’s a 2 component mixture example to get you started. I haven’t run it but it’s something.

data {
int <lower = 0> N;
vector[N] y;
}
parameters {
positive_ordered[2] mu;
vector<lower=0>[2] sigma;
vector<lower=0, upper=1> theta;
}
transformed parameters {
vector<lower=0>[2] alpha= mu .* mu ./ sigma;
vector<lower=0>[2] beta= mu ./ sigma;
}
model {
sigma ~ normal(0, 1000);
mu ~ normal(0, 1000);
for (i in 1:N) {
target += log_mix(theta,
gamma_lpdf(y[i] | alpha[1], beta[1]),
gamma_lpdf(y[i] | alpha[2], beta[2]));
}
}

Forgive any mistakes; I wrote this super quickly. Hope it helps.

Change the type of mu to “positive_ordered” and the type of all the other arrays to “vector”. As the error indicates, real[] look like they are not supported in elementwise operations