Skip to content

Commit 19e6a5e

Browse files
committed
Remove for loop around the abs function now the abs function has been vectorised since 2.30
1 parent 36f8c73 commit 19e6a5e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/stan_files/lm.stan

+3-4
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,10 @@ model {
105105
if (K > 1)
106106
target += beta_lpdf(R2 | half_K, eta);
107107
else {
108-
// TODO(Andrew) remove once vectorised abs available in rstan
108+
109109
array[J] real R2_abs;
110-
for (j in 1:J) {
111-
R2_abs[j] = abs(R2[j]);
112-
}
110+
R2_abs = abs(R2);
111+
113112
target += beta_lpdf(square(R2) | half_K, eta) + sum(log(R2_abs));
114113
}
115114
}

0 commit comments

Comments
 (0)