-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchapter_11.qmd
550 lines (450 loc) · 24 KB
/
chapter_11.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
---
title: "Individual Participant Data Meta-analysis of clinical trials and real-world data"
authors:
- name: Pablo Verde
affiliations:
- ref: umcdusseldorf
- name: Thomas Debray
orcid: 0000-0002-1790-2719
affiliations:
- ref: smartdas
affiliations:
- id: smartdas
name: Smart Data Analysis and Statistics B.V.
city: Utrecht
- id: umcdusseldorf
name: Universitätsklinikum Düsseldorf
city: Düsseldorf
format:
html:
toc: true
number-sections: true
execute:
cache: true
bibliography: 'https://api.citedrive.com/bib/0d25b38b-db8f-43c4-b934-f4e2f3bd655a/references.bib?x=eyJpZCI6ICIwZDI1YjM4Yi1kYjhmLTQzYzQtYjkzNC1mNGUyZjNiZDY1NWEiLCAidXNlciI6ICIyNTA2IiwgInNpZ25hdHVyZSI6ICI0MGFkYjZhMzYyYWE5Y2U0MjQ2NWE2ZTQzNjlhMWY3NTk5MzhhNzUxZDNjYWIxNDlmYjM4NDgwOTYzMzY5YzFlIn0=/bibliography.bib'
---
```{r}
#| include: false
#| echo: false
#| message: false
#| warning: false
# List of required packages
required_packages <- c("ggplot2", "dplyr", "gridExtra", "mcmcplots",
"grid", "table1", "jarbes",
"gridExtra", "GGally")
# Install required packages
for (pkg in required_packages) {
if (!requireNamespace(pkg, quietly = TRUE)) {
install.packages(pkg)
}
}
library(kableExtra)
library(table1)
library(ggplot2)
```
## Introduction
## Hierarchical Meta-Regression
We illustrate the implementation of hierarchical meta-regression using an example that involves the following data sources:
* Aggregate data from 35 randomized trials investigating the efficacy of adjunctive treatments in managing diabetic foot problems compared with routine care
* Individual participant data from a prospective cohort study investigating patient and limb survival in patients with diabetic foot ulcers
### Aggregate data
We first retrieve the randomized evidence and summarize the treatment effect estimates using a random effects meta-analysis:
```{r}
#| warning: false
#| message: false
#| results: hide
library(dplyr)
library(jarbes)
library(metafor)
data("healing")
addat <- escalc(measure="OR", ai=y_t, bi=n_t-y_t, ci=y_c, di=n_c-y_c, data=healing)
results.ADJ <- metagen(TE = yi, seTE = sqrt(vi),
studlab = Study, data = addat,
sm = "OR",
prediction = TRUE)
```
The corresponding forest plot is depicted below. The endpoint is healing without amputations within a period less than or equal to 1 year.
```{r}
#| echo: false
#| fig-width: 10
#| fig-height: 10
meta::forest(results.ADJ, leftcols = c("studlab"), rightcols = "effect.ci")
```
The random effects meta-analysis yielded a pooled odds ratio of `r sprintf("%.2f", exp(results.ADJ$TE.random))`. However, substantial between-study heterogeneity was found, with $\tau$ = `r sprintf("%.2f", results.ADJ$tau)`.
### Individual participant data
Subsequently, we retrieve the individual participant data:
```{r}
#| warning: false
data("healingipd")
IPD <- healingipd %>% dplyr::select(healing.without.amp, PAD, neuropathy,
first.ever.lesion, no.continuous.care,
male, diab.typ2, insulin, HOCHD,
HOS, CRF, dialysis, DNOAP, smoking.ever,
diabdur, wagner.class)
```
Briefly, these IPD were obtained from a prospective cohort study enrolling consecutive patients with diabetic foot ulcers (DFUs) and without previous major amputation in a single diabetes center between June 1998 and December 1999 [@morbach_long-term_2012]. The baseline characteristics of the study population are summarized below:
```{r}
#| echo: false
wagner.groups <- table(IPD$wagner.class)
IPD.and.wagner <- table(IPD$PAD, IPD$wagner.class)
dstbl <- healingipd %>% mutate(healing.without.amp = factor(healing.without.amp , levels = c(1,0), labels = c("Healing without amputation", "No healing without amputation")),
PAD = factor(PAD , levels = c(1,0), labels = c("Yes", "No")),
neuropathy = factor(neuropathy, levels = c(1,0), labels = c("Yes", "No")),
first.ever.lesion = factor(first.ever.lesion, levels = c(1,0), labels = c("Yes", "No")),
no.continuous.care = factor(no.continuous.care, levels = c(1,0), labels = c("Yes", "No")),
gender = ifelse(male == 1, "Male", "Female"),
diab.typ2 = factor(diab.typ2, levels = c(1,0), labels = c("Yes", "No")),
insulin = factor(insulin, levels = c(1,0), labels = c("Yes", "No")),
HOCHD = factor(HOCHD, levels = c(1,0), labels = c("Yes", "No")),
HOS = factor(HOS, levels = c(1,0), labels = c("Yes", "No")),
CRF = factor(CRF, levels = c(1,0), labels = c("Yes", "No")),
dialysis = factor(dialysis, levels = c(1,0), labels = c("Yes", "No")),
DNOAP = factor(DNOAP, levels = c(1,0), labels = c("Yes", "No")),
smoking.ever = factor(smoking.ever, levels = c(1,0), labels = c("Yes", "No")))
label(dstbl$healing.without.amp) <- "Healing without amputation"
label(dstbl$age) <- "Age"
label(dstbl$PAD) <- "Peripheral arterial disease"
label(dstbl$neuropathy) <- "Neuropathy"
label(dstbl$first.ever.lesion) <- "First ever lesion"
label(dstbl$no.continuous.care) <- "No continuous care"
label(dstbl$gender) <- "Sex"
label(dstbl$diab.typ2) <- "Diabetes type 2"
label(dstbl$insulin) <- "Insulin dependent"
label(dstbl$HOCHD) <- "History of coronary events (CHD)"
label(dstbl$HOS) <- "History of stroke"
label(dstbl$CRF) <- "Charcot foot syndrome"
label(dstbl$dialysis) <- "Dialysis"
label(dstbl$DNOAP) <- "Diabetic Neuropathic Osteoarthropathy (DNOAP)"
label(dstbl$smoking.ever) <- "Ever smoker"
label(dstbl$diabdur) <- "Diabetes duration"
label(dstbl$wagner.class) <- "Wagner score"
units(dstbl$age) <- "years"
units(dstbl$diabdur) <- "years"
table1(~ age + diabdur + gender + smoking.ever + diab.typ2 + PAD + neuropathy + first.ever.lesion +
no.continuous.care + insulin + HOCHD +
HOS + CRF + dialysis + DNOAP + wagner.class | healing.without.amp, data = dstbl)
```
As depicted above, IPD are available from `r nrow(healingipd)` patients. Some of these patients have similar characteristics to those enrolled in the randomized trials. However, other patients have comorbidities, where one or more risk factors prevent them to participate in the RCTs due to ethical reasons. For example,
`r wagner.groups[2]` patients have severe ulcer lesions (Wagner score 3 to 5), and `r IPD.and.wagner[2,2]` patients suffer from severe ulcer lesions and peripheral arterial disease (PAD). The question is: Can we generalize the benefit of adjuvant therapies observed in the RCTs to the subgroups of patients encountered in clinical practice?
### Hierarchical metaregression
We first investigate the event rate of patients receiving routine care:
```{r}
#| warning: false
#| message: false
#| echo: false
#| fig-width: 10
#| fig-height: 10
healingplus <- healing %>% dplyr::select(Study, y_c, n_c) %>%
mutate("Source" = "RCT", cil = NA, ciu = NA) %>%
add_row(data.frame(Study = "Morbach 2012",
y_c = nrow(healingipd %>% filter(healing.without.amp==1)),
n_c = nrow(healingipd),
Source = "RWD")) %>%
mutate(prop = y_c/n_c) %>%
arrange(prop)
for (i in seq(nrow(healingplus))) {
proptest <- prop.test(x = healingplus$y_c[i], n = healingplus$n_c[i], correct=FALSE)
healingplus$cil[i] <- proptest$conf.int[1]
healingplus$ciu[i] <- proptest$conf.int[2]
}
ggplot(healingplus, aes(x=prop, y=reorder(Study, prop))) +
geom_errorbar(aes(xmin = cil, xmax = ciu, color = Source)) +
geom_point(aes(color = Source)) +
xlab("Recovery within one year (%)") +
ylab("")+
theme(legend.position = "bottom") +
scale_x_continuous(labels = scales::percent)
```
The forest plot above indicates that the baseline risk in the observational study from Morbach et al. is much higher than most trials.
We fitted an HMR model to the available RWD and published AD:
```{r hmr_fit}
#| message: false
#| warning: false
#| results: hide
set.seed(2022)
AD <- healing %>% dplyr::select(yc = y_c, nc = n_c,
yt = y_t, nt = n_t, Study = Study)
mx2 <- hmr(data = AD, # Published aggregate data
two.by.two = FALSE, #
dataIPD = IPD, # Data frame of the IPD
re = "sm", # Random effects model: "sm" scale mixtures
link = "logit", # Link function of the random effects
sd.mu.1 = 1, # Scale parameter for the prior of mu.1
sd.mu.2 = 1, # Scale parameter for the prior of mu.2
sd.mu.phi = 1, # Scale parameter for the prior of mu.phi
sigma.1.upper = 5, # Upper bound of the prior of sigma.1
sigma.2.upper = 5, # Upper bound of the prior of sigma.2
sigma.beta.upper = 5, # Upper bound of the prior of sigma.beta
sd.Fisher.rho = 1.25, # Scale parameter for the prior of rho
df.estimate = TRUE, # If TRUE the degrees of freedom are estimated
df.lower = 3, # Lower bound of the df's prior
df.upper = 10, # Upper bound of the df's prior
nr.chains = 2, # Number of MCMC chains
nr.iterations = 10000, # Total number of iterations
nr.adapt = 1000, # Number of iteration for burnin
nr.thin = 1) # Thinning rate
```
We start our analysis by visualizing the conflict of evidence between the different types of data and study types. The figure below depicts the posterior distribution of $\mu_{\phi}$, which is the mean bias of the IPD-NRS compared to the AD-RCTs control groups. With only one IPD-NRS, this parameter is partially
identifiable from the data. However, we can expect to learn about this bias parameter
in a full Bayesian model.
<!-- The posterior distribution has a substantial probability mass below zero, which indicates that in average the IPD-NRS patients present a better prognoses than the AD-RCTs control groups. -->
```{r}
# Pablo's calculations ...
mu.phi <- mx2$BUGSoutput$sims.list$mu.phi
mean(mu.phi)
sd(mu.phi)
# Bias parameters:
# mean sd 2.5% 25% 50% 75% 97.5% Rhat n.eff
# mu.phi 0.79 1.09 -1.35 0.09 0.78 1.48 2.96 1 5000
# Pr(mu.phi>0|Data) ...
Pr.mu.phi = sum(mu.phi > 0)/length(mu.phi)
Pr.mu.phi
```
The posterior distribution of $\mu_{\phi}$ has a mean of `r round(mean(mu.phi),2)` and a 95% posterior interval of [`r round(quantile(mu.phi, 0.025),2)`, `r round(quantile(mu.phi, 0.975),2)`]. The posterior probability that $\mu_{\phi}$ is greater than zero is `r round(Pr.mu.phi*100)`%, which indicates
that in average the IPD-NRS of this cohort present a better prognoses that the AD-RCTs control groups.
That means that taking the IPD-NRS results at face value would be misleading if we aim to combine them with a meta-analysis of AD-RCTs.
```{r}
#| fig-cap: Posterior sensitivity analysis of bias mean between the RCTs and the IPD-NRS.
#| label: fig-hmr1
#| echo: false
#| message: false
#| warning: false
#| results: hide
#| fig-width: 11
#| fig-height: 10
# Diagnostic plot
mu.phi <- mx2$BUGSoutput$sims.list$mu.phi
mean.mu.phi <- mx2$prior$mean.mu.phi
sd.mu.phi <- mx2$prior$sd.mu.phi
df.mu.phi <- data.frame(x = mu.phi, dist = "Posterior")
ggplot(df.mu.phi, aes(x = x, colour = "Posterior")) +
geom_density() +
geom_histogram(aes(y = after_stat(density)), fill = "gray", alpha = 0.3, bins = 60) +
geom_vline(xintercept = mean.mu.phi, linewidth = 0.5, lty = 2) +
geom_vline(xintercept = mean(mu.phi), aes(col = 'Posterior'), size = 1, lty = 2) +
stat_function(fun = dlogis, n = 101,
args = list(location = mean.mu.phi, scale = sd.mu.phi), size = 0.5, aes(color='Prior')) +
labs(x = expression(mu[phi]), y = "Density", color = "Density") +
scale_color_manual(name='',
breaks=c('Prior', 'Posterior'),
values=c('Prior'='black', 'Posterior'='gray')) +
guides(color = guide_legend(override.aes = list(fill = NA))) +
xlim(c(-10, 10)) + theme_bw() +
theme(
legend.position = "bottom" # Move the legend to the bottom
)
```
@fig-hmr2 presents the posterior distribution of the weights $w_{i}$ for each study included in the HMR. These posteriors are summarized using a forest plot, where posterior intervals substantially greater than one indicate outliers. One important aspect of the HMR is that those outliers are automatically down-weighted in the analysis.
```{r}
#| fig-cap: Posterior distribution of the study weights, illustrated by the median and 95% credible intervals. Studies with posterior weights greater than 1.5, marked in red, are flagged as potential outliers.
#| label: fig-hmr2
#| echo: false
#| message: false
#| results: hide
#| fig-width: 6
#| fig-height: 8
w <- mx2$BUGSoutput$sims.list$w
w.s <- apply(w, 2, median)
w.u <- apply(w, 2, quantile, prob = 0.75)
w.l <- apply(w, 2, quantile, prob = 0.25)
n.studies <- length(w.s)
w.col <- ifelse(w.s < 1.5, "grey", "red")
w.col[length(w.s)] <- "black"
study.names = c(as.character(mx2$data$Study), "RWD (Morbach 2012)")
dat.weights = data.frame(x = study.names, y = w.s, ylo = w.l, yhi = w.u)
ggplot(dat.weights, aes(x = x, y = y,
ymin = ylo, ymax = yhi, size = 0.5)) +
geom_pointrange(colour = w.col, lwd = 1, shape = 23, size = 0.3) + coord_flip() +
geom_hline(yintercept = 1, lty = 2) + labs(x = NULL, y = NULL) +
theme_bw() +
scale_y_log10()
```
@fig-hmr3 displays the results of the submodel corresponding to the
IPD-NRS that received only medical routine care. The posteriors of the
regression coefficients $\beta_k$ ($k=1,\dots, 15$) are summarized in a forest plot. This submodel
detects risk factors that can reduce the chance of getting healed. We see that
the group of patients with a Wagner score greater than 2 have substantially less
chance of getting healed compared to the group with lower scores. This can also
be observed in the group of patients with PAD.
Interestingly, these subgroups of patients that have lower chances of getting
healed are underrepresented in the RCTs populations. Therefore, by combining
IPD-NRS with AD-RCT we can learn new insights about these patients that cannot
be learned neither from AD nor from IPD alone.
```{r}
#| fig-cap: Posterior distribution of regression coefficients from the IPD-NRS analysis, illustrated by the mean and 95% credible intervals. The most relevant risk factors identified in this analysis were the Wagner classification (1-2 vs. 3-4-5) and the presence of peripheral arterial disease (PAD) (no vs. yes).
#| label: fig-hmr3
#| echo: FALSE
#| message: FALSE
#| results: hide
#| fig-width: 8
#| fig-height: 7
# Figure: Posterior distribution of the regression coefficients IPD
# Forest plot for the 95% posterior intervals of the regression coefficients
# Variable names
var.names <- names(IPD[-1])
var.names <- c("PAD", "Neuropathy", "First ever lesion",
"No continuous care", "Male sex", "Diabetes type 2",
"Insulin dependent", "History of coronary events",
"History of stroke", "Charcot Foot Syndrome",
"Dialysis",
"Diabetic Neuropathic Osteoarthropathy", "Ever smoker",
"Diabetes duration",
"Wagner score 3-4-5")
# Coefficient names
v <- paste("beta", names(IPD[-1]), sep = ".")
mcmc.x.2 <- as.mcmc.rjags(mx2)
greek.names <- paste(paste("beta[",1:15, sep=""),"]", sep="")
par.names <- paste(paste("beta.IPD[",1:15, sep=""),"]", sep="")
# Extract summary statistics
summary_stats <- summary(mcmc.x.2)
# Create a data frame for plotting
df <- data.frame(
Parameter = greek.names,
VarLabels = var.names,
Mean = summary_stats$statistics[par.names, "Mean"],
Lower = summary_stats$quantiles[par.names, "2.5%"],
Upper = summary_stats$quantiles[par.names, "97.5%"]
)
# Ensure 'Parameter' is treated as a factor in the order of appearance
df$Parameter <- factor(df$Parameter, levels = df$Parameter)
# Generate plot
ggplot(df, aes(x = Mean, y = Parameter, xmin = Lower, xmax = Upper)) +
geom_pointrange(lwd = 1, shape = 23, size = 0.3) +
geom_vline(xintercept = 0, lty = 2, color = "grey") + # Add vertical line
labs(x = NULL, y = NULL) +
theme_minimal() +
scale_y_discrete(labels = parse(text = as.character(df$Parameter))) + # Greek labels
theme(axis.text.y = element_text(size = 7)) +
geom_text(aes(label = VarLabels), vjust = -1.5, size = 3) + # Variable names ab
expand_limits(y = c(NA, length(df$Parameter) + 1)) # Increase ylim to add space above
```
The association between baseline healing risk without amputation within one year and the relative treatment effect is illustrated in @fig-hmr4. Results from the underlying HMR submodel are used to predict treatment effects across different patient subgroups, providing insights into how baseline risk impacts the effectiveness of the treatment. The posterior median and 95\% credible intervals indicate that healthier patients (with a) are associated with a reduced treatment effect. In other words, healthier patients tend to derive less benefit from the adjunctive therapy compared to those with a higher baseline risk.
The model is centered at `r round(summary_stats$statistics["mu.1","Mean"], 3)`, corresponding to the posterior mean of $\mu_1$, the RCTs' baseline risk. To the right of $\mu_1$ we have the posterior mean of the IPD-NRS $\mu_1 +\mu_{\phi}$, which has a posterior mean of `r round(mx2$BUGSoutput$mean$mu.1 + mx2$BUGSoutput$mean$mu.phi, 3)`. This shows an important bias captured by the introduction of $\mu_{\phi}$ in the model.
```{r}
#| fig-cap: "Summary results of generalizing relative treatment effects: The results of the RCTs are presented as a forest plot. The fitted hierarchical meta-regression model is depicted with solid lines representing the posterior median and 95% credible intervals."
#| label: fig-hmr4
#| echo: FALSE
#| warning: FALSE
#| message: FALSE
#| results: hide
#| fig-width: 8
# Function to compute expit
expit <- function(x) {
1 / (1 + exp(-x))
}
a0.f = mx2$BUGSoutput$sims.list$alpha.0
b0.f = mx2$BUGSoutput$sims.list$alpha.1
x = seq(-5, 3, length = 50)
B = length(a0.f)
y.f = rep(0, length(x) * B)
dim(y.f) = c(length(x), B)
y.f2 = rep(0, length(x) * B)
dim(y.f2) = c(length(x), B)
for (i in 1:length(x)) {
y.f[i, ] = a0.f + b0.f * x[i]
}
dat.lines <- data.frame(x.line = x,
median.hat = apply(y.f, 1, median),
upper.hat = apply(y.f, 1, quantile, prob = 0.975),
lower.hat = apply(y.f, 1, quantile, prob = 0.025)) %>%
mutate(prx = 1/(1+exp(-x)))
healingplus <- healing %>% dplyr::select(Study, y_c, n_c) %>%
mutate("Source" = "RCT", cil = NA, ciu = NA) %>%
add_row(data.frame(Study = "Morbach 2012",
y_c = nrow(healingipd %>% filter(healing.without.amp==1)),
n_c = nrow(healingipd),
Source = "RWD")) %>%
mutate(prop = y_c/n_c) %>%
arrange(prop)
for (i in seq(nrow(healingplus))) {
proptest <- prop.test(x = healingplus$y_c[i], n = healingplus$n_c[i], correct=FALSE)
healingplus$cil[i] <- proptest$conf.int[1]
healingplus$ciu[i] <- proptest$conf.int[2]
}
healingplus <- healingplus %>% merge(summary(addat) %>% select("Study", "yi", "ci.lb", "ci.ub"), by = "Study")
mu.phi <- mx2$BUGSoutput$sims.list$mu.phi
mu.1 <- mx2$BUGSoutput$sims.list$mu.1
# Clean breaks for expit values
expit_breaks <- c(0.01, 0.05, 0.10, 0.25, 0.5, 0.75, 0.9, 0.95)
logit_breaks <- qlogis(expit_breaks) # logit transformation
# Calculate the proportion of patients who healed without amputation
prop_healed <- as.numeric(expit(mx2$BUGSoutput$mean$mu.1 + mx2$BUGSoutput$mean$mu.phi)) #nrow(healingipd %>% filter(healing.without.amp == 1)) / nrow(healingipd)
df_rwd <- data.frame(x = prop_healed,
y = mean((a0.f + b0.f * log(prop_healed / (1 - prop_healed)) )),
ylow = quantile((a0.f + b0.f * log(prop_healed / (1 - prop_healed)) ), 0.025),
yhigh = quantile((a0.f + b0.f * log(prop_healed / (1 - prop_healed)) ), 0.975))
df_rct <- data.frame(x = expit(summary_stats$statistics["mu.1","Mean"]),
y = mean((a0.f + b0.f * summary_stats$statistics["mu.1","Mean"] )),
ylow = quantile((a0.f + b0.f * log(prop_healed / (1 - prop_healed)) ), 0.025),
yhigh = quantile((a0.f + b0.f * log(prop_healed / (1 - prop_healed)) ), 0.975))
df_combined <- rbind(
transform(df_rwd, source = "RWD"),
transform(df_rct, source = "RCT")
)
ggplot(dat.lines, aes(x = prx, y = OR)) +
geom_line(aes(x = prx, y = median.hat)) +
geom_line(aes(x = prx, y = upper.hat), lty = 2) +
geom_line(aes(x = prx, y = lower.hat), lty = 2) +
scale_x_continuous(name = "Probability of Healing with Routine Medical Care") +
scale_y_continuous(name = "Log Odds ratio for adjuvant therapy") +
geom_pointrange(data = healingplus, aes(x = prop,
y = yi,
ymin = ci.lb,
ymax = pmin(ci.ub, 6)),
lwd = 0.8, alpha = 0.25, position = position_jitter(width = 0.02)) +
geom_hline(yintercept = 0, linewidth = 0.5, lty = 2, color= "grey") +
geom_pointrange(data = df_combined, aes(x = x, y = y, ymin = ylow, ymax = yhigh, color = source),
lwd = 1.5) + # Combine RWD and RCT estimates
scale_color_manual(name = "Data Source",
values = c("RWD" = "darkorange", "RCT" = "dodgerblue3"), # Assign colors
labels = c("RCT summary", "RWD summary")) + # Assign colors
theme_bw() + theme(legend.position = "top", legend.title = element_blank()) # Place the legend at the top
```
@fig-hmr5 presents the posterior effectiveness contours of $(\theta_{new,0}^l(B), \delta_{new}^l(B))$ for the subgroups of patients not included in the RCTs and with low chances of getting healed. On the left panel we have the resulting contour for patients with PAD (i.e. $l=15$ and $\beta_{15}$) and on the right panel for patients with Wagner score 3 and 4 (i.e. $l=1$ and $\beta_1$).
The horizontal axis displays the uncertainty in the location of the baseline
risk $\theta_{new,0}^l(B)$ of these subgroups. This uncertainty resulted from the
posterior variability of $\mu_1$, $\mu_{\phi}$, $\beta_l$ and the amount of bias
correction $B$. We can see that for both subgroups the posterior effectiveness
$\delta_{new}^l(B)$ is above the horizontal line of no effectiveness for the full range of $\theta_{new,0}^l(B)$. If the clinical context is adequate, then these results indicate that these subgroup of patients may benefit from this new intervention.
```{r}
#| fig-cap: "Posterior contourns (50%, 75% and 95%) for the effectivenes for subgroups identified in the Hierarchical Meta-Regression analysis. Left panel: Subgroup of patients with PDA. Right panel: Subgroup of patients with Wagner score > 2."
#| label: fig-hmr5
#| echo: FALSE
#| warning: FALSE
#| message: FALSE
#| results: hide
#| fig-width: 8
# PDA
p.PDA = effect(mx2,
title.plot = "Subgroup with PDA",
k = 1, # Regression coefficient
x.lim = c(-7, 2.5),
y.lim = c(-.5, 2.5),
y.lab = "Effectiveness",
x.lab = "Baseline risk (logit scale)",
kde2d.n= 30, S = 15000, color.line = "blue",
font.size.title = 8)
# Wanger
p.Wagner = effect(mx2,
title.plot = "Subgroup with Wagner Score > 2",
k = 15, # Regression coefficient
x.lim = c(-7, 2.5),
y.lim = c(-.5, 2.5),
y.lab = "Effectiveness",
x.lab = "Baseline risk (logit scale)",
kde2d.n= 30, S = 15000,
color.line = "red",
display.probability = FALSE,
line.no.effect = 0,
font.size.title = 8)
gridExtra::grid.arrange(p.PDA, p.Wagner, ncol = 2, nrow = 1)
```
## Version info {.unnumbered}
This chapter was rendered using the following version of R and its packages:
```{r}
#| echo: false
#| message: false
#| warning: false
sessionInfo()
```
## References {.unnumbered}