Skip to content

Commit 6b4c0b0

Browse files
author
Andrew Johnson
committed
Symmetrise and whitespace
1 parent e02ee62 commit 6b4c0b0

File tree

8 files changed

+22
-24
lines changed

8 files changed

+22
-24
lines changed

basic_distributions/binormal.stan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ parameters {
77
vector[2] y;
88
}
99
model {
10-
y ~ multi_normal(mu,Sigma);
10+
y ~ multi_normal(mu, Sigma);
1111
}

basic_distributions/normal.stan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ parameters {
22
real y;
33
}
44
model {
5-
y ~ normal(0,1);
5+
y ~ normal(0, 1);
66
}

basic_distributions/ordered_pair.stan

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ transformed data {
33
real H = 5;
44
}
55
parameters {
6-
real<lower=L,upper=H> a;
7-
real<lower=a,upper=H> b;
6+
real<lower=L, upper=H> a;
7+
real<lower=a, upper=H> b;
88
}
99
model {
10-
// a ~ uniform(L,b);
11-
// b ~ uniform(a,H);
10+
// a ~ uniform(L, b);
11+
// b ~ uniform(a, H);
1212
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
parameters {
2-
real<lower=-1,upper=1> x1;
3-
real<lower=-1,upper=1> x2;
2+
real<lower=-1, upper=1> x1;
3+
real<lower=-1, upper=1> x2;
44
}
55
model {
66
}
77
generated quantities {
8-
real a = fmax(x1,x2);
9-
real b = fmin(x1,x2);
8+
real a = fmax(x1, x2);
9+
real b = fmin(x1, x2);
1010
}

basic_distributions/triangle.stan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters {
2-
real<lower=-1,upper=1> y;
2+
real<lower=-1, upper=1> y;
33
}
44
model {
55
target += log1m(fabs(y));

basic_distributions/uniform.stan

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parameters {
2-
real<lower=0,upper=1> y;
2+
real<lower=0, upper=1> y;
33
}
44
model {
5-
y ~ uniform(0,1);
5+
y ~ uniform(0, 1);
66
}

basic_distributions/wishart2.stan

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@ transformed data {
22
cov_matrix[4] S;
33

44
S[1,1] = 2.9983662;
5-
S[1,2] = 0.2898776;
6-
S[1,3] = -2.650523;
7-
S[1,4] = 0.1055911;
5+
S[2,1] = 0.2898776;
6+
S[3,1] = -2.650523;
7+
S[4,1] = 0.1055911;
88
S[2,2] = 11.4803610;
9-
S[2,3] = 7.157993;
10-
S[2,4] = -3.1129955;
9+
S[3,2] = 7.157993;
10+
S[4,2] = -3.1129955;
1111
S[3,3] = 11.676181;
12-
S[3,4] = -3.5866852;
12+
S[4,3] = -3.5866852;
1313
S[4,4] = 1.4482736;
1414

15-
for (m in 1:4)
16-
for (n in 1:(m-1))
17-
S[m,n] = S[n,m];
15+
S = symmetrize_from_lower_tri(S);
1816
}
1917
parameters {
2018
cov_matrix[4] W;

basic_distributions/wishart2x2.stan

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ parameters {
2121
transformed parameters {
2222
real rho = tanh(x);
2323
real cov = rho * sd1 * sd2;
24-
matrix[2,2] W = [[sd1^2, cov],
25-
[cov, sd2^2]];
24+
matrix[2,2] W = [[sd1 ^ 2, cov],
25+
[cov, sd2 ^ 2]];
2626
}
2727
model {
2828
// apply log Jacobian determinant of transform:

0 commit comments

Comments
 (0)