Skip to content

Commit

Permalink
Remove for loop around the abs function now the abs function has been…
Browse files Browse the repository at this point in the history
… vectorised since 2.30
  • Loading branch information
HPCurtis committed Sep 26, 2024
1 parent 36f8c73 commit 19e6a5e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/stan_files/lm.stan
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ model {
if (K > 1)
target += beta_lpdf(R2 | half_K, eta);
else {
// TODO(Andrew) remove once vectorised abs available in rstan

array[J] real R2_abs;
for (j in 1:J) {
R2_abs[j] = abs(R2[j]);
}
R2_abs = abs(R2);

target += beta_lpdf(square(R2) | half_K, eta) + sum(log(R2_abs));
}
}
Expand Down

0 comments on commit 19e6a5e

Please sign in to comment.