Zero inflated beta binomial model under brms

To implement this in brms you will have to use a “custom response distribution”.
The brms vignette for this uses the beta binomial model.

This is a starting point, but to make this work you also need to code the zero inflation part. (i.e. you have so specify the design matrix, additional regression parameters, and implement the mixture-model to combine the zero inflation part with the beta binomial part.)

A good starting point for this is to specify a model with the zero inflated negative binomial family in brms (see here) and to use make_stancode to produce the output, which you can then to inspect to see how zero inflation is implemented.

The harder part will then be to (a) generate a brms model with the stan code you generated and (b) write the posterior_predict and log_lik functions that are needed for post processing (but looking at the similar other brms functions) should also help with this.

3 Likes