wwiecek / baggr

R package for Bayesian meta-analysis models, using Stan
GNU General Public License v3.0
46 stars 12 forks source link

for models with covariates: add R^2 calculations, fix pooling #137

Open wwiecek opened 2 years ago

wwiecek commented 2 years ago

Reading material:

wwiecek commented 2 years ago

Note: frequentist heterogeneity estimates (and hence R^2) will very easily tend toward extremes and therefore be misleading. See this example:

library(metafor)
k <- 100
x <- rnorm(k,0,1)
dt <- data.frame(se = rep(2, k),
                 x,
           tau = x + rnorm(k, 10, 1))
plot(tau ~ x, data = dt)
lm(tau~x, weights=1/se,data=dt) %>% summary()
lm(tau~x, data=dt) %>% summary()

rma(yi=tau,sei=se,data=dt,mods=~x)

Try changing SE to 0.1, 0.5, 1, 2 etc. and see how R^2 seems to only be estimated similarly to lm when SE is very low