'Group estimate in different direction than individual components

I have a binary outcome and five classes of grouped exposures in a BHM model. One group's summary estimate does not make sense to me given the estimates of the component exposures (see picture). How can the group estimate be higher than any of its components and not include the null when most of the components show a negative association?

enter image description here

Code for reference

library(R2jags)
library(coda)
library(dplyr)
library(haven)
library(multcomp)

#Read in data - removed for concision

# Initial model
fit.multiple<-glm(outcome~ exp + covar, data=data.all, family=binomial)
beta <- coef(fit.multiple)[2:31]

# Define constants for BUGS code
# First stage regression
N <- nrow(exp[mydata,]) # number of observations
Nx <- ncol(exp[mydata,]) # number of beta parameters
Nz <- ncol(Zmatrix) # number of observations in 2nd stage matrix
Nw <- ncol(covar[mydata,]) # number of confounders

# tau.b for binary outcomes
range <- log(2) - log(.5)
tau.b <- (range/(2*1.96))^(-2)

jagsdata <- list(N=N, Nx=Nx, Nz=Nz, Nw=Nw, X=exp[mydata,], Y=mydata, 
                 W=covar[mydata,], Z=Zmatrix, tau.b=tau.b)

parameters <- c("a","b","g","pi","OR") #a=pi (coefficient vector from second stage model, b=beta (coefficient from first stage model), g=gamma (confounder coefficients from first stage model)

#Model for categorical outcomes
hierarchical.model <- function(){
  # First stage model:
  for (i in 1:N) {
    logit(p.Y[i]) <-a + inprod(X[i,], b[1:Nx]) + inprod(W[i,],g[]); 
    Y[i] ~ dbin(p.Y[i], 1);
  }
  
  # Second stage model:
  for (j in (1:Nx)) {
    b[j] <- inprod(Z[j,1:Nz], pi[1:Nz]) + delta[j]; 
    delta[j] ~ dnorm(0, tau.b);
    OR[j] <- exp(b[j]); # Calculate ORs of individual exposures for reporting
  }
  
  # Priors on fixed parameters
  # First stage model:
  a ~ dnorm(0,0.001); # 1st stage intercept
  for (l in 1:Nw) {g[l] ~ dnorm(0,0.01); }; # 1st stage confounder effect
  
  # Second-stage model
  for (k in 1:Nz) {pi[k] ~ dnorm(0,0.01); }
}

set.seed(1234)
jags.seed=1234
BHM <- jags(data=jagsdata,parameters=parameters, n.iter=50000, n.thin=5, jags.seed=1234, 
                         model.file=hierarchical.model)
    


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source