Open mitzimorris opened 2 months ago
Add implementation of bernoulli_rng which generates an array of bernoulli outcomes for a single value of theta.
bernoulli_rng
theta
Currently, it is necessary to use a loop, e.g.
real theta = beta_rng(1, 1); array[N] int y; for (n in 1:N) { y[n] = bernoulli_rng(theta); }
The vectorized alternative is:
real theta = beta_rng(1, 1); array[N] int y; y = bernoulli_rng(rep_array(theta, N_obs));
This is problematic for 2 reasons:
thetas
It would be nice to be able to do the following:
real theta = beta_rng(1, 1); array[N] int y; y = bernoulli_rng(rtheta);
v4.8.1
Description
Add implementation of
bernoulli_rng
which generates an array of bernoulli outcomes for a single value oftheta
.Example
Currently, it is necessary to use a loop, e.g.
The vectorized alternative is:
This is problematic for 2 reasons:
thetas
Expected Output
It would be nice to be able to do the following:
Current Version:
v4.8.1