# Request for average predictive comparisons in rstanarm and brms

Dear rstanarm and brms developers:

There is a request for average predictive comparisons; see this comment: https://statmodeling.stat.columbia.edu/2019/12/29/do-we-still-recommend-average-predictive-comparisons-click-here-to-find-the-surprising-answer/#comment-1216517
Key quote: “There are many variations of this, and is quite useful for non-linear (e.g. logit) models. It appears to have become very very popular and many of us would be giddy if rstanarm or brms would support a full-featured ‘margins’ like command. Many researchers use Stata largely because of this feature.”

The method is described in this paper from awhile ago:
http://www.stat.columbia.edu/~gelman/research/published/ape17.pdf
David Chudzicki wrote a related R package a few years back:
https://statmodeling.stat.columbia.edu/2014/06/17/average-predictive-comparisons-r-david-chudzicki-writes-package/

3 Likes

Is this something similar as discussed in the brms issue https://github.com/paul-buerkner/brms/issues/552?

Hi, yes, it’s the same sort of thing. There are lots of options regarding details (as discussed in our paper), but I figure that any implementation is better than nothing!

As others have discussed, the need to marginalize over continuous predictors makes implementation challenging. Estimating the joint distribution of the predictors is also a big problem:

1. The Mahalanobis distance is appropriate when the joint distribution is multivariate normal, but such a distribution is unlikely for many predictors (perhaps this is arguable).

2. The joint distribution of the predictors in the experiment may not reflect the joint distribution of the predictors in the “real world”. For example, an experiment might pair certain temperature treatments with different humidity treatments, but those temperature-humidity pairings may be unlikely in the real world. Hence, conclusions based on the joint distribution in the experiment may not be meaningful outside the context of the experiment.

I found a gist with an implementation of Average marginal effects

Hi all,

Sorry to bring this topic back. Is there any update specially for random effect models.

B