File tree Expand file tree Collapse file tree 2 files changed +39
-227
lines changed
Expand file tree Collapse file tree 2 files changed +39
-227
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ data {
2+ int < lower =1 > K;
3+ int < lower =1 > N;
4+ real y[N];
5+ }
6+ parameters {
7+ simplex [K] theta;
8+ simplex [K] mu_prop;
9+ real mu_loc;
10+ real < lower =0 > mu_scale;
11+ real < lower =0 > sigma[K];
12+ }
13+ transformed parameters {
14+ ordered [K] mu;
15+ mu <- mu_loc + mu_scale * cumulative_sum( mu_prop);
16+ }
17+ model {
18+ // prior
19+ // theta ~ dirichlet(rep_vector(1,K));
20+ // mu_prop ~ dirichlet(rep_vector(1,K));
21+ mu_loc ~ cauchy (0 ,5 );
22+ mu_scale ~ cauchy (0 ,5 );
23+ sigma ~ cauchy (0 ,5 );
24+
25+ // likelihood
26+ {
27+ real ps[K];
28+ vector [K] log_theta;
29+ log_theta <- log( theta);
30+
31+ for (n in 1 : N) {
32+ for (k in 1 : K) {
33+ ps[k] <- log_theta[k]
34+ + normal_log (y[n],mu[k],sigma[k]);
35+ }
36+ lp__ <- lp__ + log_sum_exp( ps);
37+ }
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments