I am conducting a network metanalysis using both Bayesian (using JAGS run throug R with the package R2JAGS) and frequentist model and, as a form of heterogeneity, I would like to calculate I2.
However, after computation, I have complete different levels between the Bayesian and the frequentist model (as an example, the frequentist model have 0% I2 whereas the Bayesian have as much as 90% for the same outcome and same comparisons).
How is this possible? I don't understand if it is normal or is an error from the code I'm using.
Here is the code for the Bayesian model (is a random effect design-by-treatment interaction model):
model{
for(i in 1:ns){
h[i,1] <- 0
delta[i,1] <- 0
mu[i] <- log(p[i,1])
p[i,1] ~ dunif(0,1)
for (k in 1:na[i]) {
r[i,k] ~ dbin(p[i,k],n[i,k])
}
for (k in 2:na[i]) {
log(p[i,k]) <- mu[i] + min(delta[i,k], -log(p[i,1]))
delta[i,k] ~ dnorm(md[i,k],taud[i,k])
md[i,k] <- d[t[i,k]] - d[t[i,1]] + w1[i,k]*fw1 + w2[i,k]*fw2 + sh[i,k]
taud[i,k] <- tau.d *2*(k-1)/k
h[i,k] <- delta[i,k] - (d[t[i,k]] + d[t[i,1]] + w1[i,k]*fw1 + w2[i,k]*fw2)
sh[i,k] <- sum(h[i,1:(k-1)])/(k-1)
}
}
sd ~ dunif(0,2)
tau.d <- pow(sd,-2)
fw1 ~ dnorm(0, tau.d)
fw2 ~ dnorm(0, tau.d)
d[1]<-0
for (k in 2:nt){ d[k] ~ dnorm(0,.1) }
for (c in 1:(nt-1)) {
for (k in (c+1):nt) {
lnRR[c,k]<- d[c] - d[k]
RR[c,k]<- exp(d[c]-d[k])
lnRR[k,c]<- d[k] - d[c]
RR[k,c]<- exp(d[k]-d[c])
}
}
rk_bad<-rank(d[])
And here is the code I use for calculating I2 from the posterior distribution:
tau2<-res$BUGSoutput$sims.matrix[,"tau.d"]
I2.cons<-tau2/(tau2+mean(na.omit(sei_All_cause^2)))
median(tau2)
median(I2.cons)
Thanks in advance for the suggestions.