flowchart LR
A[概念理解] --> B[網絡幾何]
B --> C[NMA 執行]
C --> D[一致性評估]
D --> E[排名分析]
E --> F[學術報告]
Network Meta-analysis with R
2025-12-10
研究問題:比較四種降血壓藥物(A、B、C、D)對收縮壓的相對效果
set.seed(2024)
nma_data <- data.frame(
study = c("Wang 2018", "Chen 2019", "Liu 2020", "Zhang 2020",
"Kim 2021", "Tanaka 2021", "Smith 2022", "Johnson 2023",
"Lee 2019", "Park 2020", "Brown 2021", "Davis 2022"),
treat1 = c("A", "A", "A", "B", "B", "C", "A", "B", "A", "C", "B", "C"),
treat2 = c("B", "C", "D", "C", "D", "D", "B", "C", "C", "D", "D", "D"),
n1 = c(45, 68, 52, 120, 38, 85, 63, 95, 55, 72, 48, 90),
n2 = c(43, 65, 50, 118, 40, 82, 60, 92, 53, 70, 50, 88),
mean1 = c(-12.3, -10.5, -14.2, -8.5, -9.2, -7.8, -11.8, -8.2, -10.8, -7.5, -9.0, -7.2),
sd1 = c(8.2, 7.5, 9.1, 7.8, 7.2, 8.5, 7.9, 8.3, 7.6, 8.1, 7.4, 8.0),
mean2 = c(-3.2, -4.5, -5.1, -4.8, -5.5, -4.2, -3.8, -4.5, -4.2, -3.8, -5.2, -3.5),
sd2 = c(7.8, 7.2, 8.5, 7.5, 6.9, 8.1, 7.5, 7.9, 7.3, 7.8, 7.0, 7.6)
)| study | treat1 | treat2 | n1 | n2 |
|---|---|---|---|---|
| Wang 2018 | A | B | 45 | 43 |
| Chen 2019 | A | C | 68 | 65 |
| Liu 2020 | A | D | 52 | 50 |
| Zhang 2020 | B | C | 120 | 118 |
| Kim 2021 | B | D | 38 | 40 |
| Tanaka 2021 | C | D | 85 | 82 |
| Smith 2022 | A | B | 63 | 60 |
| Johnson 2023 | B | C | 95 | 92 |
| Lee 2019 | A | C | 55 | 53 |
| Park 2020 | C | D | 72 | 70 |
| Brown 2021 | B | D | 48 | 50 |
| Davis 2022 | C | D | 90 | 88 |
| 欄位 | 說明 |
|---|---|
study |
研究名稱 |
treat1, treat2 |
比較的兩種治療 |
n1, n2 |
各組樣本數 |
mean1, mean2 |
各組平均值 |
sd1, sd2 |
各組標準差 |
比喻
傳統統合分析像是「一對一比賽」,網絡統合分析像是「循環賽」
傳統統合分析的限制
網絡統合分析的優勢
核心假設
網絡統合分析假設直接與間接證據一致
| 元素 | 意義 |
|---|---|
| 節點 | 治療選項 |
| 節點大小 | 該治療的總樣本數 |
| 連線 | 存在直接比較 |
| 連線粗細 | 研究數量 |
Original data:
treat1 treat2 TE seTE
Wang 2018 A B -1.1365 0.2298
Chen 2019 A C -0.8158 0.1805
Liu 2020 A D -1.0328 0.2109
Zhang 2020 B C -0.4835 0.1315
Kim 2021 B D -0.5250 0.2304
Tanaka 2021 C D -0.4334 0.1566
Smith 2022 A B -1.0379 0.1921
Johnson 2023 B C -0.4565 0.1482
Lee 2019 A C -0.8854 0.2017
Park 2020 C D -0.4652 0.1701
Brown 2021 B D -0.5279 0.2056
Davis 2022 C D -0.4741 0.1520
Number of treatment arms per study:
narms
Wang 2018 2
Chen 2019 2
Liu 2020 2
Zhang 2020 2
Kim 2021 2
Tanaka 2021 2
Smith 2022 2
Johnson 2023 2
Lee 2019 2
Park 2020 2
Brown 2021 2
Davis 2022 2
Results (random effects model):
treat1 treat2 SMD 95%-CI
Wang 2018 A B -0.7609 [-1.0133; -0.5085]
Chen 2019 A C -0.9934 [-1.2354; -0.7514]
Liu 2020 A D -1.3482 [-1.6185; -1.0779]
Zhang 2020 B C -0.2325 [-0.4460; -0.0190]
Kim 2021 B D -0.5873 [-0.8264; -0.3481]
Tanaka 2021 C D -0.3548 [-0.5594; -0.1502]
Smith 2022 A B -0.7609 [-1.0133; -0.5085]
Johnson 2023 B C -0.2325 [-0.4460; -0.0190]
Lee 2019 A C -0.9934 [-1.2354; -0.7514]
Park 2020 C D -0.3548 [-0.5594; -0.1502]
Brown 2021 B D -0.5873 [-0.8264; -0.3481]
Davis 2022 C D -0.3548 [-0.5594; -0.1502]
Number of studies: k = 12
Number of pairwise comparisons: m = 12
Number of treatments: n = 4
Number of designs: d = 6
Random effects model
Treatment estimate (other treatments vs 'A'):
SMD 95%-CI z p-value
A . . . .
B 0.7609 [0.5085; 1.0133] 5.91 < 0.0001
C 0.9934 [0.7514; 1.2354] 8.05 < 0.0001
D 1.3482 [1.0779; 1.6185] 9.78 < 0.0001
Quantifying heterogeneity / inconsistency:
tau^2 = 0.0221; tau = 0.1485; I^2 = 41.2% [0.0%; 71.9%]
Tests of heterogeneity (within designs) and inconsistency (between designs):
Q d.f. p-value
Total 15.31 9 0.0829
Within designs 0.23 6 0.9998
Between designs 15.07 3 0.0018
Details of network meta-analysis methods:
- Frequentist graph-theoretical approach
- DerSimonian-Laird estimator for tau^2
- Calculation of I^2 based on Q
League table (random effects model):
A -1.08 (-1.44; -0.73) -0.85 (-1.18; -0.51)
-0.76 (-1.01; -0.51) B -0.47 (-0.75; -0.19)
-0.99 (-1.24; -0.75) -0.23 (-0.45; -0.02) C
-1.35 (-1.62; -1.08) -0.59 (-0.83; -0.35) -0.35 (-0.56; -0.15)
-1.03 (-1.54; -0.53)
-0.53 (-0.89; -0.16)
-0.46 (-0.70; -0.21)
D
Lower triangle: results from network meta-analysis (column vs row)
Upper triangle: results from direct comparisons (row vs column)
Results
This network meta-analysis included 12 RCTs comparing 4 treatments. Using treatment A as the reference, all treatments significantly reduced blood pressure.
Q statistics to assess homogeneity / consistency
Q df p-value
Total 15.31 9 0.0829
Within designs 0.23 6 0.9998
Between designs 15.07 3 0.0018
Design-specific decomposition of within-designs Q statistic
Design Q df p-value
A:B 0.11 1 0.7422
A:C 0.07 1 0.7970
B:C 0.02 1 0.8915
C:D 0.04 2 0.9814
B:D 0.00 1 0.9926
Between-designs Q statistic after detaching of single designs
(influential designs have p-value markedly different from 0.0018)
Detached design Q df p-value
B:C 3.65 2 0.1609
A:B 4.41 2 0.1101
C:D 10.86 2 0.0044
A:D 11.76 2 0.0028
A:C 12.26 2 0.0022
B:D 14.33 2 0.0008
Q statistic to assess consistency under the assumption of
a full design-by-treatment interaction random effects model
Q df p-value tau.within tau2.within
Between designs 15.07 3 0.0018 0 0
Separate indirect from direct evidence (SIDE) using back-calculation method
Random effects model:
comparison k prop nma direct indir. Diff z p-value
B:A 2 0.50 0.7609 1.0814 0.4371 0.6443 2.50 0.0124
C:A 2 0.52 0.9934 0.8482 1.1519 -0.3037 -1.23 0.2191
D:A 1 0.29 1.3482 1.0328 1.4745 -0.4417 -1.45 0.1478
B:C 2 0.57 -0.2325 -0.4707 0.0847 -0.5554 -2.52 0.0116
B:D 2 0.43 -0.5873 -0.5266 -0.6331 0.1065 0.43 0.6657
C:D 3 0.69 -0.3548 -0.4575 -0.1274 -0.3301 -1.46 0.1431
Legend:
comparison - Treatment comparison
k - Number of studies providing direct evidence
prop - Direct evidence proportion
nma - Estimated treatment effect (SMD) in network meta-analysis
direct - Estimated treatment effect (SMD) derived from direct evidence
indir. - Estimated treatment effect (SMD) derived from indirect evidence
Diff - Difference between direct and indirect treatment estimates
z - z-value of test for disagreement (direct versus indirect)
p-value - p-value of test for disagreement (direct versus indirect)
| 指標 | 閾值 | 解讀 |
|---|---|---|
| Q (設計間) | p < 0.10 | 存在設計間不一致性 |
| 節點分割 p 值 | p < 0.10 | 該比較存在不一致性 |
| I² 值 | 異質性程度 |
|---|---|
| < 25% | 低度 |
| 25-50% | 中度 |
| 50-75% | 中高度 |
| > 75% | 高度 |
Surface Under the Cumulative Ranking (SUCRA)
謹慎解讀排名
網絡統合迴歸的限制
nma_fixed <- netmeta(
TE = smd,
seTE = se,
treat1 = treat1,
treat2 = treat2,
studlab = study,
data = nma_data,
sm = "SMD",
reference.group = "A",
common = TRUE,
random = FALSE
)
comparison_df <- data.frame(
Comparison = c("B vs A", "C vs A", "D vs A"),
Random = round(c(nma_result$TE.random["B", "A"],
nma_result$TE.random["C", "A"],
nma_result$TE.random["D", "A"]), 3),
Fixed = round(c(nma_fixed$TE.common["B", "A"],
nma_fixed$TE.common["C", "A"],
nma_fixed$TE.common["D", "A"]), 3)
)
knitr::kable(comparison_df, caption = "模型比較")| Comparison | Random | Fixed |
|---|---|---|
| B vs A | 0.761 | 0.730 |
| C vs A | 0.993 | 1.003 |
| D vs A | 1.348 | 1.361 |
必要項目
進階項目
# 建立排名摘要
rank_summary <- data.frame(
Treatment = names(ranking$Pscore.random),
P_score = round(ranking$Pscore.random, 3)
)
rank_summary <- rank_summary[order(-rank_summary$P_score), ]
summary_df <- data.frame(
指標 = c("納入研究數", "治療選項數", "總樣本數",
"最佳治療", "P-score", "I²"),
數值 = c(nma_result$k,
nma_result$n,
sum(nma_data$n1) + sum(nma_data$n2),
rank_summary$Treatment[1],
paste0(rank_summary$P_score[1] * 100, "%"),
paste0(round(nma_result$I2, 1), "%"))
)
knitr::kable(summary_df, caption = "網絡統合分析結果摘要")| 指標 | 數值 |
|---|---|
| 納入研究數 | 12 |
| 治療選項數 | 4 |
| 總樣本數 | 1642 |
| 最佳治療 | A |
| P-score | 100% |
| I² | 0.4% |
| 項目 | 完成 |
|---|---|
| 明確定義研究問題 (PICO) | ☐ |
| 事先註冊 (PROSPERO) | ☐ |
| 確認網絡可連通 | ☐ |
| 項目 | 完成 |
|---|---|
| 繪製網絡幾何圖 | ☐ |
| 執行網絡統合分析 | ☐ |
| 評估一致性 | ☐ |
| 計算治療排名 | ☐ |
| 敏感度分析 | ☐ |
| 項目 | 完成 |
|---|---|
| 遵循 PRISMA-NMA 指引 | ☐ |
| 呈現 League table | ☐ |
| GRADE 評估證據品質 | ☐ |
| 面向 | 傳統統合分析 | 網絡統合分析 |
|---|---|---|
| 比較數 | 2 種治療 | ≥ 3 種治療 |
| 證據類型 | 僅直接 | 直接 + 間接 |
| 排名 | 無 | 有 |
| 一致性 | 不適用 | 需評估 |
感謝參與!
有任何問題歡迎討論
Network Meta-analysis Course