You’re right that as of 2.30, we still don’t have binomial_logit_rng
. Sorry about that! It’s on our to-do list.
Yes, that will work to give you posterior predictive draws. It’s what binomial_logit_rng
would do internally. It’s more robust than using inv_logit
for sampling because if it underflows to 0 or rounds to 1, you’ll still get sensible output (all 0s or all 1s).
If prediction
, trials
, and mu_pred
are all one dimensional containers (array, vector, or row vector), then you can vectorize as:
array[N] prediction = binomial_rng(trials, inv_logit(mu_pred));