How do I get "marginal_effects" for categorical variables to condition on an average rather than a category?

tidybayes has support for extracting draws from emmeans objects and then summarizing them using whatever interval type you want. Something like this might work:


model4b.model %>%
  emmeans( ~ noise_level * token) %>%
  contrast(method = "pairwise") %>%
  gather_emmeans_draws() %>%
  median_qi(.width = .90)

That will give you median and 90% quantile (equal-tailed) intervals. If you want highest-density intervals, you could use something like mode_hdi in place of median_qi. The full set of variants is [mean|median|mode]_[qi|hdi|hdci], where hdi is highest-density (not necessarily continuous) interval, and hdci is highest-density continuous interval — i.e. hdi may return multiple intervals, which might be undesirable; hdci does not, though the result is not necessarily an HDI.

For more examples of tidybayes + emmeans (including plots), see here