Counterfactual predictions with credible intervals for bernoulli model

  • Operating System: Windows 10
  • brms Version: 2.9.0


I am trying to calculate counterfactual predicted probabilities from a bernoulli model in brms. I have multiple predictors, and am holding all but 1 at their means in the data frame supplied as newdata.

However, when using using the predict function, the credible intervals returned are (almost) always 0 & 1, rather than intervals around the predicted probability that is returned in the Estimate column. I have read this thread, which suggests using summary = FALSE. This returns samples with predictions for all the combinations of newdata, but I’m not sure how to extract the credible intervals from this.

Alternatively, I can use fitted, which does return credible intervals. However, is using fitted appropriate for calculating predicted probabilities in this way?

I’d appreciate any help you can give me with this.


In the bernoulli case fitted is meant to return the predicted probabilities while predict (as for other families) returns predicted response values, that is zeros and ones only whose quantities are therefore only zero and ones as well.

Thanks very much for the response.

So in this case (i.e. calculating counterfactual predictions), it’s appropriate to use fitted rather than predict?

If you want to get the sucess probabilities and their uncertainties, then fitted is what you should use.

Great. That answers my question, thanks.