Bernoulli process with each element in a 2D array as p

Hi all,

I’m trying to generate m binary traits in n individuals. I want to use a Bernoulli model in the last step to map the n x m probabilities to binary outcomes of the same dimension, however the Bernoulli function only accepts a float as the parameter p. The only way I can think of now is to write a custom function with for loops… Are there better ways to vectorize it?

Thanks.

Bernoulli accept array as p - maybe you can share your code where it doesnt work?

Thank you for pointing it out!
It turns out that I did not specify the shape parameter correctly. Now the model works, but I still have problems using sample_prior_predictive with MvNormal variables. I see there are open issues about this on github.