I am working on a Bayesian model using the brm function from the brms package in R, and I am interested in comparing mean responses of different groups. Specifically, I would like to calculate the mean ratios of responses, along with their 95% confidence intervals. I know how to calculate the odds ratios and mean differences, but I'm not sure how to go about calculating the mean ratios.
The Model and Data
Here's the model I used for demonstration purposes:
library(brms)
# Create a variable as a proportion of the max Sepal.Length with interval [0, 1[
iris$Sepal.Length.Percent <- iris$Sepal.Length / max(iris$Sepal.Length + 0.0000001)
# Fit a Bayesian model with a Beta distribution
mdl <- brm(bf(Sepal.Length.Percent ~ Species), family = Beta(), data = iris)
What I've Tried
I used the emmeans
package to get the expected marginal means and odds ratios, as well as 95% confidence intervals for those estimates.
library(emmeans)
> emmeans(mdl, pairwise ~ Species, type = 'response')
$emmeans
Species response lower.HPD upper.HPD
setosa 0.628 0.598 0.658
versicolor 0.744 0.718 0.773
virginica 0.867 0.848 0.888
$contrasts
contrast odds.ratio lower.HPD upper.HPD
setosa / versicolor 0.580 0.473 0.697
setosa / virginica 0.257 0.207 0.319
versicolor / virginica 0.444 0.346 0.547
> emmeans(mdl, pairwise ~ Species)
$emmeans
Species emmean lower.HPD upper.HPD
setosa 0.522 0.399 0.655
versicolor 1.066 0.917 1.206
virginica 1.878 1.716 2.066
$contrasts
contrast estimate lower.HPD upper.HPD
setosa - versicolor -0.545 -0.735 -0.349
setosa - virginica -1.360 -1.573 -1.143
versicolor - virginica -0.813 -1.036 -0.586
What I'm Looking For
I want to find a way to calculate (or extract) the mean ratios, not odds ratios or mean differences, along with their 95% confidence intervals.
Any guidance on how to achieve this would be much appreciated!
Edit:
Ideally, I would like to find the least cumbersome solution, for instance with a function from emmeans
.