Revision 4d048784cc1691d7539bc45fef9d3916724c6650 authored by Mitzi Morris on 27 August 2019, 15:59:25 UTC, committed by Mitzi Morris on 27 August 2019, 15:59:25 UTC
normal_mixture_k.stan
data {
int<lower=1> K;
int<lower=1> N;
real y[N];
}
parameters {
simplex[K] theta;
real mu[K];
real<lower=0,upper=10> sigma[K];
}
model {
real ps[K];
mu ~ normal(0,10);
for (n in 1:N) {
for (k in 1:K)
ps[k] <- log(theta[k])
+ normal_log(y[n],mu[k],sigma[k]);
increment_log_prob(log_sum_exp(ps));
}
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...