Write a new function in a for loop fashion so that loglik computation can be parallelized (using +'s associative). New component for function block, change ~ to += for model and gq block
//function
real partial_sum_lpmf(int[] slice_n_redcards,
int start, int end,
int[] n_games,
vector rating,
vector beta) {
return binomial_logit_lupmf(slice_n_redcards |
n_games[start:end],
beta[1] + beta[2] * rating[start:end]);
}
// model
...
target += reduce_sum(partial_sum_lupmf, n_redcards, grainsize,
n_games, rating, beta);
Write a new function in a for loop fashion so that loglik computation can be parallelized (using
+
's associative). New component forfunction block
, change~
to+=
for model and gq blockRef Start from Sebastian's Gelblog intro.