Example: Atrial fibrillation

library(multinma)
options(mc.cores = parallel::detectCores())

This vignette describes the analysis of 26 trials comparing 17 treatments in 4 classes for the prevention of stroke in patients with atrial fibrillation (Cooper et al. 2009). The data are available in this package as atrial_fibrillation:

head(atrial_fibrillation)
#>     studyc studyn                                  trtc trtn      trt_class   r    n    E stroke
#> 1 ACTIVE-W      1 Standard adjusted dose anti-coagulant    3 Anti-coagulant  65 3371 4200   0.15
#> 2 ACTIVE-W      1         Low dose aspirin + copidogrel   16  Anti-platelet 106 3335 4180   0.15
#> 3 AFASAK 1      2                 Placebo/Standard care    1        Control  19  336  398   0.06
#> 4 AFASAK 1      2 Standard adjusted dose anti-coagulant    3 Anti-coagulant   9  335  413   0.06
#> 5 AFASAK 1      2                      Low dose aspirin    5  Anti-platelet  16  336  409   0.06
#> 6 AFASAK 2      3 Standard adjusted dose anti-coagulant    3 Anti-coagulant  11  170  355   0.10
#>   year followup
#> 1 2006      1.3
#> 2 2006      1.3
#> 3 1989      1.2
#> 4 1989      1.2
#> 5 1989      1.2
#> 6 1998      2.2

Cooper et al. (2009) used this data to demonstrate meta-regression models, which we recreate here.

Setting up the network

Whilst we have data on the patient-years at risk in each study (E), we ignore this here to follow the analysis of Cooper et al. (2009), instead analysing the number of patients with stroke (r) out of the total (n) in each arm. We use the function set_agd_arm() to set up the network, making sure to specify the treatment classes trt_class. We remove the WASPO study from the network as both arms had zero events, and this study therefore contributes no information.

af_net <- set_agd_arm(atrial_fibrillation[atrial_fibrillation$studyc != "WASPO", ], 
                      study = studyc,
                      trt = trtc,
                      r = r, 
                      n = n,
                      trt_class = trt_class)
af_net
#> A network with 25 AgD studies (arm-based).
#> 
#> ------------------------------------------------------- AgD studies (arm-based) ---- 
#>  Study         Treatment arms                                                                     
#>  ACTIVE-W      2: Standard adjusted dose anti-coagulant | Low dose aspirin + copidogrel           
#>  AFASAK 1      3: Standard adjusted dose anti-coagulant | Low dose aspirin | Placebo/Standard care
#>  AFASAK 2      4: Standard adjusted dose anti-coagulant | Fixed dose warfarin | Fixed dose warf...
#>  BAATAF        2: Low adjusted dose anti-coagulant | Placebo/Standard care                        
#>  BAFTA         2: Standard adjusted dose anti-coagulant | Low dose aspirin                        
#>  CAFA          2: Standard adjusted dose anti-coagulant | Placebo/Standard care                   
#>  Chinese ATAFS 2: Standard adjusted dose anti-coagulant | Low dose aspirin                        
#>  EAFT          3: Standard adjusted dose anti-coagulant | Medium dose aspirin | Placebo/Standar...
#>  ESPS 2        4: Dipyridamole | Low dose aspirin | Low dose aspirin + dipyridamole | Placebo/S...
#>  JAST          2: Low dose aspirin | Placebo/Standard care                                        
#>  ... plus 15 more studies
#> 
#>  Outcome type: count
#> ------------------------------------------------------------------------------------
#> Total number of treatments: 17, in 4 classes
#> Total number of studies: 25
#> Reference treatment is: Standard adjusted dose anti-coagulant
#> Network is connected

(A better analysis, accounting for differences in the patient-years at risk between studies, can be performed by specifying a rate outcome with r and E in set_agd_arm() above. The following code remains identical.)

Plot the network with the plot() method:

plot(af_net, weight_nodes = TRUE, weight_edges = TRUE, show_trt_class = TRUE) + 
  ggplot2::theme(legend.position = "bottom", legend.box = "vertical")

Meta-analysis models

We fit two (random effects) models:

  1. A standard NMA model without any covariates (model 1 of Cooper et al. (2009));
  2. A meta-regression model adjusting for the proportion of individuals in each study with prior stroke, with shared interaction coefficients by treatment class (model 4b of Cooper et al. (2009)).

NMA with no covariates

We fit a random effects model using the nma() function with trt_effects = "random". We use \(\mathrm{N}(0, 100^2)\) prior distributions for the treatment effects \(d_k\) and study-specific intercepts \(\mu_j\), and a \(\textrm{half-N}(5^2)\) prior for the heterogeneity standard deviation \(\tau\). We can examine the range of parameter values implied by these prior distributions with the summary() method:

summary(normal(scale = 100))
#> A Normal prior distribution: location = 0, scale = 100.
#> 50% of the prior density lies between -67.45 and 67.45.
#> 95% of the prior density lies between -196 and 196.
summary(half_normal(scale = 5))
#> A half-Normal prior distribution: location = 0, scale = 5.
#> 50% of the prior density lies between 0 and 3.37.
#> 95% of the prior density lies between 0 and 9.8.

Fitting the model with the nma() function. We increase the target acceptance rate adapt_delta = 0.99 to minimise divergent transition warnings.

af_fit_1 <- nma(af_net, 
                trt_effects = "random",
                prior_intercept = normal(scale = 100),
                prior_trt = normal(scale = 100),
                prior_het = half_normal(scale = 5),
                adapt_delta = 0.99)
#> Note: Setting "Standard adjusted dose anti-coagulant" as the network reference treatment.

Basic parameter summaries are given by the print() method:

af_fit_1
#> A random effects NMA with a binomial likelihood (logit link).
#> Inference for Stan model: binomial_1par.
#> 4 chains, each with iter=2000; warmup=1000; thin=1; 
#> post-warmup draws per chain=1000, total post-warmup draws=4000.
#> 
#>                                                  mean se_mean   sd     2.5%      25%      50%
#> d[Acenocoumarol]                                -0.79    0.02 0.82    -2.48    -1.31    -0.75
#> d[Alternate day aspirin]                        -1.04    0.03 1.38    -4.22    -1.81    -0.87
#> d[Dipyridamole]                                  0.58    0.01 0.47    -0.36     0.29     0.59
#> d[Fixed dose warfarin]                           0.93    0.01 0.41     0.11     0.66     0.93
#> d[Fixed dose warfarin + low dose aspirin]        0.47    0.01 0.44    -0.40     0.18     0.48
#> d[Fixed dose warfarin + medium dose aspirin]     0.89    0.01 0.32     0.22     0.69     0.91
#> d[High dose aspirin]                             0.50    0.01 0.78    -1.05    -0.01     0.49
#> d[Indobufen]                                     0.25    0.01 0.46    -0.64    -0.04     0.24
#> d[Low adjusted dose anti-coagulant]             -0.30    0.01 0.39    -1.06    -0.56    -0.29
#> d[Low dose aspirin]                              0.61    0.01 0.23     0.16     0.47     0.61
#> d[Low dose aspirin + copidogrel]                 0.51    0.01 0.35    -0.22     0.31     0.52
#> d[Low dose aspirin + dipyridamole]               0.27    0.01 0.49    -0.73    -0.04     0.26
#> d[Medium dose aspirin]                           0.38    0.00 0.20    -0.04     0.26     0.39
#> d[Placebo/Standard care]                         0.75    0.01 0.19     0.37     0.62     0.75
#> d[Triflusal]                                     0.65    0.01 0.61    -0.54     0.25     0.63
#> d[Ximelagatran]                                 -0.08    0.00 0.27    -0.63    -0.24    -0.08
#> lp__                                         -4771.60    0.20 7.16 -4786.63 -4776.35 -4771.23
#> tau                                              0.29    0.01 0.14     0.04     0.20     0.28
#>                                                   75%    97.5% n_eff Rhat
#> d[Acenocoumarol]                                -0.22     0.77  2831 1.00
#> d[Alternate day aspirin]                        -0.11     1.24  2649 1.00
#> d[Dipyridamole]                                  0.89     1.48  2312 1.00
#> d[Fixed dose warfarin]                           1.19     1.73  3407 1.00
#> d[Fixed dose warfarin + low dose aspirin]        0.75     1.32  2316 1.00
#> d[Fixed dose warfarin + medium dose aspirin]     1.11     1.48  3215 1.00
#> d[High dose aspirin]                             1.01     2.01  3559 1.00
#> d[Indobufen]                                     0.54     1.17  3523 1.00
#> d[Low adjusted dose anti-coagulant]             -0.05     0.47  2262 1.00
#> d[Low dose aspirin]                              0.76     1.06  1878 1.00
#> d[Low dose aspirin + copidogrel]                 0.72     1.20  3278 1.00
#> d[Low dose aspirin + dipyridamole]               0.58     1.23  3083 1.00
#> d[Medium dose aspirin]                           0.51     0.75  2420 1.00
#> d[Placebo/Standard care]                         0.88     1.13  1242 1.01
#> d[Triflusal]                                     1.04     1.85  2604 1.00
#> d[Ximelagatran]                                  0.07     0.47  3119 1.00
#> lp__                                         -4766.66 -4758.50  1248 1.00
#> tau                                              0.37     0.58   704 1.00
#> 
#> Samples were drawn using NUTS(diag_e) at Thu Feb 24 09:06:33 2022.
#> For each parameter, n_eff is a crude measure of effective sample size,
#> and Rhat is the potential scale reduction factor on split chains (at 
#> convergence, Rhat=1).

By default, summaries of the study-specific intercepts \(\mu_j\) and study-specific relative effects \(\delta_{jk}\) are hidden, but could be examined by changing the pars argument:

# Not run
print(af_fit_1, pars = c("d", "mu", "delta"))

The prior and posterior distributions can be compared visually using the plot_prior_posterior() function:

plot_prior_posterior(af_fit_1, prior = c("trt", "het"))

We can compute relative effects against placebo/standard care with the relative_effects() function with the trt_ref argument:

(af_1_releff <- relative_effects(af_fit_1, trt_ref = "Placebo/Standard care"))
#>                                               mean   sd  2.5%   25%   50%   75% 97.5% Bulk_ESS
#> d[Standard adjusted dose anti-coagulant]     -0.75 0.19 -1.13 -0.88 -0.75 -0.62 -0.37     1264
#> d[Acenocoumarol]                             -1.54 0.84 -3.26 -2.10 -1.51 -0.96  0.09     2669
#> d[Alternate day aspirin]                     -1.79 1.37 -4.97 -2.53 -1.63 -0.84  0.44     3429
#> d[Dipyridamole]                              -0.17 0.44 -1.05 -0.46 -0.16  0.12  0.68     3822
#> d[Fixed dose warfarin]                        0.17 0.44 -0.71 -0.12  0.17  0.47  1.03     3309
#> d[Fixed dose warfarin + low dose aspirin]    -0.28 0.39 -1.08 -0.53 -0.28 -0.03  0.51     3665
#> d[Fixed dose warfarin + medium dose aspirin]  0.14 0.36 -0.61 -0.09  0.15  0.38  0.83     2741
#> d[High dose aspirin]                         -0.25 0.77 -1.80 -0.75 -0.25  0.26  1.24     4109
#> d[Indobufen]                                 -0.50 0.50 -1.46 -0.82 -0.50 -0.20  0.50     3060
#> d[Low adjusted dose anti-coagulant]          -1.05 0.36 -1.74 -1.29 -1.05 -0.82 -0.34     4084
#> d[Low dose aspirin]                          -0.14 0.21 -0.58 -0.28 -0.14  0.00  0.27     3878
#> d[Low dose aspirin + copidogrel]             -0.24 0.39 -1.05 -0.48 -0.24  0.00  0.58     2581
#> d[Low dose aspirin + dipyridamole]           -0.48 0.46 -1.42 -0.78 -0.48 -0.19  0.44     4514
#> d[Medium dose aspirin]                       -0.37 0.23 -0.84 -0.51 -0.36 -0.22  0.06     2571
#> d[Triflusal]                                 -0.10 0.64 -1.34 -0.53 -0.12  0.32  1.19     2398
#> d[Ximelagatran]                              -0.83 0.34 -1.48 -1.04 -0.84 -0.63 -0.12     2080
#>                                              Tail_ESS Rhat
#> d[Standard adjusted dose anti-coagulant]         1619 1.01
#> d[Acenocoumarol]                                 2785 1.00
#> d[Alternate day aspirin]                         2464 1.00
#> d[Dipyridamole]                                  3084 1.00
#> d[Fixed dose warfarin]                           3039 1.00
#> d[Fixed dose warfarin + low dose aspirin]        2763 1.00
#> d[Fixed dose warfarin + medium dose aspirin]     2686 1.00
#> d[High dose aspirin]                             2800 1.00
#> d[Indobufen]                                     2835 1.00
#> d[Low adjusted dose anti-coagulant]              3028 1.00
#> d[Low dose aspirin]                              2892 1.00
#> d[Low dose aspirin + copidogrel]                 2426 1.00
#> d[Low dose aspirin + dipyridamole]               2945 1.00
#> d[Medium dose aspirin]                           2547 1.00
#> d[Triflusal]                                     2559 1.00
#> d[Ximelagatran]                                  2174 1.00

These estimates can easily be plotted with the plot() method:

plot(af_1_releff, ref_line = 0)

We can also produce treatment rankings, rank probabilities, and cumulative rank probabilities.

(af_1_ranks <- posterior_ranks(af_fit_1))
#>                                                  mean   sd 2.5% 25% 50% 75% 97.5% Bulk_ESS Tail_ESS
#> rank[Standard adjusted dose anti-coagulant]      5.36 1.49 3.00   4   5   6     8     2100     3222
#> rank[Acenocoumarol]                              3.02 3.05 1.00   1   2   3    13     2930     3191
#> rank[Alternate day aspirin]                      3.62 4.19 1.00   1   2   4    16     4812     3776
#> rank[Dipyridamole]                              11.25 3.90 3.00   8  12  15    17     3235       NA
#> rank[Fixed dose warfarin]                       14.06 3.08 6.98  12  15  16    17     3083       NA
#> rank[Fixed dose warfarin + low dose aspirin]    10.12 3.85 3.00   7  10  13    17     3191     2775
#> rank[Fixed dose warfarin + medium dose aspirin] 14.11 2.67 8.00  13  15  16    17     2637       NA
#> rank[High dose aspirin]                         10.16 5.28 1.00   5  10  15    17     3817       NA
#> rank[Indobufen]                                  8.10 3.99 2.00   5   8  11    16     3235     3120
#> rank[Low adjusted dose anti-coagulant]           3.77 2.24 1.00   2   3   5    10     2553     3150
#> rank[Low dose aspirin]                          11.68 2.28 7.00  10  12  13    16     3224     2975
#> rank[Low dose aspirin + copidogrel]             10.59 3.39 4.00   8  11  13    17     2962     2531
#> rank[Low dose aspirin + dipyridamole]            8.23 3.95 2.00   5   8  11    16     3639     2864
#> rank[Medium dose aspirin]                        9.15 2.16 5.00   8   9  11    14     3291     3327
#> rank[Placebo/Standard care]                     13.37 1.83 9.98  12  13  15    17     2910     3279
#> rank[Triflusal]                                 11.47 4.51 3.00   8  12  16    17     2579       NA
#> rank[Ximelagatran]                               4.97 2.37 2.00   3   5   6    11     2307     2430
#>                                                 Rhat
#> rank[Standard adjusted dose anti-coagulant]        1
#> rank[Acenocoumarol]                                1
#> rank[Alternate day aspirin]                        1
#> rank[Dipyridamole]                                 1
#> rank[Fixed dose warfarin]                          1
#> rank[Fixed dose warfarin + low dose aspirin]       1
#> rank[Fixed dose warfarin + medium dose aspirin]    1
#> rank[High dose aspirin]                            1
#> rank[Indobufen]                                    1
#> rank[Low adjusted dose anti-coagulant]             1
#> rank[Low dose aspirin]                             1
#> rank[Low dose aspirin + copidogrel]                1
#> rank[Low dose aspirin + dipyridamole]              1
#> rank[Medium dose aspirin]                          1
#> rank[Placebo/Standard care]                        1
#> rank[Triflusal]                                    1
#> rank[Ximelagatran]                                 1
plot(af_1_ranks)

(af_1_rankprobs <- posterior_rank_probs(af_fit_1))
#>                                              p_rank[1] p_rank[2] p_rank[3] p_rank[4] p_rank[5]
#> d[Standard adjusted dose anti-coagulant]          0.00      0.02      0.07      0.19      0.28
#> d[Acenocoumarol]                                  0.37      0.30      0.10      0.05      0.04
#> d[Alternate day aspirin]                          0.47      0.17      0.07      0.04      0.03
#> d[Dipyridamole]                                   0.00      0.01      0.02      0.03      0.03
#> d[Fixed dose warfarin]                            0.00      0.00      0.00      0.01      0.01
#> d[Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.03      0.04      0.04
#> d[Fixed dose warfarin + medium dose aspirin]      0.00      0.00      0.00      0.00      0.01
#> d[High dose aspirin]                              0.03      0.05      0.07      0.06      0.05
#> d[Indobufen]                                      0.01      0.04      0.07      0.09      0.08
#> d[Low adjusted dose anti-coagulant]               0.08      0.25      0.26      0.14      0.09
#> d[Low dose aspirin]                               0.00      0.00      0.00      0.00      0.00
#> d[Low dose aspirin + copidogrel]                  0.00      0.01      0.01      0.02      0.03
#> d[Low dose aspirin + dipyridamole]                0.01      0.04      0.07      0.08      0.07
#> d[Medium dose aspirin]                            0.00      0.00      0.00      0.01      0.03
#> d[Placebo/Standard care]                          0.00      0.00      0.00      0.00      0.00
#> d[Triflusal]                                      0.00      0.01      0.03      0.04      0.04
#> d[Ximelagatran]                                   0.02      0.09      0.18      0.21      0.17
#>                                              p_rank[6] p_rank[7] p_rank[8] p_rank[9] p_rank[10]
#> d[Standard adjusted dose anti-coagulant]          0.23      0.13      0.05      0.02       0.00
#> d[Acenocoumarol]                                  0.03      0.02      0.02      0.01       0.01
#> d[Alternate day aspirin]                          0.03      0.03      0.02      0.02       0.01
#> d[Dipyridamole]                                   0.04      0.06      0.07      0.07       0.08
#> d[Fixed dose warfarin]                            0.01      0.02      0.02      0.04       0.04
#> d[Fixed dose warfarin + low dose aspirin]         0.07      0.08      0.08      0.09       0.09
#> d[Fixed dose warfarin + medium dose aspirin]      0.01      0.01      0.02      0.03       0.04
#> d[High dose aspirin]                              0.05      0.06      0.05      0.05       0.05
#> d[Indobufen]                                      0.10      0.10      0.09      0.07       0.07
#> d[Low adjusted dose anti-coagulant]               0.07      0.04      0.03      0.02       0.01
#> d[Low dose aspirin]                               0.01      0.02      0.05      0.09       0.12
#> d[Low dose aspirin + copidogrel]                  0.05      0.07      0.09      0.11       0.11
#> d[Low dose aspirin + dipyridamole]                0.09      0.10      0.10      0.08       0.07
#> d[Medium dose aspirin]                            0.06      0.12      0.18      0.18       0.17
#> d[Placebo/Standard care]                          0.00      0.00      0.00      0.02       0.04
#> d[Triflusal]                                      0.05      0.05      0.06      0.06       0.06
#> d[Ximelagatran]                                   0.12      0.08      0.05      0.03       0.02
#>                                              p_rank[11] p_rank[12] p_rank[13] p_rank[14] p_rank[15]
#> d[Standard adjusted dose anti-coagulant]           0.00       0.00       0.00       0.00       0.00
#> d[Acenocoumarol]                                   0.01       0.01       0.01       0.01       0.01
#> d[Alternate day aspirin]                           0.01       0.01       0.01       0.01       0.01
#> d[Dipyridamole]                                    0.08       0.08       0.07       0.09       0.09
#> d[Fixed dose warfarin]                             0.05       0.06       0.07       0.10       0.13
#> d[Fixed dose warfarin + low dose aspirin]          0.08       0.08       0.07       0.07       0.06
#> d[Fixed dose warfarin + medium dose aspirin]       0.06       0.07       0.08       0.12       0.17
#> d[High dose aspirin]                               0.04       0.05       0.04       0.05       0.06
#> d[Indobufen]                                       0.06       0.05       0.05       0.04       0.04
#> d[Low adjusted dose anti-coagulant]                0.01       0.00       0.00       0.00       0.00
#> d[Low dose aspirin]                                0.17       0.16       0.16       0.10       0.07
#> d[Low dose aspirin + copidogrel]                   0.10       0.10       0.09       0.08       0.06
#> d[Low dose aspirin + dipyridamole]                 0.06       0.05       0.04       0.04       0.03
#> d[Medium dose aspirin]                             0.12       0.07       0.04       0.02       0.01
#> d[Placebo/Standard care]                           0.09       0.14       0.21       0.21       0.17
#> d[Triflusal]                                       0.06       0.06       0.06       0.06       0.08
#> d[Ximelagatran]                                    0.01       0.01       0.00       0.00       0.00
#>                                              p_rank[16] p_rank[17]
#> d[Standard adjusted dose anti-coagulant]           0.00       0.00
#> d[Acenocoumarol]                                   0.01       0.00
#> d[Alternate day aspirin]                           0.02       0.02
#> d[Dipyridamole]                                    0.10       0.07
#> d[Fixed dose warfarin]                             0.20       0.25
#> d[Fixed dose warfarin + low dose aspirin]          0.06       0.04
#> d[Fixed dose warfarin + medium dose aspirin]       0.23       0.17
#> d[High dose aspirin]                               0.08       0.17
#> d[Indobufen]                                       0.02       0.02
#> d[Low adjusted dose anti-coagulant]                0.00       0.00
#> d[Low dose aspirin]                                0.03       0.01
#> d[Low dose aspirin + copidogrel]                   0.05       0.03
#> d[Low dose aspirin + dipyridamole]                 0.03       0.02
#> d[Medium dose aspirin]                             0.00       0.00
#> d[Placebo/Standard care]                           0.08       0.03
#> d[Triflusal]                                       0.10       0.17
#> d[Ximelagatran]                                    0.00       0.00
plot(af_1_rankprobs)

(af_1_cumrankprobs <- posterior_rank_probs(af_fit_1, cumulative = TRUE))
#>                                              p_rank[1] p_rank[2] p_rank[3] p_rank[4] p_rank[5]
#> d[Standard adjusted dose anti-coagulant]          0.00      0.02      0.09      0.28      0.56
#> d[Acenocoumarol]                                  0.37      0.67      0.76      0.81      0.86
#> d[Alternate day aspirin]                          0.47      0.65      0.72      0.76      0.79
#> d[Dipyridamole]                                   0.00      0.01      0.03      0.06      0.09
#> d[Fixed dose warfarin]                            0.00      0.00      0.00      0.01      0.02
#> d[Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.04      0.08      0.13
#> d[Fixed dose warfarin + medium dose aspirin]      0.00      0.00      0.00      0.00      0.01
#> d[High dose aspirin]                              0.03      0.08      0.15      0.21      0.26
#> d[Indobufen]                                      0.01      0.06      0.13      0.21      0.29
#> d[Low adjusted dose anti-coagulant]               0.08      0.32      0.59      0.73      0.82
#> d[Low dose aspirin]                               0.00      0.00      0.00      0.00      0.00
#> d[Low dose aspirin + copidogrel]                  0.00      0.01      0.02      0.04      0.07
#> d[Low dose aspirin + dipyridamole]                0.01      0.05      0.12      0.20      0.28
#> d[Medium dose aspirin]                            0.00      0.00      0.00      0.01      0.04
#> d[Placebo/Standard care]                          0.00      0.00      0.00      0.00      0.00
#> d[Triflusal]                                      0.00      0.02      0.05      0.09      0.13
#> d[Ximelagatran]                                   0.02      0.11      0.29      0.50      0.67
#>                                              p_rank[6] p_rank[7] p_rank[8] p_rank[9] p_rank[10]
#> d[Standard adjusted dose anti-coagulant]          0.79      0.92      0.98      0.99       1.00
#> d[Acenocoumarol]                                  0.89      0.91      0.93      0.94       0.95
#> d[Alternate day aspirin]                          0.82      0.85      0.87      0.89       0.90
#> d[Dipyridamole]                                   0.13      0.19      0.26      0.34       0.42
#> d[Fixed dose warfarin]                            0.03      0.04      0.07      0.10       0.15
#> d[Fixed dose warfarin + low dose aspirin]         0.19      0.27      0.36      0.45       0.54
#> d[Fixed dose warfarin + medium dose aspirin]      0.01      0.02      0.05      0.08       0.12
#> d[High dose aspirin]                              0.30      0.36      0.41      0.46       0.51
#> d[Indobufen]                                      0.39      0.49      0.58      0.66       0.73
#> d[Low adjusted dose anti-coagulant]               0.89      0.92      0.95      0.97       0.98
#> d[Low dose aspirin]                               0.01      0.03      0.09      0.17       0.29
#> d[Low dose aspirin + copidogrel]                  0.11      0.19      0.28      0.39       0.50
#> d[Low dose aspirin + dipyridamole]                0.37      0.47      0.57      0.65       0.72
#> d[Medium dose aspirin]                            0.10      0.22      0.39      0.58       0.75
#> d[Placebo/Standard care]                          0.00      0.00      0.01      0.02       0.07
#> d[Triflusal]                                      0.18      0.23      0.29      0.35       0.41
#> d[Ximelagatran]                                   0.79      0.87      0.92      0.95       0.97
#>                                              p_rank[11] p_rank[12] p_rank[13] p_rank[14] p_rank[15]
#> d[Standard adjusted dose anti-coagulant]           1.00       1.00       1.00       1.00       1.00
#> d[Acenocoumarol]                                   0.96       0.97       0.98       0.99       0.99
#> d[Alternate day aspirin]                           0.92       0.92       0.94       0.95       0.96
#> d[Dipyridamole]                                    0.50       0.58       0.65       0.74       0.83
#> d[Fixed dose warfarin]                             0.20       0.26       0.33       0.43       0.56
#> d[Fixed dose warfarin + low dose aspirin]          0.62       0.70       0.77       0.84       0.90
#> d[Fixed dose warfarin + medium dose aspirin]       0.17       0.24       0.32       0.44       0.61
#> d[High dose aspirin]                               0.55       0.60       0.64       0.69       0.75
#> d[Indobufen]                                       0.78       0.83       0.88       0.92       0.95
#> d[Low adjusted dose anti-coagulant]                0.99       1.00       1.00       1.00       1.00
#> d[Low dose aspirin]                                0.46       0.63       0.79       0.89       0.96
#> d[Low dose aspirin + copidogrel]                   0.59       0.69       0.78       0.86       0.92
#> d[Low dose aspirin + dipyridamole]                 0.78       0.83       0.88       0.92       0.95
#> d[Medium dose aspirin]                             0.87       0.94       0.97       0.99       1.00
#> d[Placebo/Standard care]                           0.16       0.30       0.51       0.72       0.89
#> d[Triflusal]                                       0.47       0.53       0.58       0.65       0.73
#> d[Ximelagatran]                                    0.98       0.99       0.99       1.00       1.00
#>                                              p_rank[16] p_rank[17]
#> d[Standard adjusted dose anti-coagulant]           1.00          1
#> d[Acenocoumarol]                                   1.00          1
#> d[Alternate day aspirin]                           0.98          1
#> d[Dipyridamole]                                    0.93          1
#> d[Fixed dose warfarin]                             0.75          1
#> d[Fixed dose warfarin + low dose aspirin]          0.96          1
#> d[Fixed dose warfarin + medium dose aspirin]       0.83          1
#> d[High dose aspirin]                               0.83          1
#> d[Indobufen]                                       0.98          1
#> d[Low adjusted dose anti-coagulant]                1.00          1
#> d[Low dose aspirin]                                0.99          1
#> d[Low dose aspirin + copidogrel]                   0.97          1
#> d[Low dose aspirin + dipyridamole]                 0.98          1
#> d[Medium dose aspirin]                             1.00          1
#> d[Placebo/Standard care]                           0.97          1
#> d[Triflusal]                                       0.83          1
#> d[Ximelagatran]                                    1.00          1
plot(af_1_cumrankprobs)

Network meta-regression adjusting for proportion of prior stroke

We now consider a meta-regression model adjusting for the proportion of individuals in each study with prior stroke, with shared interaction coefficients by treatment class. The regression model is specified in the nma() function using a formula in the regression argument. The formula ~ .trt:stroke means that interactions of prior stroke with treatment will be included; the .trt special variable indicates treatment, and stroke is in the original data set. We specify class_interactions = "common" to denote that the interaction parameters are to be common (i.e. shared) between treatments within each class. (Setting class_interactions = "independent" would fit model 2 of Cooper et al. (2009) with separate interactions for each treatment, data permitting.) We use the same prior distributions as above, but additionally require a prior distribution for the regression coefficients prior_reg; we use a \(\mathrm{N}(0, 100^2)\) prior distribution. The QR decomposition can greatly improve the efficiency of sampling for regression models by decorrelating the sampling space; we specify that this should be used with QR = TRUE, and increase the target acceptance rate adapt_delta = 0.99 to minimise divergent transition warnings.

af_fit_4b <- nma(af_net, 
                 trt_effects = "random",
                 regression = ~ .trt:stroke,
                 class_interactions = "common",
                 QR = TRUE,
                 prior_intercept = normal(scale = 100),
                 prior_trt = normal(scale = 100),
                 prior_reg = normal(scale = 100),
                 prior_het = half_normal(scale = 5),
                 adapt_delta = 0.99)
#> Note: Setting "Standard adjusted dose anti-coagulant" as the network reference treatment.

Basic parameter summaries are given by the print() method:

af_fit_4b
#> A random effects NMA with a binomial likelihood (logit link).
#> Regression model: ~.trt:stroke.
#> Centred covariates at the following overall mean values:
#>    stroke 
#> 0.2957377 
#> Inference for Stan model: binomial_1par.
#> 4 chains, each with iter=2000; warmup=1000; thin=1; 
#> post-warmup draws per chain=1000, total post-warmup draws=4000.
#> 
#>                                                  mean se_mean   sd     2.5%      25%      50%
#> beta[.trtclassControl:stroke]                    0.70    0.01 0.42    -0.15     0.43     0.69
#> beta[.trtclassAnti-platelet:stroke]              0.93    0.01 0.41     0.11     0.68     0.92
#> beta[.trtclassMixed:stroke]                      3.94    0.03 2.12    -0.20     2.50     3.94
#> d[Acenocoumarol]                                 0.37    0.02 1.00    -1.60    -0.30     0.40
#> d[Alternate day aspirin]                        -0.90    0.03 1.37    -4.16    -1.64    -0.72
#> d[Dipyridamole]                                  0.57    0.01 0.40    -0.22     0.32     0.58
#> d[Fixed dose warfarin]                           0.64    0.01 0.38    -0.12     0.38     0.64
#> d[Fixed dose warfarin + low dose aspirin]        1.46    0.01 0.74     0.03     0.98     1.46
#> d[Fixed dose warfarin + medium dose aspirin]     1.00    0.00 0.30     0.39     0.80     0.99
#> d[High dose aspirin]                             0.42    0.01 0.74    -1.04    -0.07     0.43
#> d[Indobufen]                                    -0.40    0.01 0.48    -1.37    -0.71    -0.41
#> d[Low adjusted dose anti-coagulant]             -0.42    0.01 0.37    -1.16    -0.67    -0.42
#> d[Low dose aspirin]                              0.72    0.00 0.20     0.32     0.59     0.72
#> d[Low dose aspirin + copidogrel]                 0.65    0.01 0.28     0.09     0.49     0.65
#> d[Low dose aspirin + dipyridamole]               0.25    0.01 0.44    -0.61    -0.04     0.25
#> d[Medium dose aspirin]                           0.35    0.00 0.18    -0.01     0.24     0.35
#> d[Placebo/Standard care]                         0.79    0.00 0.19     0.43     0.67     0.79
#> d[Triflusal]                                     0.92    0.01 0.58    -0.16     0.52     0.90
#> d[Ximelagatran]                                 -0.07    0.00 0.22    -0.48    -0.20    -0.08
#> lp__                                         -4771.21    0.20 7.07 -4786.27 -4775.75 -4770.95
#> tau                                              0.18    0.01 0.12     0.01     0.09     0.17
#>                                                   75%    97.5% n_eff Rhat
#> beta[.trtclassControl:stroke]                    0.97     1.55  4158    1
#> beta[.trtclassAnti-platelet:stroke]              1.19     1.74  3436    1
#> beta[.trtclassMixed:stroke]                      5.34     8.09  4463    1
#> d[Acenocoumarol]                                 1.03     2.32  4098    1
#> d[Alternate day aspirin]                         0.04     1.28  2654    1
#> d[Dipyridamole]                                  0.83     1.38  5543    1
#> d[Fixed dose warfarin]                           0.89     1.39  4117    1
#> d[Fixed dose warfarin + low dose aspirin]        1.95     2.93  4575    1
#> d[Fixed dose warfarin + medium dose aspirin]     1.19     1.61  4749    1
#> d[High dose aspirin]                             0.91     1.89  5818    1
#> d[Indobufen]                                    -0.09     0.56  4131    1
#> d[Low adjusted dose anti-coagulant]             -0.17     0.31  4345    1
#> d[Low dose aspirin]                              0.85     1.10  4737    1
#> d[Low dose aspirin + copidogrel]                 0.82     1.23  3080    1
#> d[Low dose aspirin + dipyridamole]               0.54     1.10  6410    1
#> d[Medium dose aspirin]                           0.46     0.69  3643    1
#> d[Placebo/Standard care]                         0.91     1.16  4649    1
#> d[Triflusal]                                     1.31     2.10  4880    1
#> d[Ximelagatran]                                  0.05     0.39  2951    1
#> lp__                                         -4766.34 -4758.34  1233    1
#> tau                                              0.26     0.48   429    1
#> 
#> Samples were drawn using NUTS(diag_e) at Thu Feb 24 09:07:08 2022.
#> For each parameter, n_eff is a crude measure of effective sample size,
#> and Rhat is the potential scale reduction factor on split chains (at 
#> convergence, Rhat=1).

The estimated treatment effects d[] shown here correspond to relative effects at the reference level of the covariate, here proportion of prior stroke centered at the network mean value 0.296.

By default, summaries of the study-specific intercepts \(\mu_j\) and study-specific relative effects \(\delta_{jk}\) are hidden, but could be examined by changing the pars argument:

# Not run
print(af_fit_4b, pars = c("d", "mu", "delta"))

The prior and posterior distributions can be compared visually using the plot_prior_posterior() function:

plot_prior_posterior(af_fit_4b, prior = c("reg", "het"))

We can compute relative effects against placebo/standard care with the relative_effects() function with the trt_ref argument, which by default produces relative effects for the observed proportions of prior stroke in each study:

# Not run
(af_4b_releff <- relative_effects(af_fit_4b, trt_ref = "Placebo/Standard care"))
plot(af_4b_releff, ref_line = 0)

We can produce estimated treatment effects for particular covariate values using the newdata argument. For example, treatment effects when no individuals or all individuals have prior stroke are produced by

(af_4b_releff_01 <- relative_effects(af_fit_4b, 
                                     trt_ref = "Placebo/Standard care",
                                     newdata = data.frame(stroke = c(0, 1), 
                                                          label = c("stroke = 0", "stroke = 1")),
                                     study = label))
#> ------------------------------------------------------------- Study: stroke = 0 ---- 
#> 
#> Covariate values:
#>  stroke
#>       0
#> 
#>                                                           mean   sd  2.5%   25%   50%   75% 97.5%
#> d[stroke = 0: Standard adjusted dose anti-coagulant]     -0.58 0.24 -1.05 -0.74 -0.59 -0.43 -0.11
#> d[stroke = 0: Acenocoumarol]                             -1.38 0.83 -3.11 -1.91 -1.35 -0.81  0.16
#> d[stroke = 0: Alternate day aspirin]                     -1.76 1.36 -5.06 -2.52 -1.57 -0.82  0.44
#> d[stroke = 0: Dipyridamole]                              -0.29 0.43 -1.13 -0.57 -0.28 -0.02  0.59
#> d[stroke = 0: Fixed dose warfarin]                        0.05 0.44 -0.81 -0.24  0.05  0.34  0.90
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]    -0.29 0.34 -0.97 -0.51 -0.29 -0.07  0.36
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin] -0.75 0.65 -2.06 -1.18 -0.75 -0.33  0.56
#> d[stroke = 0: High dose aspirin]                         -0.44 0.76 -1.96 -0.95 -0.43  0.04  1.09
#> d[stroke = 0: Indobufen]                                 -1.26 0.58 -2.38 -1.63 -1.27 -0.90 -0.05
#> d[stroke = 0: Low adjusted dose anti-coagulant]          -1.01 0.33 -1.66 -1.23 -1.00 -0.78 -0.36
#> d[stroke = 0: Low dose aspirin]                          -0.14 0.22 -0.58 -0.28 -0.14  0.00  0.29
#> d[stroke = 0: Low dose aspirin + copidogrel]             -0.21 0.36 -0.93 -0.43 -0.21  0.01  0.51
#> d[stroke = 0: Low dose aspirin + dipyridamole]           -0.61 0.46 -1.53 -0.90 -0.60 -0.30  0.29
#> d[stroke = 0: Medium dose aspirin]                       -0.51 0.26 -1.03 -0.68 -0.51 -0.34 -0.02
#> d[stroke = 0: Triflusal]                                  0.06 0.61 -1.08 -0.35  0.04  0.46  1.32
#> d[stroke = 0: Ximelagatran]                              -0.66 0.33 -1.30 -0.87 -0.66 -0.44 -0.03
#>                                                          Bulk_ESS Tail_ESS Rhat
#> d[stroke = 0: Standard adjusted dose anti-coagulant]         4270     2916    1
#> d[stroke = 0: Acenocoumarol]                                 4467     2570    1
#> d[stroke = 0: Alternate day aspirin]                         3324     1966    1
#> d[stroke = 0: Dipyridamole]                                  5248     2778    1
#> d[stroke = 0: Fixed dose warfarin]                           4811     3163    1
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]        4259     2549    1
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]     4607     2884    1
#> d[stroke = 0: High dose aspirin]                             5792     3028    1
#> d[stroke = 0: Indobufen]                                     4439     2334    1
#> d[stroke = 0: Low adjusted dose anti-coagulant]              5086     3216    1
#> d[stroke = 0: Low dose aspirin]                              4186     2558    1
#> d[stroke = 0: Low dose aspirin + copidogrel]                 3761     2265    1
#> d[stroke = 0: Low dose aspirin + dipyridamole]               5465     2728    1
#> d[stroke = 0: Medium dose aspirin]                           4044     2679    1
#> d[stroke = 0: Triflusal]                                     4995     3060    1
#> d[stroke = 0: Ximelagatran]                                  3492     2415    1
#> 
#> ------------------------------------------------------------- Study: stroke = 1 ---- 
#> 
#> Covariate values:
#>  stroke
#>       1
#> 
#>                                                           mean   sd  2.5%   25%   50%   75% 97.5%
#> d[stroke = 1: Standard adjusted dose anti-coagulant]     -1.28 0.33 -1.95 -1.49 -1.28 -1.06 -0.64
#> d[stroke = 1: Acenocoumarol]                              1.87 2.26 -2.58  0.39  1.88  3.34  6.28
#> d[stroke = 1: Alternate day aspirin]                     -1.53 1.38 -4.79 -2.29 -1.36 -0.58  0.70
#> d[stroke = 1: Dipyridamole]                              -0.06 0.39 -0.84 -0.30 -0.06  0.20  0.69
#> d[stroke = 1: Fixed dose warfarin]                       -0.65 0.51 -1.67 -0.98 -0.65 -0.30  0.37
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]     2.96 2.16 -1.22  1.49  2.97  4.36  7.18
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]  2.49 1.62 -0.60  1.40  2.47  3.54  5.70
#> d[stroke = 1: High dose aspirin]                         -0.21 0.72 -1.65 -0.69 -0.20  0.27  1.20
#> d[stroke = 1: Indobufen]                                 -1.03 0.51 -2.02 -1.37 -1.04 -0.70 -0.03
#> d[stroke = 1: Low adjusted dose anti-coagulant]          -1.70 0.50 -2.73 -2.04 -1.70 -1.38 -0.73
#> d[stroke = 1: Low dose aspirin]                           0.09 0.28 -0.47 -0.09  0.09  0.27  0.62
#> d[stroke = 1: Low dose aspirin + copidogrel]              0.02 0.39 -0.77 -0.21  0.02  0.26  0.79
#> d[stroke = 1: Low dose aspirin + dipyridamole]           -0.38 0.41 -1.22 -0.65 -0.37 -0.10  0.42
#> d[stroke = 1: Medium dose aspirin]                       -0.28 0.25 -0.79 -0.44 -0.27 -0.13  0.18
#> d[stroke = 1: Triflusal]                                  0.29 0.64 -0.92 -0.14  0.29  0.72  1.58
#> d[stroke = 1: Ximelagatran]                              -1.35 0.40 -2.15 -1.61 -1.35 -1.09 -0.55
#>                                                          Bulk_ESS Tail_ESS Rhat
#> d[stroke = 1: Standard adjusted dose anti-coagulant]         4607     2676    1
#> d[stroke = 1: Acenocoumarol]                                 4229     2860    1
#> d[stroke = 1: Alternate day aspirin]                         3302     2111    1
#> d[stroke = 1: Dipyridamole]                                  5663     2578    1
#> d[stroke = 1: Fixed dose warfarin]                           4777     3095    1
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]        4577     2928    1
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]     4739     2691    1
#> d[stroke = 1: High dose aspirin]                             5641     2914    1
#> d[stroke = 1: Indobufen]                                     4939     3187    1
#> d[stroke = 1: Low adjusted dose anti-coagulant]              4394     2763    1
#> d[stroke = 1: Low dose aspirin]                              4835     2949    1
#> d[stroke = 1: Low dose aspirin + copidogrel]                 3649     2399    1
#> d[stroke = 1: Low dose aspirin + dipyridamole]               5770     2884    1
#> d[stroke = 1: Medium dose aspirin]                           4549     2282    1
#> d[stroke = 1: Triflusal]                                     4788     2801    1
#> d[stroke = 1: Ximelagatran]                                  4035     2492    1
plot(af_4b_releff_01, ref_line = 0)

The estimated class interactions (against the reference “Mixed” class) are very uncertain.

plot(af_fit_4b, pars = "beta", stat = "halfeye", ref_line = 0)

The interactions are more straightforward to interpret if we transform the interaction coefficients (using the consistency equations) so that they are against the control class:

af_4b_beta <- as.array(af_fit_4b, pars = "beta")

# Subtract beta[Control:stroke] from the other class interactions
af_4b_beta[ , , 2:3] <- sweep(af_4b_beta[ , , 2:3], 1:2, 
                              af_4b_beta[ , , "beta[.trtclassControl:stroke]"], FUN = "-")

# Set beta[Anti-coagulant:stroke] = -beta[Control:stroke]
af_4b_beta[ , , "beta[.trtclassControl:stroke]"] <- -af_4b_beta[ , , "beta[.trtclassControl:stroke]"]
names(af_4b_beta)[1] <- "beta[.trtclassAnti-coagulant:stroke]"

# Summarise
summary(af_4b_beta)
#>                                       mean   sd  2.5%   25%   50%   75% 97.5% Bulk_ESS Tail_ESS
#> beta[.trtclassAnti-coagulant:stroke] -0.70 0.42 -1.55 -0.97 -0.69 -0.43  0.15     4210     3025
#> beta[.trtclassAnti-platelet:stroke]   0.23 0.34 -0.44  0.01  0.24  0.45  0.86     4465     2391
#> beta[.trtclassMixed:stroke]           3.24 2.15 -0.96  1.81  3.25  4.65  7.41     4623     2777
#>                                      Rhat
#> beta[.trtclassAnti-coagulant:stroke]    1
#> beta[.trtclassAnti-platelet:stroke]     1
#> beta[.trtclassMixed:stroke]             1
plot(summary(af_4b_beta), stat = "halfeye", ref_line = 0)

There is some evidence that the effect of anti-coagulants increases (compared to control) with prior stroke. There is little evidence the effect of anti-platelets reduces with prior stroke, although the point estimate represents a substantial reduction in effectiveness, and the 95% Credible Interval includes values that correspond to substantial increases in treatment effect. The interaction effect of stroke on mixed treatments is very uncertain, but potentially indicates a substantial reduction in treatment effects with prior stroke.

We can also produce treatment rankings, rank probabilities, and cumulative rank probabilities. By default (without the newdata argument specified), these are produced at the value of stroke for each study in the network in turn. To instead produce rankings for when no individuals or all individuals have prior stroke, we specify the newdata argument.

(af_4b_ranks <- posterior_ranks(af_fit_4b,
                                newdata = data.frame(stroke = c(0, 1), 
                                                     label = c("stroke = 0", "stroke = 1")), 
                                study = label))
#> ------------------------------------------------------------- Study: stroke = 0 ---- 
#> 
#> Covariate values:
#>  stroke
#>       0
#> 
#>                                                              mean   sd 2.5% 25% 50% 75% 97.5%
#> rank[stroke = 0: Standard adjusted dose anti-coagulant]      7.71 1.91    4   6   8   9    12
#> rank[stroke = 0: Acenocoumarol]                              3.98 3.68    1   1   3   5    15
#> rank[stroke = 0: Alternate day aspirin]                      4.01 4.46    1   1   2   5    17
#> rank[stroke = 0: Dipyridamole]                              11.09 3.66    4   8  11  14    17
#> rank[stroke = 0: Fixed dose warfarin]                       14.09 2.94    6  12  15  16    17
#> rank[stroke = 0: Fixed dose warfarin + low dose aspirin]    11.07 3.65    4   8  11  14    17
#> rank[stroke = 0: Fixed dose warfarin + medium dose aspirin]  7.09 4.52    1   3   6  10    17
#> rank[stroke = 0: High dose aspirin]                          9.57 5.26    1   5  10  15    17
#> rank[stroke = 0: Indobufen]                                  3.65 2.81    1   2   3   4    12
#> rank[stroke = 0: Low adjusted dose anti-coagulant]           4.52 2.40    1   3   4   6    11
#> rank[stroke = 0: Low dose aspirin]                          12.92 1.95    9  12  13  14    16
#> rank[stroke = 0: Low dose aspirin + copidogrel]             12.03 2.94    5  10  12  14    17
#> rank[stroke = 0: Low dose aspirin + dipyridamole]            7.86 3.70    2   5   7  11    16
#> rank[stroke = 0: Medium dose aspirin]                        8.58 2.18    5   7   9  10    13
#> rank[stroke = 0: Placebo/Standard care]                     14.32 1.88   10  13  15  16    17
#> rank[stroke = 0: Triflusal]                                 13.47 3.89    4  11  15  17    17
#> rank[stroke = 0: Ximelagatran]                               7.04 2.68    3   5   7   9    13
#>                                                             Bulk_ESS Tail_ESS Rhat
#> rank[stroke = 0: Standard adjusted dose anti-coagulant]         4059     3552    1
#> rank[stroke = 0: Acenocoumarol]                                 4258     3252    1
#> rank[stroke = 0: Alternate day aspirin]                         4503     3239    1
#> rank[stroke = 0: Dipyridamole]                                  4673       NA    1
#> rank[stroke = 0: Fixed dose warfarin]                           4080       NA    1
#> rank[stroke = 0: Fixed dose warfarin + low dose aspirin]        4399     2787    1
#> rank[stroke = 0: Fixed dose warfarin + medium dose aspirin]     4002     2969    1
#> rank[stroke = 0: High dose aspirin]                             5785       NA    1
#> rank[stroke = 0: Indobufen]                                     3684     2277    1
#> rank[stroke = 0: Low adjusted dose anti-coagulant]              4038     3235    1
#> rank[stroke = 0: Low dose aspirin]                              3714     3621    1
#> rank[stroke = 0: Low dose aspirin + copidogrel]                 3263     2541    1
#> rank[stroke = 0: Low dose aspirin + dipyridamole]               5319     3057    1
#> rank[stroke = 0: Medium dose aspirin]                           4847     2822    1
#> rank[stroke = 0: Placebo/Standard care]                         3304       NA    1
#> rank[stroke = 0: Triflusal]                                     4808       NA    1
#> rank[stroke = 0: Ximelagatran]                                  3042     2909    1
#> 
#> ------------------------------------------------------------- Study: stroke = 1 ---- 
#> 
#> Covariate values:
#>  stroke
#>       1
#> 
#>                                                              mean   sd 2.5% 25% 50% 75% 97.5%
#> rank[stroke = 1: Standard adjusted dose anti-coagulant]      3.64 1.13    2   3   4   4     6
#> rank[stroke = 1: Acenocoumarol]                             13.28 4.34    1  14  15  16    17
#> rank[stroke = 1: Alternate day aspirin]                      4.47 3.99    1   1   3   6    14
#> rank[stroke = 1: Dipyridamole]                              10.53 2.73    5   9  11  13    15
#> rank[stroke = 1: Fixed dose warfarin]                        7.05 2.72    3   5   6   8    14
#> rank[stroke = 1: Fixed dose warfarin + low dose aspirin]    15.84 2.88    5  16  17  17    17
#> rank[stroke = 1: Fixed dose warfarin + medium dose aspirin] 15.43 1.94    8  15  16  16    17
#> rank[stroke = 1: High dose aspirin]                          9.40 3.97    2   6   9  13    16
#> rank[stroke = 1: Indobufen]                                  4.98 2.21    1   4   5   6    10
#> rank[stroke = 1: Low adjusted dose anti-coagulant]           2.04 1.32    1   1   2   2     5
#> rank[stroke = 1: Low dose aspirin]                          11.90 1.78    8  11  12  13    15
#> rank[stroke = 1: Low dose aspirin + copidogrel]             11.14 2.41    6   9  11  13    15
#> rank[stroke = 1: Low dose aspirin + dipyridamole]            8.19 2.65    3   6   8  10    14
#> rank[stroke = 1: Medium dose aspirin]                        8.60 1.70    6   7   8  10    12
#> rank[stroke = 1: Placebo/Standard care]                     11.16 1.90    7  10  11  12    15
#> rank[stroke = 1: Triflusal]                                 12.18 3.02    5  10  13  14    17
#> rank[stroke = 1: Ximelagatran]                               3.19 1.46    1   2   3   4     6
#>                                                             Bulk_ESS Tail_ESS Rhat
#> rank[stroke = 1: Standard adjusted dose anti-coagulant]         3145     2407    1
#> rank[stroke = 1: Acenocoumarol]                                 3877       NA    1
#> rank[stroke = 1: Alternate day aspirin]                         4551     3054    1
#> rank[stroke = 1: Dipyridamole]                                  4822     2777    1
#> rank[stroke = 1: Fixed dose warfarin]                           3913     3068    1
#> rank[stroke = 1: Fixed dose warfarin + low dose aspirin]        3822       NA    1
#> rank[stroke = 1: Fixed dose warfarin + medium dose aspirin]     3156       NA    1
#> rank[stroke = 1: High dose aspirin]                             5301     2933    1
#> rank[stroke = 1: Indobufen]                                     3961     2217    1
#> rank[stroke = 1: Low adjusted dose anti-coagulant]              3348     3413    1
#> rank[stroke = 1: Low dose aspirin]                              3778     3582    1
#> rank[stroke = 1: Low dose aspirin + copidogrel]                 3579     2801    1
#> rank[stroke = 1: Low dose aspirin + dipyridamole]               5517     3013    1
#> rank[stroke = 1: Medium dose aspirin]                           4263     3705    1
#> rank[stroke = 1: Placebo/Standard care]                         4322     3060    1
#> rank[stroke = 1: Triflusal]                                     4124       NA    1
#> rank[stroke = 1: Ximelagatran]                                  2674     2247    1
plot(af_4b_ranks)

(af_4b_rankprobs <- posterior_rank_probs(af_fit_4b,
                                         newdata = data.frame(stroke = c(0, 1), 
                                                              label = c("stroke = 0", "stroke = 1")), 
                                         study = label))
#> ------------------------------------------------------------- Study: stroke = 0 ---- 
#> 
#> Covariate values:
#>  stroke
#>       0
#> 
#>                                                          p_rank[1] p_rank[2] p_rank[3] p_rank[4]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.00      0.00      0.01      0.03
#> d[stroke = 0: Acenocoumarol]                                  0.26      0.24      0.14      0.08
#> d[stroke = 0: Alternate day aspirin]                          0.44      0.14      0.09      0.06
#> d[stroke = 0: Dipyridamole]                                   0.00      0.00      0.01      0.03
#> d[stroke = 0: Fixed dose warfarin]                            0.00      0.00      0.00      0.00
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.01      0.03
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.05      0.10      0.12      0.11
#> d[stroke = 0: High dose aspirin]                              0.03      0.06      0.07      0.08
#> d[stroke = 0: Indobufen]                                      0.17      0.26      0.20      0.13
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.04      0.14      0.21      0.21
#> d[stroke = 0: Low dose aspirin]                               0.00      0.00      0.00      0.00
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.00      0.00      0.00      0.01
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.01      0.03      0.06      0.10
#> d[stroke = 0: Medium dose aspirin]                            0.00      0.00      0.01      0.02
#> d[stroke = 0: Placebo/Standard care]                          0.00      0.00      0.00      0.00
#> d[stroke = 0: Triflusal]                                      0.00      0.00      0.01      0.02
#> d[stroke = 0: Ximelagatran]                                   0.00      0.02      0.05      0.10
#>                                                          p_rank[5] p_rank[6] p_rank[7] p_rank[8]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.08      0.15      0.20      0.19
#> d[stroke = 0: Acenocoumarol]                                  0.06      0.04      0.03      0.02
#> d[stroke = 0: Alternate day aspirin]                          0.04      0.03      0.02      0.02
#> d[stroke = 0: Dipyridamole]                                   0.04      0.05      0.06      0.07
#> d[stroke = 0: Fixed dose warfarin]                            0.01      0.01      0.01      0.02
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.04      0.05      0.05      0.07
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.10      0.08      0.06      0.05
#> d[stroke = 0: High dose aspirin]                              0.07      0.05      0.05      0.04
#> d[stroke = 0: Indobufen]                                      0.07      0.05      0.03      0.02
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.14      0.09      0.06      0.04
#> d[stroke = 0: Low dose aspirin]                               0.00      0.00      0.00      0.01
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.01      0.02      0.03      0.04
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.11      0.10      0.09      0.08
#> d[stroke = 0: Medium dose aspirin]                            0.06      0.09      0.13      0.18
#> d[stroke = 0: Placebo/Standard care]                          0.00      0.00      0.00      0.00
#> d[stroke = 0: Triflusal]                                      0.02      0.03      0.03      0.03
#> d[stroke = 0: Ximelagatran]                                   0.15      0.16      0.14      0.11
#>                                                          p_rank[9] p_rank[10] p_rank[11] p_rank[12]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.16       0.10       0.05       0.02
#> d[stroke = 0: Acenocoumarol]                                  0.02       0.02       0.02       0.02
#> d[stroke = 0: Alternate day aspirin]                          0.02       0.02       0.02       0.01
#> d[stroke = 0: Dipyridamole]                                   0.07       0.09       0.11       0.10
#> d[stroke = 0: Fixed dose warfarin]                            0.03       0.04       0.05       0.07
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.07       0.09       0.09       0.10
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.05       0.05       0.05       0.04
#> d[stroke = 0: High dose aspirin]                              0.04       0.04       0.05       0.05
#> d[stroke = 0: Indobufen]                                      0.02       0.01       0.01       0.01
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.03       0.02       0.01       0.01
#> d[stroke = 0: Low dose aspirin]                               0.03       0.06       0.11       0.17
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.07       0.10       0.12       0.13
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.08       0.08       0.06       0.06
#> d[stroke = 0: Medium dose aspirin]                            0.18       0.15       0.10       0.05
#> d[stroke = 0: Placebo/Standard care]                          0.01       0.02       0.04       0.08
#> d[stroke = 0: Triflusal]                                      0.03       0.04       0.06       0.06
#> d[stroke = 0: Ximelagatran]                                   0.09       0.07       0.05       0.03
#>                                                          p_rank[13] p_rank[14] p_rank[15]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]           0.01       0.00       0.00
#> d[stroke = 0: Acenocoumarol]                                   0.01       0.01       0.01
#> d[stroke = 0: Alternate day aspirin]                           0.01       0.02       0.01
#> d[stroke = 0: Dipyridamole]                                    0.09       0.09       0.08
#> d[stroke = 0: Fixed dose warfarin]                             0.07       0.10       0.14
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]          0.09       0.10       0.09
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]       0.04       0.03       0.04
#> d[stroke = 0: High dose aspirin]                               0.05       0.05       0.05
#> d[stroke = 0: Indobufen]                                       0.01       0.00       0.00
#> d[stroke = 0: Low adjusted dose anti-coagulant]                0.01       0.00       0.00
#> d[stroke = 0: Low dose aspirin]                                0.20       0.19       0.14
#> d[stroke = 0: Low dose aspirin + copidogrel]                   0.13       0.11       0.11
#> d[stroke = 0: Low dose aspirin + dipyridamole]                 0.05       0.03       0.02
#> d[stroke = 0: Medium dose aspirin]                             0.02       0.01       0.00
#> d[stroke = 0: Placebo/Standard care]                           0.13       0.19       0.22
#> d[stroke = 0: Triflusal]                                       0.06       0.07       0.09
#> d[stroke = 0: Ximelagatran]                                    0.02       0.01       0.00
#>                                                          p_rank[16] p_rank[17]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]           0.00       0.00
#> d[stroke = 0: Acenocoumarol]                                   0.02       0.00
#> d[stroke = 0: Alternate day aspirin]                           0.02       0.03
#> d[stroke = 0: Dipyridamole]                                    0.07       0.06
#> d[stroke = 0: Fixed dose warfarin]                             0.21       0.22
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]          0.06       0.05
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]       0.03       0.03
#> d[stroke = 0: High dose aspirin]                               0.07       0.14
#> d[stroke = 0: Indobufen]                                       0.00       0.00
#> d[stroke = 0: Low adjusted dose anti-coagulant]                0.00       0.00
#> d[stroke = 0: Low dose aspirin]                                0.06       0.02
#> d[stroke = 0: Low dose aspirin + copidogrel]                   0.08       0.04
#> d[stroke = 0: Low dose aspirin + dipyridamole]                 0.02       0.01
#> d[stroke = 0: Medium dose aspirin]                             0.00       0.00
#> d[stroke = 0: Placebo/Standard care]                           0.21       0.10
#> d[stroke = 0: Triflusal]                                       0.14       0.32
#> d[stroke = 0: Ximelagatran]                                    0.00       0.00
#> 
#> ------------------------------------------------------------- Study: stroke = 1 ---- 
#> 
#> Covariate values:
#>  stroke
#>       1
#> 
#>                                                          p_rank[1] p_rank[2] p_rank[3] p_rank[4]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]          0.01      0.13      0.34      0.33
#> d[stroke = 1: Acenocoumarol]                                  0.04      0.02      0.01      0.01
#> d[stroke = 1: Alternate day aspirin]                          0.37      0.10      0.05      0.06
#> d[stroke = 1: Dipyridamole]                                   0.00      0.00      0.00      0.01
#> d[stroke = 1: Fixed dose warfarin]                            0.01      0.01      0.03      0.07
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.01      0.00
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]      0.00      0.00      0.00      0.00
#> d[stroke = 1: High dose aspirin]                              0.02      0.03      0.02      0.03
#> d[stroke = 1: Indobufen]                                      0.04      0.09      0.11      0.17
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.44      0.32      0.11      0.07
#> d[stroke = 1: Low dose aspirin]                               0.00      0.00      0.00      0.00
#> d[stroke = 1: Low dose aspirin + copidogrel]                  0.00      0.00      0.00      0.00
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.00      0.01      0.02      0.03
#> d[stroke = 1: Medium dose aspirin]                            0.00      0.00      0.00      0.00
#> d[stroke = 1: Placebo/Standard care]                          0.00      0.00      0.00      0.00
#> d[stroke = 1: Triflusal]                                      0.00      0.00      0.00      0.01
#> d[stroke = 1: Ximelagatran]                                   0.07      0.27      0.30      0.20
#>                                                          p_rank[5] p_rank[6] p_rank[7] p_rank[8]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]          0.14      0.03      0.01      0.00
#> d[stroke = 1: Acenocoumarol]                                  0.02      0.02      0.02      0.02
#> d[stroke = 1: Alternate day aspirin]                          0.09      0.09      0.05      0.04
#> d[stroke = 1: Dipyridamole]                                   0.02      0.04      0.08      0.10
#> d[stroke = 1: Fixed dose warfarin]                            0.16      0.25      0.15      0.10
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.01      0.01
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]      0.00      0.00      0.01      0.01
#> d[stroke = 1: High dose aspirin]                              0.06      0.10      0.11      0.08
#> d[stroke = 1: Indobufen]                                      0.25      0.17      0.07      0.04
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.04      0.01      0.00      0.00
#> d[stroke = 1: Low dose aspirin]                               0.00      0.00      0.01      0.02
#> d[stroke = 1: Low dose aspirin + copidogrel]                  0.01      0.02      0.05      0.07
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.07      0.13      0.18      0.15
#> d[stroke = 1: Medium dose aspirin]                            0.01      0.06      0.18      0.25
#> d[stroke = 1: Placebo/Standard care]                          0.00      0.00      0.02      0.05
#> d[stroke = 1: Triflusal]                                      0.02      0.03      0.04      0.05
#> d[stroke = 1: Ximelagatran]                                   0.09      0.04      0.01      0.00
#>                                                          p_rank[9] p_rank[10] p_rank[11] p_rank[12]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]          0.00       0.00       0.00       0.00
#> d[stroke = 1: Acenocoumarol]                                  0.02       0.01       0.01       0.02
#> d[stroke = 1: Alternate day aspirin]                          0.03       0.02       0.02       0.02
#> d[stroke = 1: Dipyridamole]                                   0.12       0.12       0.12       0.12
#> d[stroke = 1: Fixed dose warfarin]                            0.06       0.04       0.04       0.02
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.01       0.01       0.00       0.01
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]      0.00       0.01       0.01       0.01
#> d[stroke = 1: High dose aspirin]                              0.07       0.06       0.05       0.06
#> d[stroke = 1: Indobufen]                                      0.02       0.02       0.01       0.00
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.00       0.00       0.00       0.00
#> d[stroke = 1: Low dose aspirin]                               0.06       0.11       0.19       0.23
#> d[stroke = 1: Low dose aspirin + copidogrel]                  0.10       0.13       0.13       0.16
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.12       0.09       0.07       0.05
#> d[stroke = 1: Medium dose aspirin]                            0.23       0.13       0.07       0.03
#> d[stroke = 1: Placebo/Standard care]                          0.11       0.18       0.20       0.19
#> d[stroke = 1: Triflusal]                                      0.06       0.07       0.06       0.07
#> d[stroke = 1: Ximelagatran]                                   0.00       0.00       0.00       0.00
#>                                                          p_rank[13] p_rank[14] p_rank[15]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]           0.00       0.00       0.00
#> d[stroke = 1: Acenocoumarol]                                   0.02       0.05       0.44
#> d[stroke = 1: Alternate day aspirin]                           0.02       0.03       0.01
#> d[stroke = 1: Dipyridamole]                                    0.13       0.09       0.03
#> d[stroke = 1: Fixed dose warfarin]                             0.02       0.02       0.01
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]          0.01       0.01       0.05
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]       0.01       0.01       0.27
#> d[stroke = 1: High dose aspirin]                               0.09       0.14       0.04
#> d[stroke = 1: Indobufen]                                       0.00       0.00       0.00
#> d[stroke = 1: Low adjusted dose anti-coagulant]                0.00       0.00       0.00
#> d[stroke = 1: Low dose aspirin]                                0.21       0.12       0.03
#> d[stroke = 1: Low dose aspirin + copidogrel]                   0.17       0.11       0.03
#> d[stroke = 1: Low dose aspirin + dipyridamole]                 0.04       0.02       0.01
#> d[stroke = 1: Medium dose aspirin]                             0.01       0.00       0.00
#> d[stroke = 1: Placebo/Standard care]                           0.14       0.07       0.02
#> d[stroke = 1: Triflusal]                                       0.13       0.32       0.06
#> d[stroke = 1: Ximelagatran]                                    0.00       0.00       0.00
#>                                                          p_rank[16] p_rank[17]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]           0.00       0.00
#> d[stroke = 1: Acenocoumarol]                                   0.20       0.07
#> d[stroke = 1: Alternate day aspirin]                           0.01       0.00
#> d[stroke = 1: Dipyridamole]                                    0.01       0.01
#> d[stroke = 1: Fixed dose warfarin]                             0.00       0.00
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]          0.19       0.66
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]       0.50       0.16
#> d[stroke = 1: High dose aspirin]                               0.02       0.02
#> d[stroke = 1: Indobufen]                                       0.00       0.00
#> d[stroke = 1: Low adjusted dose anti-coagulant]                0.00       0.00
#> d[stroke = 1: Low dose aspirin]                                0.01       0.00
#> d[stroke = 1: Low dose aspirin + copidogrel]                   0.01       0.01
#> d[stroke = 1: Low dose aspirin + dipyridamole]                 0.00       0.00
#> d[stroke = 1: Medium dose aspirin]                             0.00       0.00
#> d[stroke = 1: Placebo/Standard care]                           0.01       0.00
#> d[stroke = 1: Triflusal]                                       0.03       0.05
#> d[stroke = 1: Ximelagatran]                                    0.00       0.00

# Modify the default output with ggplot2 functionality
library(ggplot2)
plot(af_4b_rankprobs) + 
  facet_grid(Treatment~Study, labeller = label_wrap_gen(20)) + 
  theme(strip.text.y = element_text(angle = 0))

(af_4b_cumrankprobs <- posterior_rank_probs(af_fit_4b, cumulative = TRUE,
                                            newdata = data.frame(stroke = c(0, 1), 
                                                                 label = c("stroke = 0", "stroke = 1")), 
                                            study = label))
#> ------------------------------------------------------------- Study: stroke = 0 ---- 
#> 
#> Covariate values:
#>  stroke
#>       0
#> 
#>                                                          p_rank[1] p_rank[2] p_rank[3] p_rank[4]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.00      0.00      0.01      0.04
#> d[stroke = 0: Acenocoumarol]                                  0.26      0.50      0.64      0.72
#> d[stroke = 0: Alternate day aspirin]                          0.44      0.58      0.67      0.73
#> d[stroke = 0: Dipyridamole]                                   0.00      0.00      0.02      0.05
#> d[stroke = 0: Fixed dose warfarin]                            0.00      0.00      0.00      0.01
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.02      0.05
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.05      0.15      0.27      0.38
#> d[stroke = 0: High dose aspirin]                              0.03      0.09      0.16      0.24
#> d[stroke = 0: Indobufen]                                      0.17      0.43      0.63      0.76
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.04      0.18      0.39      0.60
#> d[stroke = 0: Low dose aspirin]                               0.00      0.00      0.00      0.00
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.00      0.00      0.00      0.01
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.01      0.04      0.11      0.21
#> d[stroke = 0: Medium dose aspirin]                            0.00      0.00      0.01      0.02
#> d[stroke = 0: Placebo/Standard care]                          0.00      0.00      0.00      0.00
#> d[stroke = 0: Triflusal]                                      0.00      0.00      0.01      0.03
#> d[stroke = 0: Ximelagatran]                                   0.00      0.02      0.07      0.16
#>                                                          p_rank[5] p_rank[6] p_rank[7] p_rank[8]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.12      0.27      0.48      0.67
#> d[stroke = 0: Acenocoumarol]                                  0.78      0.82      0.84      0.87
#> d[stroke = 0: Alternate day aspirin]                          0.77      0.80      0.82      0.84
#> d[stroke = 0: Dipyridamole]                                   0.09      0.13      0.19      0.25
#> d[stroke = 0: Fixed dose warfarin]                            0.01      0.03      0.04      0.06
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.09      0.13      0.18      0.25
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.47      0.55      0.61      0.66
#> d[stroke = 0: High dose aspirin]                              0.31      0.36      0.41      0.46
#> d[stroke = 0: Indobufen]                                      0.83      0.88      0.91      0.93
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.74      0.83      0.89      0.92
#> d[stroke = 0: Low dose aspirin]                               0.00      0.00      0.01      0.02
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.03      0.04      0.07      0.12
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.32      0.42      0.51      0.59
#> d[stroke = 0: Medium dose aspirin]                            0.08      0.17      0.31      0.48
#> d[stroke = 0: Placebo/Standard care]                          0.00      0.00      0.00      0.01
#> d[stroke = 0: Triflusal]                                      0.05      0.08      0.11      0.14
#> d[stroke = 0: Ximelagatran]                                   0.31      0.48      0.62      0.73
#>                                                          p_rank[9] p_rank[10] p_rank[11] p_rank[12]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.82       0.92       0.97       0.99
#> d[stroke = 0: Acenocoumarol]                                  0.89       0.92       0.93       0.95
#> d[stroke = 0: Alternate day aspirin]                          0.86       0.88       0.90       0.91
#> d[stroke = 0: Dipyridamole]                                   0.32       0.41       0.52       0.61
#> d[stroke = 0: Fixed dose warfarin]                            0.09       0.13       0.18       0.26
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.32       0.41       0.51       0.61
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.71       0.75       0.80       0.83
#> d[stroke = 0: High dose aspirin]                              0.50       0.54       0.59       0.64
#> d[stroke = 0: Indobufen]                                      0.95       0.96       0.97       0.98
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.95       0.97       0.98       0.99
#> d[stroke = 0: Low dose aspirin]                               0.05       0.11       0.22       0.39
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.19       0.29       0.41       0.53
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.67       0.75       0.81       0.87
#> d[stroke = 0: Medium dose aspirin]                            0.66       0.81       0.91       0.96
#> d[stroke = 0: Placebo/Standard care]                          0.02       0.04       0.08       0.16
#> d[stroke = 0: Triflusal]                                      0.18       0.22       0.28       0.34
#> d[stroke = 0: Ximelagatran]                                   0.82       0.89       0.93       0.96
#>                                                          p_rank[13] p_rank[14] p_rank[15]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]           1.00       1.00       1.00
#> d[stroke = 0: Acenocoumarol]                                   0.96       0.97       0.98
#> d[stroke = 0: Alternate day aspirin]                           0.92       0.94       0.95
#> d[stroke = 0: Dipyridamole]                                    0.70       0.80       0.87
#> d[stroke = 0: Fixed dose warfarin]                             0.33       0.43       0.57
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]          0.70       0.80       0.89
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]       0.87       0.90       0.94
#> d[stroke = 0: High dose aspirin]                               0.69       0.74       0.79
#> d[stroke = 0: Indobufen]                                       0.99       0.99       0.99
#> d[stroke = 0: Low adjusted dose anti-coagulant]                1.00       1.00       1.00
#> d[stroke = 0: Low dose aspirin]                                0.59       0.78       0.92
#> d[stroke = 0: Low dose aspirin + copidogrel]                   0.66       0.77       0.88
#> d[stroke = 0: Low dose aspirin + dipyridamole]                 0.92       0.95       0.97
#> d[stroke = 0: Medium dose aspirin]                             0.99       1.00       1.00
#> d[stroke = 0: Placebo/Standard care]                           0.29       0.48       0.70
#> d[stroke = 0: Triflusal]                                       0.40       0.46       0.55
#> d[stroke = 0: Ximelagatran]                                    0.98       0.99       1.00
#>                                                          p_rank[16] p_rank[17]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]           1.00          1
#> d[stroke = 0: Acenocoumarol]                                   1.00          1
#> d[stroke = 0: Alternate day aspirin]                           0.97          1
#> d[stroke = 0: Dipyridamole]                                    0.94          1
#> d[stroke = 0: Fixed dose warfarin]                             0.78          1
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]          0.95          1
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]       0.97          1
#> d[stroke = 0: High dose aspirin]                               0.86          1
#> d[stroke = 0: Indobufen]                                       1.00          1
#> d[stroke = 0: Low adjusted dose anti-coagulant]                1.00          1
#> d[stroke = 0: Low dose aspirin]                                0.98          1
#> d[stroke = 0: Low dose aspirin + copidogrel]                   0.96          1
#> d[stroke = 0: Low dose aspirin + dipyridamole]                 0.99          1
#> d[stroke = 0: Medium dose aspirin]                             1.00          1
#> d[stroke = 0: Placebo/Standard care]                           0.90          1
#> d[stroke = 0: Triflusal]                                       0.68          1
#> d[stroke = 0: Ximelagatran]                                    1.00          1
#> 
#> ------------------------------------------------------------- Study: stroke = 1 ---- 
#> 
#> Covariate values:
#>  stroke
#>       1
#> 
#>                                                          p_rank[1] p_rank[2] p_rank[3] p_rank[4]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]          0.01      0.14      0.48      0.81
#> d[stroke = 1: Acenocoumarol]                                  0.04      0.06      0.08      0.09
#> d[stroke = 1: Alternate day aspirin]                          0.37      0.47      0.52      0.58
#> d[stroke = 1: Dipyridamole]                                   0.00      0.00      0.01      0.01
#> d[stroke = 1: Fixed dose warfarin]                            0.01      0.02      0.04      0.11
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.02      0.02
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]      0.00      0.00      0.00      0.01
#> d[stroke = 1: High dose aspirin]                              0.02      0.05      0.07      0.10
#> d[stroke = 1: Indobufen]                                      0.04      0.13      0.24      0.40
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.44      0.76      0.87      0.94
#> d[stroke = 1: Low dose aspirin]                               0.00      0.00      0.00      0.00
#> d[stroke = 1: Low dose aspirin + copidogrel]                  0.00      0.00      0.00      0.01
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.00      0.01      0.03      0.06
#> d[stroke = 1: Medium dose aspirin]                            0.00      0.00      0.00      0.00
#> d[stroke = 1: Placebo/Standard care]                          0.00      0.00      0.00      0.00
#> d[stroke = 1: Triflusal]                                      0.00      0.00      0.00      0.01
#> d[stroke = 1: Ximelagatran]                                   0.07      0.35      0.65      0.85
#>                                                          p_rank[5] p_rank[6] p_rank[7] p_rank[8]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]          0.95      0.99      1.00      1.00
#> d[stroke = 1: Acenocoumarol]                                  0.10      0.12      0.14      0.16
#> d[stroke = 1: Alternate day aspirin]                          0.67      0.75      0.81      0.84
#> d[stroke = 1: Dipyridamole]                                   0.03      0.07      0.15      0.25
#> d[stroke = 1: Fixed dose warfarin]                            0.28      0.53      0.68      0.78
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.03      0.04      0.04      0.05
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]      0.01      0.01      0.02      0.03
#> d[stroke = 1: High dose aspirin]                              0.17      0.27      0.37      0.45
#> d[stroke = 1: Indobufen]                                      0.65      0.82      0.90      0.94
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.98      0.99      1.00      1.00
#> d[stroke = 1: Low dose aspirin]                               0.00      0.00      0.01      0.03
#> d[stroke = 1: Low dose aspirin + copidogrel]                  0.01      0.03      0.08      0.15
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.13      0.26      0.44      0.60
#> d[stroke = 1: Medium dose aspirin]                            0.02      0.08      0.26      0.51
#> d[stroke = 1: Placebo/Standard care]                          0.00      0.01      0.03      0.08
#> d[stroke = 1: Triflusal]                                      0.03      0.06      0.10      0.15
#> d[stroke = 1: Ximelagatran]                                   0.94      0.98      0.99      0.99
#>                                                          p_rank[9] p_rank[10] p_rank[11] p_rank[12]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]          1.00       1.00       1.00       1.00
#> d[stroke = 1: Acenocoumarol]                                  0.17       0.18       0.20       0.22
#> d[stroke = 1: Alternate day aspirin]                          0.87       0.89       0.91       0.93
#> d[stroke = 1: Dipyridamole]                                   0.36       0.49       0.61       0.73
#> d[stroke = 1: Fixed dose warfarin]                            0.84       0.88       0.92       0.94
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.06       0.07       0.07       0.08
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]      0.03       0.04       0.05       0.05
#> d[stroke = 1: High dose aspirin]                              0.52       0.58       0.64       0.70
#> d[stroke = 1: Indobufen]                                      0.96       0.98       0.99       0.99
#> d[stroke = 1: Low adjusted dose anti-coagulant]               1.00       1.00       1.00       1.00
#> d[stroke = 1: Low dose aspirin]                               0.09       0.20       0.39       0.62
#> d[stroke = 1: Low dose aspirin + copidogrel]                  0.25       0.38       0.51       0.67
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.72       0.80       0.88       0.93
#> d[stroke = 1: Medium dose aspirin]                            0.74       0.87       0.95       0.98
#> d[stroke = 1: Placebo/Standard care]                          0.19       0.37       0.57       0.76
#> d[stroke = 1: Triflusal]                                      0.20       0.27       0.33       0.41
#> d[stroke = 1: Ximelagatran]                                   1.00       1.00       1.00       1.00
#>                                                          p_rank[13] p_rank[14] p_rank[15]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]           1.00       1.00       1.00
#> d[stroke = 1: Acenocoumarol]                                   0.23       0.28       0.72
#> d[stroke = 1: Alternate day aspirin]                           0.95       0.98       0.99
#> d[stroke = 1: Dipyridamole]                                    0.86       0.95       0.98
#> d[stroke = 1: Fixed dose warfarin]                             0.96       0.98       0.99
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]          0.09       0.10       0.15
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]       0.06       0.08       0.35
#> d[stroke = 1: High dose aspirin]                               0.79       0.92       0.96
#> d[stroke = 1: Indobufen]                                       0.99       1.00       1.00
#> d[stroke = 1: Low adjusted dose anti-coagulant]                1.00       1.00       1.00
#> d[stroke = 1: Low dose aspirin]                                0.82       0.95       0.98
#> d[stroke = 1: Low dose aspirin + copidogrel]                   0.84       0.95       0.98
#> d[stroke = 1: Low dose aspirin + dipyridamole]                 0.97       0.99       1.00
#> d[stroke = 1: Medium dose aspirin]                             0.99       1.00       1.00
#> d[stroke = 1: Placebo/Standard care]                           0.90       0.97       0.99
#> d[stroke = 1: Triflusal]                                       0.54       0.86       0.92
#> d[stroke = 1: Ximelagatran]                                    1.00       1.00       1.00
#>                                                          p_rank[16] p_rank[17]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]           1.00          1
#> d[stroke = 1: Acenocoumarol]                                   0.93          1
#> d[stroke = 1: Alternate day aspirin]                           1.00          1
#> d[stroke = 1: Dipyridamole]                                    0.99          1
#> d[stroke = 1: Fixed dose warfarin]                             1.00          1
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]          0.34          1
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]       0.84          1
#> d[stroke = 1: High dose aspirin]                               0.98          1
#> d[stroke = 1: Indobufen]                                       1.00          1
#> d[stroke = 1: Low adjusted dose anti-coagulant]                1.00          1
#> d[stroke = 1: Low dose aspirin]                                1.00          1
#> d[stroke = 1: Low dose aspirin + copidogrel]                   0.99          1
#> d[stroke = 1: Low dose aspirin + dipyridamole]                 1.00          1
#> d[stroke = 1: Medium dose aspirin]                             1.00          1
#> d[stroke = 1: Placebo/Standard care]                           1.00          1
#> d[stroke = 1: Triflusal]                                       0.95          1
#> d[stroke = 1: Ximelagatran]                                    1.00          1

plot(af_4b_cumrankprobs) + 
  facet_grid(Treatment~Study, labeller = label_wrap_gen(20)) + 
  theme(strip.text.y = element_text(angle = 0))

Model fit and comparison

Model fit can be checked using the dic() function:

(af_dic_1 <- dic(af_fit_1))
#> Residual deviance: 60.1 (on 61 data points)
#>                pD: 48.6
#>               DIC: 108.7
(af_dic_4b <- dic(af_fit_4b))
#> Residual deviance: 58.1 (on 61 data points)
#>                pD: 47.9
#>               DIC: 106

Both models fit the data well, having posterior mean residual deviance close to the number of data points. The DIC is slightly lower for the meta-regression model, although only by a couple of points (substantial differences are usually considered 3-5 points). The estimated heterogeneity standard deviation is much lower for the meta-regression model, suggesting that adjusting for the proportion of patients with prior stroke is explaining some of the heterogeneity in the data.

We can also examine the residual deviance contributions with the corresponding plot() method.

plot(af_dic_1)

plot(af_dic_4b)

References

Cooper, N. J., A. J. Sutton, D. Morris, A. E. Ades, and N. J. Welton. 2009. “Addressing Between-Study Heterogeneity and Inconsistency in Mixed Treatment Comparisons: Application to Stroke Prevention Treatments in Individuals with Non-Rheumatic Atrial Fibrillation.” Statistics in Medicine 28 (14): 1861–81. https://doi.org/10.1002/sim.3594.