Teach Bayesian approaches to meta-analysis including prior specification, MCMC methods, and interpretation of posterior distributions. Use when users want to incorporate prior knowledge, need probabilistic interpretations, or are working with sparse data.
This skill teaches Bayesian approaches to meta-analysis, enabling probabilistic inference, incorporation of prior knowledge, and more intuitive interpretation of results.
Bayesian meta-analysis provides a framework for combining prior beliefs with observed data to produce posterior probability distributions. It offers advantages in handling sparse data, complex models, and provides direct probability statements about effects.
Activate this skill when users:
Key Differences:
| Aspect | Frequentist | Bayesian |
|---|---|---|
| Parameters | Fixed but unknown | Random variables |
| Probability | Long-run frequency | Degree of belief |
| Prior info | Not formally used | Explicitly incorporated |
| Results | Point estimate + CI | Posterior distribution |
| Interpretation | "95% of CIs contain true value" | "95% probability effect is in this range" |
Socratic Questions:
The Formula:
Posterior ∝ Likelihood × Prior
P(θ|data) ∝ P(data|θ) × P(θ)
Components:
Teaching Framework:
┌─────────────────────────────────────────────────┐
│ │
│ Prior Knowledge + New Data = Updated │
│ (Previous MA, (Current Belief │
│ Expert opinion) studies) (Posterior) │
│ │
└─────────────────────────────────────────────────┘
Types of Priors:
| Prior Type | Description | When to Use |
|---|---|---|
| Non-informative | Vague, minimal influence | Default, let data speak |
| Weakly informative | Constrains to plausible range | Regularization |
| Informative | Based on previous evidence | Historical data available |
| Skeptical | Centered on null | Conservative analysis |
| Enthusiastic | Favors effect | Sensitivity analysis |
Common Priors for Effect Sizes:
# Non-informative for log-OR
prior_effect <- normal(0, 10) # Very wide
# Weakly informative
prior_effect <- normal(0, 1) # Most effects within ±2
# For heterogeneity (tau)
prior_tau <- half_cauchy(0, 0.5) # Recommended
prior_tau <- half_normal(0, 1) # Alternative
Prior Sensitivity Analysis:
What is MCMC?
Key Concepts:
Convergence Diagnostics:
# R-hat (should be < 1.01)
# Effective sample size (ESS > 400)
# Trace plots (should look like "fuzzy caterpillars")
# Autocorrelation (should decay quickly)
Using brms (recommended for beginners):
library(brms)
# Prepare data
data <- data.frame(
yi = effect_sizes,
sei = standard_errors,
study = study_names
)
# Bayesian random-effects meta-analysis
fit <- brm(
yi | se(sei) ~ 1 + (1|study),
data = data,
prior = c(
prior(normal(0, 1), class = Intercept),
prior(half_cauchy(0, 0.5), class = sd)
),
chains = 4,
iter = 4000,
warmup = 1000,
cores = 4
)
# Results
summary(fit)
plot(fit)
Using bayesmeta:
library(bayesmeta)
# Bayesian meta-analysis
bma <- bayesmeta(
y = effect_sizes,
sigma = standard_errors,
labels = study_names,
tau.prior = function(t) dhalfcauchy(t, scale = 0.5)
)
# Summary and plots
summary(bma)
forestplot(bma)
Using JAGS/Stan directly:
# Stan model for meta-analysis
stan_model <- "
data {
int<lower=0> N; // number of studies
vector[N] y; // effect sizes
vector<lower=0>[N] sigma; // standard errors
}
parameters {
real mu; // overall effect
real<lower=0> tau; // heterogeneity
vector[N] theta; // study effects
}
model {
// Priors
mu ~ normal(0, 1);
tau ~ cauchy(0, 0.5);
// Likelihood
theta ~ normal(mu, tau);
y ~ normal(theta, sigma);
}
"
Key Outputs:
Example Interpretation:
Posterior mean: OR = 0.72
95% CrI: [0.58, 0.89]
P(OR < 1): 99.8%
P(OR < 0.8): 78%
Interpretation: "There is a 99.8% probability that the treatment
reduces the odds of the outcome. There is a 78% probability that
the odds reduction is at least 20%."
Methods:
# Compare models in brms
loo1 <- loo(model1)
loo2 <- loo(model2)
loo_compare(loo1, loo2)
# Bayes Factor
bayes_factor(model1, model2)
Basic: "What is the main difference between a confidence interval and a credible interval?"
Intermediate: "Why might you choose a weakly informative prior over a non-informative one?"
Advanced: "How would you assess whether your prior is having too much influence on the posterior?"
"Bayesian = subjective, Frequentist = objective"
"Non-informative priors are always best"
"More iterations = better results"
User: "I have only 3 small studies on a rare disease treatment. Can I still do meta-analysis?"
Response Framework:
Glass (the teaching agent) MUST adapt this content to the learner:
Example Adaptations:
meta-analysis-fundamentals - Basic concepts prerequisiteheterogeneity-analysis - Understanding tau parameternetwork-meta-analysis - Often uses Bayesian frameworkr-code-generation - Implementation support