# NOT RUN {
library(jarbes)
out = gesmix(data = ppvipd)
attach.jags(out, overwrite = TRUE)
par(mfrow = c(1,2))
hist(lambda[,1], breaks = 100, probability = TRUE,
ylim = c(0, 3),
xlim = c(-2, 0.85), main = "",
xlab = "Treatment Effect: log(Odds Ratio)")
lines(density(lambda[,2]), lwd = 3, col = "red")
lines(density(lambda[,1]), lwd = 3, col = "blue")
abline(v = 0, lty = 2)
legend(-2, 3, legend = c("RCTs' Component",
"Obsevationals' Component"),
col = c("blue", "red"),
lty = rep(1, 2),
lwd = rep(2, 2))
hist(c(lambda[,1],lambda[,2]+0.337),
breaks = 150,
probability = TRUE,
ylim = c(0, 3.5),
xlim = c(-2.1, 0.2), main = "",
xlab = "Treatment Effect: log(Odds Ratio)")
lines(density(c(lambda[,1],lambda[,2]+0.337)), col = "blue", lwd =3)
abline(v = quantile(c(lambda[,1],lambda[,2]+0.337),
probs = c(0.025,0.5,0.975)), col ="blue",
lty = 2)
m.pool <- log(0.43)
sd.pool <- (log(0.54) - log(0.34))/(2*1.96)
curve(dnorm(x, m = m.pool, s = sd.pool),
from = -3, to = 0.5, add = TRUE, col = "black", lwd =3)
legend(-2.1, 3,
legend = c("Bias-adjusted",
"Biased result"),
col = c("blue", "black"),
lty = rep(1, 2),
lwd = rep(2, 2))
abline(v = 0, lty = 2)
arrows(-1.5, 1.1, -1, 1.55, lwd =2, length=0.1, angle=20)
text(-1.8, 1, "Ignoring study types")
par(mfrow = c(1,1))
# }
Run the code above in your browser using DataLab