Skip to content

Commit 20cfacb

Browse files
committed
Integrate COPD example
1 parent baf34cd commit 20cfacb

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

COPD-NMA.qmd

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,71 @@ The network compares five single-agent treatments—fluticasone, budesonide, sal
5353
Importantly, the original authors treated the combination therapies as distinct interventions rather than decomposing them into their individual components.
5454

5555

56+
## Setting up the Network
57+
In this vignette we will implement a frequentist NMA using the `netmeta` package. We first convert the arm-level data to contrast-level data using the `pairwise` function:
58+
59+
```{r}
60+
#| echo: true
61+
#| message: false
62+
#| warning: false
63+
Baker <- pairwise(treat = treatment,
64+
event = exac,
65+
n = total,
66+
studlab = id,
67+
sm = "OR",
68+
data = Baker2009)
69+
```
70+
71+
In he resulting data frame `Baker`, each row corresponds to a direct comparison between two treatments within a trial, with columns for the treatment names (`treat1`, `treat2`), the log-odds ratio (`TE`), its standard error (`seTE`), and the study label (`studlab`).
72+
73+
## Random-Effects Network Meta-Analysis
74+
75+
We subsequently fit a random-effects model using the `netmeta` function, specifying "Placebo" as the reference treatment:
76+
77+
```{r}
78+
#| echo: true
79+
#| message: false
80+
#| warning: false
81+
NMA.COPD <- netmeta(TE = TE, seTE = seTE, treat1 = treat1, treat2 = treat2,
82+
studlab = studlab, data = Baker, sm = "OR", ref = "Placebo",
83+
random = TRUE)
84+
85+
netgraph(NMA.COPD)
86+
```
87+
88+
## Assessing Network Inconsistency
89+
We can test for local network inconsistency as follows:
90+
91+
```{r}
92+
#| eval: false
93+
netsplit(NMA.COPD)
94+
```
95+
96+
By default, indirect estimates are derived using the back-calculation method. A comparison of direct and indirect treatment effect estimates (depicted as odds ratio) from the random effects network meta-analysis model is given in the table below:
97+
98+
```{r}
99+
#| echo: false
100+
SIDES.COPD <- netsplit(NMA.COPD)
101+
out <- data.frame("comparison" = SIDES.COPD$comparison,
102+
"k" = SIDES.COPD$k,
103+
"nma" = sprintf("%.2f",exp(SIDES.COPD$random$TE)),
104+
"direct" = sprintf("%.2f",exp(SIDES.COPD$direct.random$TE)),
105+
"indirect" = sprintf("%.2f",exp(SIDES.COPD$indirect.random$TE)),
106+
"RoR" = sprintf("%.2f",exp(SIDES.COPD$compare.random$TE)),
107+
"p.RoR" = sprintf("%.2f",SIDES.COPD$compare.random$p))
108+
109+
# Replacing all NA values with "."
110+
out <- out %>%
111+
mutate(across(everything(), ~ifelse(.=="NA", ".", .)))
112+
113+
out %>%
114+
kable(
115+
align = "lcccccc",
116+
booktabs = TRUE,
117+
longtable = TRUE,
118+
linesep = ""
119+
) %>%
120+
kableExtra::kable_styling(
121+
latex_options = c("repeat_header"),
122+
)
123+
```

0 commit comments

Comments
 (0)