When do I need local R?
For the full capability matrix between browser-only, WebR, and local R:
| Capability | Browser | WebR | Local R |
|---|---|---|---|
| Pairwise / NMA / DTA / meta-regression | ✓ | ✓ (real metafor/netmeta) | ✓ |
Frequentist inconsistency (netsplit, netheat) | approx | ✓ real | ✓ |
| Sensitivity (Copas, limit-MA) | approx | ✓ real metasens | ✓ |
Exact Bayesian MA (bayesmeta) | — | ✓ | ✓ |
Bayesian NMA with MCMC (gemtc, multinma) | — | — | ✓ (needs JAGS/Stan) |
Full HMC / NUTS (rstan, brms, cmdstanr) | — | — | ✓ |
IPD models (ipdmeta, nlme) | — | partial | ✓ |
| Very large networks (>40 treatments) | — | slow | ✓ |
Install R + core stack
Step 1 — base R
Download from CRAN. On Windows, also install Rtools so that packages with compiled code build correctly. Recommended R version: ≥ 4.3.
Step 2 — editor (optional but recommended)
RStudio Desktop (free) or Quarto for reproducible reports.
Step 3 — the allmeta package set
Copy this into your R console. It covers everything this hub does natively, plus the MCMC packages that only work locally:
button
# allmeta — full CRAN stack
pkgs <- c(
# Pairwise + random-effects
"metafor", "meta", "metaSEM", "clubSandwich", "robumeta",
# Network meta-analysis
"netmeta", "gemtc", "multinma", "bnma",
# Diagnostic test accuracy
"mada", "CopulaDTA",
# Publication bias / sensitivity
"metasens", "puniform", "weightr", "dmetar",
# Bayesian
"bayesmeta", "brms", "baggr", "RoBMA",
# IPD
"ipdmeta", "ecoreg",
# Risk of bias / GRADE
"robvis", "metaumbrella",
# K-M reconstruction
"IPDfromKM",
# Screening / data formatting
"revtools", "synthesisr", "metagear"
)
install.packages(pkgs, dependencies = TRUE)
# MCMC back-ends
# JAGS: install from https://sourceforge.net/projects/mcmc-jags/
# Stan / rstan:
install.packages("rstan", repos = c("https://stan-dev.r-universe.dev", "https://cloud.r-project.org"))
# Or cmdstanr + CmdStan:
install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev", "https://cloud.r-project.org"))
cmdstanr::install_cmdstan()
Reproducing each allmeta app
Every browser app in allmeta can be replicated in local R. Here are the one-liners:
Pairwise MA equivalent to MA Workbench / Forest Plot / TruthCert
library(metafor)
dat <- data.frame(yi = c(0.25, 0.18, 0.40, 0.30, 0.12),
sei = c(0.08, 0.10, 0.15, 0.09, 0.07))
res <- rma(yi = yi, sei = sei, data = dat, method = "REML", test = "knha")
print(res); forest(res)
NMA equivalent to NMA Pro / Bayesian NMA / Inconsistency
library(netmeta)
d <- data.frame(treat1 = c("A","A","B","A","B","C"),
treat2 = c("B","C","C","D","D","D"),
TE = c(-0.30, -0.20, 0.10, -0.50, -0.25, -0.35),
seTE = c( 0.10, 0.12, 0.11, 0.15, 0.18, 0.14),
studlab= paste0("S", 1:6))
nm <- netmeta(TE, seTE, treat1, treat2, studlab, data = d, reference.group = "A", random = TRUE)
print(nm); netsplit(nm); netheat(nm); netrank(nm)
Bayesian NMA equivalent to Network MA with SUCRA — real MCMC
library(gemtc) # Requires JAGS (install separately) net <- mtc.network(data.re = d) # d = per-comparison effect + se model <- mtc.model(net, type = "consistency", link = "identity", likelihood = "normal") fit <- mtc.run(model, n.adapt = 2000, n.iter = 20000, thin = 5, n.chain = 3) print(summary(fit)); rank.probability(fit); sucra(rank.probability(fit))
DTA equivalent to HSROC / DTA SROC
library(mada)
d <- data.frame(TP = c(85, 72, 110, 45, 92),
FP = c( 9, 11, 18, 6, 14),
FN = c(15, 18, 20, 8, 14),
TN = c(91, 99, 152, 41, 80))
reit <- reitsma(d); print(summary(reit)); plot(reit)
Publication bias — Copas
library(meta); library(metasens) m <- metagen(TE, seTE, data = d) co <- copas(m); print(co); plot(co)
Multi-level (3-level) MA
library(metafor) # data: study, outcome, yi, vi res <- rma.mv(yi, V = vi, random = ~ 1 | study/outcome, data = d, method = "REML") print(res); summary(res)
Risk of bias — RoB 2 / ROBINS-I / QUADAS-2
library(robvis)
d <- read.csv("your_rob2_assessments.csv") # one row per study, columns per domain
rob_traffic_light(data = d, tool = "ROB2")
rob_summary(data = d, tool = "ROB2")
K-M IPD reconstruction
library(IPDfromKM) # curve: data.frame(time, surv) # risk: data.frame(time, nrisk) pre <- preprocess(dat = curve, trisk = risk$time, nrisk = risk$nrisk) ipd <- getIPD(pre, armID = 1, tot.events = 145) head(ipd)
MCMC back-ends
JAGS (for gemtc, rjags, R2jags, multinma)
Download from mcmc-jags. On Windows, JAGS auto-registers with R. On macOS with Homebrew: brew install jags. On Linux: apt-get install jags.
Stan (for rstan, brms, cmdstanr, bayesmeta+Stan)
cmdstanr is the modern, recommended path. After install.packages("cmdstanr") run cmdstanr::install_cmdstan() which compiles Stan in the background (5-15 minutes first time). On Windows, Rtools provides the C++ toolchain.
Verify
library(rstan)
# Tiny HMC test
fit <- stan(model_code = "parameters { real y; } model { y ~ normal(0, 1); }", iter = 200)
print(fit)
Reproducibility harness
For every allmeta result you publish, save the exact R session that produced it:
library(renv) renv::init() # creates a lock-file of package versions renv::snapshot() # call this after you finish the analysis # distribute your script + renv.lock so others can reproduce exactly
Or use a Docker image: rocker/verse has R, RStudio, and the tidyverse pre-installed; add the allmeta stack on top.