Hi,
I am estimating a parameter for n-groups using partial pooling. The parameter in my case represents a distance from zero (centroid) in an n-dimensional volume. My sampling for each group is uneven, and the partial pooling approach using group level effects works very well! The problem is that values below zero do not make sense for this parameter, as these groups can not have a negative distance from a centroid. I would like to somehow limit my posteriors to positive values. Below is an example of what I mean, which I took from the Tidyverse website and modified slightly.
pacman::p_load(tidyverse, tidybayes, brms)
set.seed(11)
n = 10
ABC =
tibble(
condition = rep(c("A", "B", "C", "D", "E", "F", "G", "H"), n),
response = rnorm(n * 8,
c(0.3, 1, 2, 1.5, 2.5, 3.5, 2, 1.75),
c(0.17, 0.3, 0.5, 0.5, 0.8, 1, 0.5, 0.7)))
MODEL
m = brm(
response ~ 0 + (1|condition),
data = ABC,
refresh = 0,
prior = c(
prior(student_t(3, 0, 1), class = sd),
prior(student_t(3, 0, 1), class = sigma)),
control = list(adapt_delta = .99))
PLOT
m %>%
spread_draws(r_condition[condition,]) %>%
median_qi(r_condition, .width = c(.95, .66)) %>%
ggplot(aes(y = condition, x = r_condition, xmin = .lower, xmax = .upper)) +
geom_pointinterval()
As you can see, the posterior distribution for group
A
goes below zero. I understand that upper and lower bounds can be fixed on population-level effects in brms. But this doesn’t seem directly possible with group-level effects, or at least I can’t figure out how.
I came up with a few ideas, but I’m not sure any of them are appropriate. I could use a lognormal family, but I’d rather not deal with the transformations if possible. The second idea is using the exponential gaussian family - exgaussian()
. This did work, and the posteriors are all positive, but in my empirical data the results are very left-skewed and the median estimates increased (images below). Also, I’m not sure that this is the appropriate use of this distributional family. A brute force approach would be to take the absolute values of the posteriors (as a negative distance is still a distance?) but I don’t feel really comfortable with that.
Can anyone suggest a good approach to dealing with this problem?
Thanks!
- Operating System: OSX Catalina
- brms Version: 2.13.0
Plots from my empirical examples:
family = gaussian()
family = exgaussian()
Values are positive! But notice left skew and increased median estimates.