Skip to content

Commit 03aebd6

Browse files
committed
renamed stan files
1 parent 5886baf commit 03aebd6

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

bugs_examples/vol1/litter/litter.stan

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ data {
66
}
77
parameters {
88
matrix<lower=0,upper=1>[G,N] p;
9-
vector<lower=0.1>[G] a;
10-
vector<lower=0.1>[G] b;
9+
vector<lower=0,upper=1>[G] mu;
10+
vector<lower=0.1>[G] a_plus_b;
11+
}
12+
transformed parameters {
13+
vector[G] a;
14+
vector[G] b;
15+
a <- mu .* a_plus_b;
16+
b <- (1 - mu) .* a_plus_b;
1117
}
1218
model {
13-
a ~ gamma(1,0.001);
14-
b ~ gamma(1,0.001);
19+
a_plus_b ~ pareto(0.1,1.5);
1520
for (g in 1:G) {
1621
for (i in 1:N) {
1722
p[g,i] ~ beta(a[g],b[g]);
@@ -20,10 +25,7 @@ model {
2025
}
2126
}
2227
generated quantities {
23-
vector<lower=0,upper=1>[G] mu;
2428
vector<lower=0>[G] theta;
25-
for (g in 1:G)
26-
mu[g] <- a[g] / (a[g] + b[g]);
2729
for (g in 1:G)
2830
theta[g] <- 1 / (a[g] + b[g]);
29-
}
31+
}

bugs_examples/vol1/litter/litter_reparam.stan renamed to bugs_examples/vol1/litter/litter_old_param.stan

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,12 @@ data {
66
}
77
parameters {
88
matrix<lower=0,upper=1>[G,N] p;
9-
vector<lower=0,upper=1>[G] mu;
10-
vector<lower=0.1>[G] a_plus_b;
11-
}
12-
transformed parameters {
13-
vector[G] a;
14-
vector[G] b;
15-
a <- mu .* a_plus_b;
16-
b <- (1 - mu) .* a_plus_b;
9+
vector<lower=0.1>[G] a;
10+
vector<lower=0.1>[G] b;
1711
}
1812
model {
19-
a_plus_b ~ pareto(0.1,1.5);
13+
a ~ gamma(1,0.001);
14+
b ~ gamma(1,0.001);
2015
for (g in 1:G) {
2116
for (i in 1:N) {
2217
p[g,i] ~ beta(a[g],b[g]);
@@ -25,7 +20,10 @@ model {
2520
}
2621
}
2722
generated quantities {
23+
vector<lower=0,upper=1>[G] mu;
2824
vector<lower=0>[G] theta;
25+
for (g in 1:G)
26+
mu[g] <- a[g] / (a[g] + b[g]);
2927
for (g in 1:G)
3028
theta[g] <- 1 / (a[g] + b[g]);
3129
}

0 commit comments

Comments
 (0)