Skip to content

Commit 2dfe368

Browse files
author
Andrew Johnson
committed
Finished tidying
1 parent 4c3cbce commit 2dfe368

22 files changed

+49
-214
lines changed

basic_estimators/bernoulli.stan

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
data {
22
int<lower=0> N;
3-
int<lower=0,upper=1> y[N];
3+
int<lower=0, upper=1> y[N];
44
}
55
parameters {
6-
real<lower=0,upper=1> theta;
6+
real<lower=0, upper=1> theta;
77
}
88
model {
9-
theta ~ beta(1,1);
10-
for (n in 1:N)
11-
y[n] ~ bernoulli(theta);
9+
theta ~ beta(1, 1);
10+
y ~ bernoulli(theta);
1211
}

basic_estimators/bernoulli_new.stan

Lines changed: 0 additions & 11 deletions
This file was deleted.

basic_estimators/negative_binomial.stan

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ parameters {
77
real<lower=0> beta;
88
}
99
model {
10-
alpha ~ cauchy(0,10);
11-
beta ~ cauchy(0,10);
12-
for (i in 1:N)
13-
y[i] ~ neg_binomial(alpha, beta);
10+
alpha ~ cauchy(0, 10);
11+
beta ~ cauchy(0, 10);
12+
y ~ neg_binomial(alpha, beta);
1413
}

basic_estimators/negative_binomial2.stan

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ data {
44
}
55
parameters {
66
real<lower=0> alpha;
7-
real<lower=0,upper=1> p_success;
7+
real<lower=0, upper=1> p_success;
88
}
99
transformed parameters {
10-
real<lower=0.0> beta;
11-
beta <- p_success / (1.0 - p_success);
10+
real<lower=0.0> beta = p_success / (1.0 - p_success);
1211
}
1312
model {
14-
for (i in 1:N)
15-
y[i] ~ neg_binomial(alpha, beta);
13+
y ~ neg_binomial(alpha, beta);
1614
}

basic_estimators/negative_binomial2_new.stan

Lines changed: 0 additions & 14 deletions
This file was deleted.

basic_estimators/negative_binomial_new.stan

Lines changed: 0 additions & 13 deletions
This file was deleted.

basic_estimators/normal_censored

-1.57 MB
Binary file not shown.

basic_estimators/normal_censored.stan

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ parameters {
88
real mu;
99
}
1010
model {
11+
// Vectorization with truncation is not yet supported
1112
for (n in 1:N_observed)
1213
y[n] ~ normal(mu,1.0) T[,U];
13-
increment_log_prob(N_censored
14-
* log1m(normal_cdf(U,mu,1.0)));
14+
target += N_censored * normal_lccdf(U | mu, 1);
1515
}
1616

1717

-1.57 MB
Binary file not shown.

basic_estimators/normal_censored_new.stan

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)