The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

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.76    0.02 0.81    -2.39    -1.29    -0.74
#> d[Alternate day aspirin]                        -1.01    0.03 1.41    -4.35    -1.79    -0.82
#> d[Dipyridamole]                                  0.58    0.01 0.44    -0.34     0.31     0.59
#> d[Fixed dose warfarin]                           0.92    0.01 0.41     0.13     0.65     0.92
#> d[Fixed dose warfarin + low dose aspirin]        0.47    0.01 0.45    -0.43     0.19     0.47
#> d[Fixed dose warfarin + medium dose aspirin]     0.88    0.01 0.32     0.23     0.67     0.89
#> d[High dose aspirin]                             0.51    0.01 0.76    -1.00     0.00     0.52
#> d[Indobufen]                                     0.24    0.01 0.45    -0.63    -0.05     0.23
#> d[Low adjusted dose anti-coagulant]             -0.30    0.01 0.39    -1.08    -0.54    -0.29
#> d[Low dose aspirin]                              0.61    0.00 0.22     0.18     0.47     0.61
#> d[Low dose aspirin + copidogrel]                 0.53    0.01 0.34    -0.16     0.33     0.52
#> d[Low dose aspirin + dipyridamole]               0.26    0.01 0.47    -0.69    -0.05     0.27
#> d[Medium dose aspirin]                           0.39    0.00 0.19    -0.01     0.26     0.39
#> d[Placebo/Standard care]                         0.75    0.00 0.20     0.35     0.62     0.75
#> d[Triflusal]                                     0.65    0.01 0.61    -0.53     0.24     0.64
#> d[Ximelagatran]                                 -0.08    0.00 0.26    -0.59    -0.25    -0.08
#> lp__                                         -4771.78    0.22 7.23 -4786.34 -4776.57 -4771.42
#> tau                                              0.28    0.00 0.13     0.04     0.19     0.27
#>                                                   75%    97.5% n_eff Rhat
#> d[Acenocoumarol]                                -0.22     0.82  2900    1
#> d[Alternate day aspirin]                        -0.05     1.24  2678    1
#> d[Dipyridamole]                                  0.86     1.43  2560    1
#> d[Fixed dose warfarin]                           1.19     1.71  3542    1
#> d[Fixed dose warfarin + low dose aspirin]        0.75     1.39  2829    1
#> d[Fixed dose warfarin + medium dose aspirin]     1.11     1.51  3536    1
#> d[High dose aspirin]                             1.03     1.95  3910    1
#> d[Indobufen]                                     0.52     1.17  4033    1
#> d[Low adjusted dose anti-coagulant]             -0.04     0.45  2708    1
#> d[Low dose aspirin]                              0.75     1.04  2107    1
#> d[Low dose aspirin + copidogrel]                 0.73     1.22  3841    1
#> d[Low dose aspirin + dipyridamole]               0.58     1.17  2802    1
#> d[Medium dose aspirin]                           0.52     0.75  2616    1
#> d[Placebo/Standard care]                         0.88     1.14  1791    1
#> d[Triflusal]                                     1.04     1.88  2806    1
#> d[Ximelagatran]                                  0.08     0.44  3357    1
#> lp__                                         -4766.76 -4758.66  1066    1
#> tau                                              0.36     0.56   706    1
#> 
#> Samples were drawn using NUTS(diag_e) at Mon Apr 29 16:41:42 2024.
#> 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.20 -1.14 -0.88 -0.75 -0.62 -0.35     1791
#> d[Acenocoumarol]                             -1.51 0.84 -3.18 -2.05 -1.49 -0.96  0.13     2918
#> d[Alternate day aspirin]                     -1.77 1.41 -5.05 -2.53 -1.59 -0.79  0.49     4105
#> d[Dipyridamole]                              -0.17 0.41 -1.01 -0.44 -0.16  0.09  0.65     4101
#> d[Fixed dose warfarin]                        0.17 0.44 -0.70 -0.14  0.17  0.47  1.03     3239
#> d[Fixed dose warfarin + low dose aspirin]    -0.29 0.40 -1.09 -0.54 -0.28 -0.04  0.52     4167
#> d[Fixed dose warfarin + medium dose aspirin]  0.13 0.37 -0.60 -0.10  0.13  0.38  0.86     3015
#> d[High dose aspirin]                         -0.24 0.74 -1.68 -0.75 -0.23  0.26  1.19     4529
#> d[Indobufen]                                 -0.51 0.49 -1.47 -0.83 -0.52 -0.19  0.47     3619
#> d[Low adjusted dose anti-coagulant]          -1.05 0.36 -1.79 -1.29 -1.04 -0.81 -0.36     4891
#> d[Low dose aspirin]                          -0.14 0.21 -0.57 -0.28 -0.14  0.00  0.26     4541
#> d[Low dose aspirin + copidogrel]             -0.22 0.40 -1.01 -0.47 -0.23  0.02  0.61     2721
#> d[Low dose aspirin + dipyridamole]           -0.49 0.45 -1.39 -0.78 -0.49 -0.20  0.39     3818
#> d[Medium dose aspirin]                       -0.37 0.22 -0.82 -0.50 -0.37 -0.22  0.07     2829
#> d[Triflusal]                                 -0.11 0.64 -1.32 -0.53 -0.12  0.31  1.18     2685
#> d[Ximelagatran]                              -0.84 0.33 -1.46 -1.05 -0.83 -0.63 -0.19     2698
#>                                              Tail_ESS Rhat
#> d[Standard adjusted dose anti-coagulant]         2278    1
#> d[Acenocoumarol]                                 2711    1
#> d[Alternate day aspirin]                         1890    1
#> d[Dipyridamole]                                  2886    1
#> d[Fixed dose warfarin]                           3080    1
#> d[Fixed dose warfarin + low dose aspirin]        2465    1
#> d[Fixed dose warfarin + medium dose aspirin]     2459    1
#> d[High dose aspirin]                             3158    1
#> d[Indobufen]                                     2939    1
#> d[Low adjusted dose anti-coagulant]              2928    1
#> d[Low dose aspirin]                              3196    1
#> d[Low dose aspirin + copidogrel]                 2372    1
#> d[Low dose aspirin + dipyridamole]               3128    1
#> d[Medium dose aspirin]                           2923    1
#> d[Triflusal]                                     2520    1
#> d[Ximelagatran]                                  2424    1

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.31 1.45    3   4   5   6     8     2267     2568
#> rank[Acenocoumarol]                              3.10 3.18    1   1   2   3    14     3671     2987
#> rank[Alternate day aspirin]                      3.78 4.33    1   1   2   5    16     4753     3899
#> rank[Dipyridamole]                              11.20 3.78    3   9  11  14    17     3341       NA
#> rank[Fixed dose warfarin]                       14.05 3.04    7  12  15  16    17     3396       NA
#> rank[Fixed dose warfarin + low dose aspirin]    10.03 3.87    3   7  10  13    17     3527     2645
#> rank[Fixed dose warfarin + medium dose aspirin] 14.06 2.71    7  13  15  16    17     2899       NA
#> rank[High dose aspirin]                         10.32 5.30    1   6  11  16    17     4209       NA
#> rank[Indobufen]                                  8.03 3.98    2   5   8  11    16     3806     3015
#> rank[Low adjusted dose anti-coagulant]           3.76 2.24    1   2   3   5    10     3360     2970
#> rank[Low dose aspirin]                          11.70 2.28    7  10  12  13    16     3424     3471
#> rank[Low dose aspirin + copidogrel]             10.70 3.42    4   8  11  13    17     2919     2896
#> rank[Low dose aspirin + dipyridamole]            8.12 3.90    2   5   8  11    16     3476     3203
#> rank[Medium dose aspirin]                        9.14 2.17    5   8   9  11    14     3517     3320
#> rank[Placebo/Standard care]                     13.40 1.82   10  12  14  15    17     3577     3434
#> rank[Triflusal]                                 11.44 4.55    3   8  12  16    17     2593       NA
#> rank[Ximelagatran]                               4.86 2.26    2   3   4   6    10     2944     2300
#>                                                 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.21      0.28
#> d[Acenocoumarol]                                  0.37      0.29      0.10      0.06      0.04
#> d[Alternate day aspirin]                          0.46      0.17      0.07      0.04      0.03
#> d[Dipyridamole]                                   0.00      0.01      0.02      0.02      0.03
#> d[Fixed dose warfarin]                            0.00      0.00      0.00      0.00      0.01
#> d[Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.03      0.04      0.05
#> d[Fixed dose warfarin + medium dose aspirin]      0.00      0.00      0.00      0.00      0.00
#> d[High dose aspirin]                              0.03      0.05      0.07      0.05      0.04
#> d[Indobufen]                                      0.01      0.05      0.07      0.08      0.09
#> d[Low adjusted dose anti-coagulant]               0.09      0.24      0.26      0.15      0.10
#> 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.07      0.09
#> d[Medium dose aspirin]                            0.00      0.00      0.00      0.01      0.02
#> d[Placebo/Standard care]                          0.00      0.00      0.00      0.00      0.00
#> d[Triflusal]                                      0.00      0.02      0.04      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.12      0.05      0.01       0.00
#> d[Acenocoumarol]                                  0.03      0.02      0.02      0.01       0.01
#> d[Alternate day aspirin]                          0.03      0.03      0.03      0.02       0.02
#> d[Dipyridamole]                                   0.04      0.06      0.07      0.08       0.08
#> d[Fixed dose warfarin]                            0.01      0.02      0.02      0.03       0.05
#> d[Fixed dose warfarin + low dose aspirin]         0.07      0.08      0.09      0.10       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.05      0.05      0.04       0.05
#> d[Indobufen]                                      0.09      0.10      0.10      0.07       0.07
#> d[Low adjusted dose anti-coagulant]               0.06      0.05      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.08      0.09      0.10       0.10
#> d[Low dose aspirin + dipyridamole]                0.09      0.10      0.09      0.09       0.07
#> d[Medium dose aspirin]                            0.07      0.12      0.17      0.19       0.17
#> d[Placebo/Standard care]                          0.00      0.00      0.00      0.02       0.04
#> d[Triflusal]                                      0.05      0.06      0.06      0.06       0.06
#> d[Ximelagatran]                                   0.11      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.09       0.09       0.08       0.09       0.09
#> d[Fixed dose warfarin]                             0.05       0.06       0.07       0.09       0.14
#> d[Fixed dose warfarin + low dose aspirin]          0.09       0.07       0.08       0.06       0.06
#> d[Fixed dose warfarin + medium dose aspirin]       0.05       0.07       0.08       0.12       0.17
#> d[High dose aspirin]                               0.04       0.04       0.04       0.06       0.07
#> d[Indobufen]                                       0.05       0.05       0.05       0.04       0.03
#> d[Low adjusted dose anti-coagulant]                0.01       0.00       0.00       0.00       0.00
#> d[Low dose aspirin]                                0.16       0.17       0.16       0.10       0.07
#> d[Low dose aspirin + copidogrel]                   0.11       0.09       0.08       0.08       0.07
#> d[Low dose aspirin + dipyridamole]                 0.06       0.06       0.05       0.03       0.03
#> d[Medium dose aspirin]                             0.11       0.08       0.04       0.02       0.01
#> d[Placebo/Standard care]                           0.08       0.14       0.20       0.22       0.17
#> d[Triflusal]                                       0.06       0.06       0.06       0.06       0.08
#> d[Ximelagatran]                                    0.01       0.00       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.08       0.06
#> d[Fixed dose warfarin]                             0.21       0.24
#> d[Fixed dose warfarin + low dose aspirin]          0.05       0.04
#> d[Fixed dose warfarin + medium dose aspirin]       0.22       0.17
#> d[High dose aspirin]                               0.08       0.17
#> d[Indobufen]                                       0.03       0.02
#> d[Low adjusted dose anti-coagulant]                0.00       0.00
#> d[Low dose aspirin]                                0.04       0.01
#> d[Low dose aspirin + copidogrel]                   0.06       0.04
#> d[Low dose aspirin + dipyridamole]                 0.03       0.02
#> d[Medium dose aspirin]                             0.00       0.00
#> d[Placebo/Standard care]                           0.09       0.03
#> d[Triflusal]                                       0.10       0.18
#> 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.30      0.58
#> d[Acenocoumarol]                                  0.37      0.66      0.76      0.81      0.85
#> d[Alternate day aspirin]                          0.46      0.63      0.71      0.75      0.77
#> d[Dipyridamole]                                   0.00      0.01      0.03      0.05      0.08
#> d[Fixed dose warfarin]                            0.00      0.00      0.00      0.01      0.01
#> d[Fixed dose warfarin + low dose aspirin]         0.00      0.02      0.05      0.09      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.25
#> d[Indobufen]                                      0.01      0.06      0.14      0.22      0.30
#> d[Low adjusted dose anti-coagulant]               0.09      0.32      0.58      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.03      0.06
#> d[Low dose aspirin + dipyridamole]                0.01      0.05      0.13      0.20      0.29
#> 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.12      0.30      0.51      0.68
#>                                              p_rank[6] p_rank[7] p_rank[8] p_rank[9] p_rank[10]
#> d[Standard adjusted dose anti-coagulant]          0.81      0.93      0.98      0.99       1.00
#> d[Acenocoumarol]                                  0.88      0.91      0.93      0.94       0.95
#> d[Alternate day aspirin]                          0.80      0.83      0.86      0.88       0.90
#> d[Dipyridamole]                                   0.13      0.18      0.25      0.33       0.41
#> d[Fixed dose warfarin]                            0.02      0.04      0.07      0.10       0.15
#> d[Fixed dose warfarin + low dose aspirin]         0.20      0.27      0.36      0.46       0.55
#> d[Fixed dose warfarin + medium dose aspirin]      0.01      0.03      0.05      0.08       0.12
#> d[High dose aspirin]                              0.30      0.35      0.40      0.44       0.49
#> d[Indobufen]                                      0.39      0.50      0.59      0.67       0.73
#> d[Low adjusted dose anti-coagulant]               0.88      0.92      0.96      0.97       0.98
#> d[Low dose aspirin]                               0.01      0.04      0.08      0.17       0.29
#> d[Low dose aspirin + copidogrel]                  0.11      0.19      0.28      0.38       0.48
#> d[Low dose aspirin + dipyridamole]                0.38      0.48      0.57      0.66       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.24      0.30      0.36       0.41
#> d[Ximelagatran]                                   0.79      0.88      0.93      0.96       0.98
#>                                              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.96       0.97       0.98       0.99
#> d[Alternate day aspirin]                           0.91       0.92       0.93       0.94       0.96
#> d[Dipyridamole]                                    0.50       0.59       0.67       0.77       0.85
#> d[Fixed dose warfarin]                             0.20       0.26       0.33       0.42       0.56
#> d[Fixed dose warfarin + low dose aspirin]          0.64       0.71       0.78       0.84       0.90
#> d[Fixed dose warfarin + medium dose aspirin]       0.17       0.25       0.32       0.45       0.61
#> d[High dose aspirin]                               0.54       0.58       0.62       0.68       0.75
#> d[Indobufen]                                       0.79       0.83       0.88       0.92       0.95
#> d[Low adjusted dose anti-coagulant]                0.99       0.99       1.00       1.00       1.00
#> d[Low dose aspirin]                                0.46       0.63       0.78       0.88       0.96
#> d[Low dose aspirin + copidogrel]                   0.59       0.68       0.76       0.84       0.91
#> d[Low dose aspirin + dipyridamole]                 0.79       0.84       0.89       0.93       0.96
#> d[Medium dose aspirin]                             0.86       0.94       0.97       0.99       1.00
#> d[Placebo/Standard care]                           0.15       0.29       0.49       0.71       0.88
#> d[Triflusal]                                       0.47       0.53       0.59       0.64       0.73
#> d[Ximelagatran]                                    0.99       0.99       1.00       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.94          1
#> d[Fixed dose warfarin]                             0.76          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.96          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.82          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.
#> Warning: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
#> Running the chains for more iterations may help. See
#> https://mc-stan.org/misc/warnings.html#bulk-ess

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.09     0.42     0.70
#> beta[.trtclassAnti-platelet:stroke]              0.94    0.01 0.40     0.16     0.68     0.94
#> beta[.trtclassMixed:stroke]                      3.91    0.03 2.07    -0.10     2.55     3.89
#> d[Acenocoumarol]                                 0.36    0.01 0.98    -1.56    -0.28     0.35
#> d[Alternate day aspirin]                        -0.92    0.04 1.43    -4.38    -1.64    -0.69
#> d[Dipyridamole]                                  0.57    0.01 0.39    -0.22     0.32     0.57
#> d[Fixed dose warfarin]                           0.64    0.01 0.37    -0.09     0.38     0.64
#> d[Fixed dose warfarin + low dose aspirin]        1.47    0.01 0.72     0.08     0.98     1.46
#> d[Fixed dose warfarin + medium dose aspirin]     1.00    0.00 0.29     0.44     0.80     0.99
#> d[High dose aspirin]                             0.43    0.01 0.74    -0.99    -0.07     0.43
#> d[Indobufen]                                    -0.42    0.01 0.48    -1.40    -0.73    -0.41
#> d[Low adjusted dose anti-coagulant]             -0.43    0.01 0.37    -1.16    -0.67    -0.43
#> d[Low dose aspirin]                              0.72    0.00 0.19     0.35     0.60     0.72
#> d[Low dose aspirin + copidogrel]                 0.65    0.00 0.26     0.13     0.49     0.65
#> d[Low dose aspirin + dipyridamole]               0.25    0.01 0.42    -0.54    -0.03     0.26
#> d[Medium dose aspirin]                           0.35    0.00 0.17     0.02     0.24     0.35
#> d[Placebo/Standard care]                         0.79    0.00 0.19     0.43     0.67     0.79
#> d[Triflusal]                                     0.93    0.01 0.57    -0.16     0.53     0.93
#> d[Ximelagatran]                                 -0.08    0.00 0.20    -0.47    -0.21    -0.09
#> lp__                                         -4771.71    0.19 6.95 -4786.65 -4776.15 -4771.19
#> tau                                              0.16    0.01 0.12     0.01     0.07     0.15
#>                                                   75%    97.5% n_eff Rhat
#> beta[.trtclassControl:stroke]                    0.97     1.55  4684 1.00
#> beta[.trtclassAnti-platelet:stroke]              1.20     1.72  4136 1.00
#> beta[.trtclassMixed:stroke]                      5.23     8.17  5132 1.00
#> d[Acenocoumarol]                                 1.02     2.31  4905 1.00
#> d[Alternate day aspirin]                         0.04     1.24  1627 1.00
#> d[Dipyridamole]                                  0.83     1.34  5773 1.00
#> d[Fixed dose warfarin]                           0.89     1.37  4439 1.00
#> d[Fixed dose warfarin + low dose aspirin]        1.93     2.88  4926 1.00
#> d[Fixed dose warfarin + medium dose aspirin]     1.18     1.57  4908 1.00
#> d[High dose aspirin]                             0.93     1.85  5148 1.00
#> d[Indobufen]                                    -0.10     0.52  4756 1.00
#> d[Low adjusted dose anti-coagulant]             -0.18     0.28  3679 1.00
#> d[Low dose aspirin]                              0.84     1.09  5448 1.00
#> d[Low dose aspirin + copidogrel]                 0.80     1.18  3314 1.00
#> d[Low dose aspirin + dipyridamole]               0.53     1.07  5100 1.00
#> d[Medium dose aspirin]                           0.46     0.67  5005 1.00
#> d[Placebo/Standard care]                         0.92     1.16  4570 1.00
#> d[Triflusal]                                     1.31     2.08  5642 1.00
#> d[Ximelagatran]                                  0.04     0.33  3011 1.00
#> lp__                                         -4766.93 -4759.45  1392 1.00
#> tau                                              0.23     0.43   304 1.03
#> 
#> Samples were drawn using NUTS(diag_e) at Mon Apr 29 16:42:05 2024.
#> 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.59 0.23 -1.04 -0.74 -0.59 -0.42 -0.14
#> d[stroke = 0: Acenocoumarol]                             -1.38 0.81 -3.04 -1.90 -1.34 -0.83  0.12
#> d[stroke = 0: Alternate day aspirin]                     -1.79 1.42 -5.17 -2.49 -1.55 -0.83  0.35
#> d[stroke = 0: Dipyridamole]                              -0.29 0.43 -1.15 -0.57 -0.30 -0.01  0.54
#> d[stroke = 0: Fixed dose warfarin]                        0.05 0.43 -0.77 -0.24  0.05  0.34  0.88
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]    -0.28 0.32 -0.92 -0.49 -0.28 -0.07  0.38
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin] -0.74 0.64 -2.01 -1.18 -0.74 -0.31  0.50
#> d[stroke = 0: High dose aspirin]                         -0.44 0.78 -1.99 -0.95 -0.43  0.09  1.06
#> d[stroke = 0: Indobufen]                                 -1.28 0.57 -2.43 -1.64 -1.28 -0.92 -0.17
#> d[stroke = 0: Low adjusted dose anti-coagulant]          -1.02 0.34 -1.67 -1.23 -1.01 -0.79 -0.35
#> d[stroke = 0: Low dose aspirin]                          -0.14 0.21 -0.58 -0.28 -0.14  0.00  0.27
#> d[stroke = 0: Low dose aspirin + copidogrel]             -0.21 0.33 -0.85 -0.43 -0.21  0.00  0.45
#> d[stroke = 0: Low dose aspirin + dipyridamole]           -0.61 0.45 -1.50 -0.90 -0.62 -0.32  0.28
#> d[stroke = 0: Medium dose aspirin]                       -0.52 0.26 -1.03 -0.69 -0.52 -0.34 -0.01
#> d[stroke = 0: Triflusal]                                  0.07 0.61 -1.10 -0.34  0.06  0.46  1.32
#> d[stroke = 0: Ximelagatran]                              -0.67 0.31 -1.26 -0.87 -0.67 -0.47 -0.06
#>                                                          Bulk_ESS Tail_ESS Rhat
#> d[stroke = 0: Standard adjusted dose anti-coagulant]         4035     2830 1.01
#> d[stroke = 0: Acenocoumarol]                                 4345     2660 1.00
#> d[stroke = 0: Alternate day aspirin]                         2369     1368 1.00
#> d[stroke = 0: Dipyridamole]                                  4888     2792 1.00
#> d[stroke = 0: Fixed dose warfarin]                           4456     2930 1.00
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]        4967     2833 1.00
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]     4568     2832 1.00
#> d[stroke = 0: High dose aspirin]                             5016     3625 1.00
#> d[stroke = 0: Indobufen]                                     4850     2999 1.01
#> d[stroke = 0: Low adjusted dose anti-coagulant]              4401     2899 1.00
#> d[stroke = 0: Low dose aspirin]                              4403     2696 1.00
#> d[stroke = 0: Low dose aspirin + copidogrel]                 3369     2722 1.01
#> d[stroke = 0: Low dose aspirin + dipyridamole]               4996     2982 1.00
#> d[stroke = 0: Medium dose aspirin]                           4794     2545 1.00
#> d[stroke = 0: Triflusal]                                     5491     2946 1.00
#> d[stroke = 0: Ximelagatran]                                  3410     2552 1.00
#> 
#> ------------------------------------------------------------- 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.29 0.34 -1.97 -1.50 -1.28 -1.06 -0.64
#> d[stroke = 1: Acenocoumarol]                              1.83 2.22 -2.52  0.34  1.77  3.29  6.33
#> d[stroke = 1: Alternate day aspirin]                     -1.55 1.45 -5.09 -2.28 -1.33 -0.58  0.67
#> d[stroke = 1: Dipyridamole]                              -0.06 0.37 -0.80 -0.30 -0.05  0.19  0.67
#> d[stroke = 1: Fixed dose warfarin]                       -0.65 0.50 -1.64 -0.99 -0.65 -0.31  0.31
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]     2.93 2.12 -1.16  1.52  2.91  4.28  7.29
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]  2.46 1.59 -0.65  1.44  2.43  3.47  5.70
#> d[stroke = 1: High dose aspirin]                         -0.20 0.73 -1.64 -0.68 -0.19  0.29  1.18
#> d[stroke = 1: Indobufen]                                 -1.04 0.51 -2.05 -1.38 -1.04 -0.71 -0.05
#> d[stroke = 1: Low adjusted dose anti-coagulant]          -1.72 0.52 -2.77 -2.05 -1.71 -1.37 -0.75
#> d[stroke = 1: Low dose aspirin]                           0.09 0.28 -0.49 -0.08  0.10  0.28  0.63
#> d[stroke = 1: Low dose aspirin + copidogrel]              0.03 0.37 -0.72 -0.19  0.03  0.26  0.73
#> d[stroke = 1: Low dose aspirin + dipyridamole]           -0.37 0.40 -1.15 -0.64 -0.37 -0.11  0.39
#> d[stroke = 1: Medium dose aspirin]                       -0.28 0.23 -0.77 -0.42 -0.27 -0.13  0.15
#> d[stroke = 1: Triflusal]                                  0.30 0.63 -0.93 -0.11  0.32  0.72  1.53
#> d[stroke = 1: Ximelagatran]                              -1.37 0.38 -2.15 -1.61 -1.36 -1.12 -0.63
#>                                                          Bulk_ESS Tail_ESS Rhat
#> d[stroke = 1: Standard adjusted dose anti-coagulant]         5887     2765 1.00
#> d[stroke = 1: Acenocoumarol]                                 5304     3046 1.00
#> d[stroke = 1: Alternate day aspirin]                         2360     1425 1.00
#> d[stroke = 1: Dipyridamole]                                  5274     3142 1.00
#> d[stroke = 1: Fixed dose warfarin]                           5021     2698 1.00
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]        5091     3129 1.00
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]     5258     3146 1.00
#> d[stroke = 1: High dose aspirin]                             5221     3275 1.00
#> d[stroke = 1: Indobufen]                                     5436     2960 1.00
#> d[stroke = 1: Low adjusted dose anti-coagulant]              4443     3066 1.00
#> d[stroke = 1: Low dose aspirin]                              5493     2491 1.00
#> d[stroke = 1: Low dose aspirin + copidogrel]                 4150     2063 1.00
#> d[stroke = 1: Low dose aspirin + dipyridamole]               5154     2867 1.00
#> d[stroke = 1: Medium dose aspirin]                           5242     2404 1.01
#> d[stroke = 1: Triflusal]                                     5614     2948 1.00
#> d[stroke = 1: Ximelagatran]                                  5159     2891 1.00
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.70 -0.42  0.09     4797     2930
#> beta[.trtclassAnti-platelet:stroke]   0.24 0.33 -0.42  0.03  0.24  0.45  0.87     5037     2875
#> beta[.trtclassMixed:stroke]           3.21 2.10 -0.81  1.85  3.18  4.57  7.54     5019     3174
#>                                      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.84    4   6   8   9    11
#> rank[stroke = 0: Acenocoumarol]                              3.87 3.52    1   1   3   5    14
#> rank[stroke = 0: Alternate day aspirin]                      4.01 4.41    1   1   2   5    16
#> rank[stroke = 0: Dipyridamole]                              11.07 3.63    4   8  11  14    17
#> rank[stroke = 0: Fixed dose warfarin]                       14.15 2.88    7  13  15  16    17
#> rank[stroke = 0: Fixed dose warfarin + low dose aspirin]    11.13 3.60    4   9  11  14    17
#> rank[stroke = 0: Fixed dose warfarin + medium dose aspirin]  7.13 4.50    1   3   6  10    16
#> rank[stroke = 0: High dose aspirin]                          9.63 5.33    1   5  10  15    17
#> rank[stroke = 0: Indobufen]                                  3.56 2.68    1   2   3   4    11
#> rank[stroke = 0: Low adjusted dose anti-coagulant]           4.49 2.38    1   3   4   5    11
#> rank[stroke = 0: Low dose aspirin]                          12.94 1.87    9  12  13  14    16
#> rank[stroke = 0: Low dose aspirin + copidogrel]             12.08 2.78    6  10  12  14    17
#> rank[stroke = 0: Low dose aspirin + dipyridamole]            7.83 3.68    2   5   7  10    16
#> rank[stroke = 0: Medium dose aspirin]                        8.57 2.09    5   7   9  10    13
#> rank[stroke = 0: Placebo/Standard care]                     14.35 1.88   10  13  15  16    17
#> rank[stroke = 0: Triflusal]                                 13.56 3.90    4  11  15  17    17
#> rank[stroke = 0: Ximelagatran]                               6.92 2.55    3   5   7   9    12
#>                                                             Bulk_ESS Tail_ESS Rhat
#> rank[stroke = 0: Standard adjusted dose anti-coagulant]         4083     3391    1
#> rank[stroke = 0: Acenocoumarol]                                 4554     3221    1
#> rank[stroke = 0: Alternate day aspirin]                         4081     3172    1
#> rank[stroke = 0: Dipyridamole]                                  5013       NA    1
#> rank[stroke = 0: Fixed dose warfarin]                           4138       NA    1
#> rank[stroke = 0: Fixed dose warfarin + low dose aspirin]        4826     2725    1
#> rank[stroke = 0: Fixed dose warfarin + medium dose aspirin]     4454     2890    1
#> rank[stroke = 0: High dose aspirin]                             4785       NA    1
#> rank[stroke = 0: Indobufen]                                     4482     3249    1
#> rank[stroke = 0: Low adjusted dose anti-coagulant]              3581     3428    1
#> rank[stroke = 0: Low dose aspirin]                              4114     3334    1
#> rank[stroke = 0: Low dose aspirin + copidogrel]                 3928     2866    1
#> rank[stroke = 0: Low dose aspirin + dipyridamole]               4855     3235    1
#> rank[stroke = 0: Medium dose aspirin]                           4216     3383    1
#> rank[stroke = 0: Placebo/Standard care]                         3511       NA    1
#> rank[stroke = 0: Triflusal]                                     5526       NA    1
#> rank[stroke = 0: Ximelagatran]                                  3542     3367    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.61 1.09 2.00   3   4   4     6
#> rank[stroke = 1: Acenocoumarol]                             13.25 4.33 1.00  14  15  16    17
#> rank[stroke = 1: Alternate day aspirin]                      4.51 3.98 1.00   1   3   7    14
#> rank[stroke = 1: Dipyridamole]                              10.53 2.63 6.00   9  11  13    15
#> rank[stroke = 1: Fixed dose warfarin]                        7.06 2.69 3.00   5   6   8    14
#> rank[stroke = 1: Fixed dose warfarin + low dose aspirin]    15.84 2.83 6.00  16  17  17    17
#> rank[stroke = 1: Fixed dose warfarin + medium dose aspirin] 15.43 1.88 8.98  15  16  16    17
#> rank[stroke = 1: High dose aspirin]                          9.46 3.96 2.00   6   9  13    16
#> rank[stroke = 1: Indobufen]                                  4.93 2.13 1.00   4   5   6    10
#> rank[stroke = 1: Low adjusted dose anti-coagulant]           1.98 1.27 1.00   1   2   2     5
#> rank[stroke = 1: Low dose aspirin]                          11.91 1.81 8.00  11  12  13    15
#> rank[stroke = 1: Low dose aspirin + copidogrel]             11.18 2.38 6.00  10  11  13    15
#> rank[stroke = 1: Low dose aspirin + dipyridamole]            8.19 2.59 4.00   6   8  10    14
#> rank[stroke = 1: Medium dose aspirin]                        8.58 1.67 6.00   7   8  10    12
#> rank[stroke = 1: Placebo/Standard care]                     11.14 1.91 8.00  10  11  12    15
#> rank[stroke = 1: Triflusal]                                 12.28 3.03 5.00  10  13  14    17
#> rank[stroke = 1: Ximelagatran]                               3.10 1.33 1.00   2   3   4     6
#>                                                             Bulk_ESS Tail_ESS Rhat
#> rank[stroke = 1: Standard adjusted dose anti-coagulant]         2846     3331    1
#> rank[stroke = 1: Acenocoumarol]                                 4573       NA    1
#> rank[stroke = 1: Alternate day aspirin]                         4019     2779    1
#> rank[stroke = 1: Dipyridamole]                                  4392     3168    1
#> rank[stroke = 1: Fixed dose warfarin]                           3628     3410    1
#> rank[stroke = 1: Fixed dose warfarin + low dose aspirin]        3558       NA    1
#> rank[stroke = 1: Fixed dose warfarin + medium dose aspirin]     3035       NA    1
#> rank[stroke = 1: High dose aspirin]                             4822     3203    1
#> rank[stroke = 1: Indobufen]                                     4516     2915    1
#> rank[stroke = 1: Low adjusted dose anti-coagulant]              2597     2531    1
#> rank[stroke = 1: Low dose aspirin]                              4058     3326    1
#> rank[stroke = 1: Low dose aspirin + copidogrel]                 4248     3262    1
#> rank[stroke = 1: Low dose aspirin + dipyridamole]               4378     2658    1
#> rank[stroke = 1: Medium dose aspirin]                           4399     3136    1
#> rank[stroke = 1: Placebo/Standard care]                         4474     3436    1
#> rank[stroke = 1: Triflusal]                                     4996       NA    1
#> rank[stroke = 1: Ximelagatran]                                  3420     3302    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.25      0.24      0.14      0.09
#> d[stroke = 0: Alternate day aspirin]                          0.43      0.15      0.09      0.06
#> d[stroke = 0: Dipyridamole]                                   0.00      0.01      0.01      0.02
#> 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.00      0.01      0.03
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.05      0.09      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.14
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.04      0.13      0.22      0.20
#> 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.00      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.04      0.10
#>                                                          p_rank[5] p_rank[6] p_rank[7] p_rank[8]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.07      0.14      0.21      0.20
#> d[stroke = 0: Acenocoumarol]                                  0.06      0.05      0.02      0.02
#> d[stroke = 0: Alternate day aspirin]                          0.04      0.03      0.02      0.02
#> d[stroke = 0: Dipyridamole]                                   0.03      0.05      0.06      0.06
#> 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.05
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.10      0.07      0.06      0.05
#> d[stroke = 0: High dose aspirin]                              0.07      0.05      0.04      0.05
#> d[stroke = 0: Indobufen]                                      0.07      0.05      0.03      0.02
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.15      0.08      0.05      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.12      0.10      0.09      0.09
#> d[stroke = 0: Medium dose aspirin]                            0.04      0.10      0.14      0.18
#> d[stroke = 0: Placebo/Standard care]                          0.00      0.00      0.00      0.00
#> d[stroke = 0: Triflusal]                                      0.03      0.03      0.03      0.03
#> d[stroke = 0: Ximelagatran]                                   0.16      0.17      0.13      0.11
#>                                                          p_rank[9] p_rank[10] p_rank[11] p_rank[12]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.17       0.10       0.04       0.01
#> d[stroke = 0: Acenocoumarol]                                  0.02       0.02       0.02       0.01
#> d[stroke = 0: Alternate day aspirin]                          0.01       0.02       0.02       0.02
#> d[stroke = 0: Dipyridamole]                                   0.07       0.08       0.10       0.10
#> d[stroke = 0: Fixed dose warfarin]                            0.03       0.04       0.06       0.07
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.08       0.09       0.10       0.10
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.05       0.05       0.04       0.04
#> d[stroke = 0: High dose aspirin]                              0.04       0.05       0.04       0.04
#> 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.02       0.01
#> d[stroke = 0: Low dose aspirin]                               0.03       0.06       0.11       0.18
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.06       0.10       0.13       0.14
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.08       0.07       0.06       0.05
#> d[stroke = 0: Medium dose aspirin]                            0.18       0.16       0.09       0.05
#> d[stroke = 0: Placebo/Standard care]                          0.01       0.02       0.05       0.08
#> d[stroke = 0: Triflusal]                                      0.04       0.04       0.05       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.00       0.00       0.00
#> d[stroke = 0: Acenocoumarol]                                   0.01       0.01       0.01
#> d[stroke = 0: Alternate day aspirin]                           0.02       0.02       0.01
#> d[stroke = 0: Dipyridamole]                                    0.09       0.09       0.08
#> d[stroke = 0: Fixed dose warfarin]                             0.09       0.09       0.14
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]          0.09       0.09       0.09
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]       0.03       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.00       0.00       0.00
#> d[stroke = 0: Low dose aspirin]                                0.21       0.20       0.13
#> d[stroke = 0: Low dose aspirin + copidogrel]                   0.14       0.12       0.11
#> d[stroke = 0: Low dose aspirin + dipyridamole]                 0.04       0.04       0.02
#> d[stroke = 0: Medium dose aspirin]                             0.02       0.01       0.00
#> d[stroke = 0: Placebo/Standard care]                           0.13       0.18       0.22
#> d[stroke = 0: Triflusal]                                       0.06       0.07       0.09
#> d[stroke = 0: Ximelagatran]                                    0.01       0.00       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.01       0.00
#> d[stroke = 0: Alternate day aspirin]                           0.02       0.02
#> d[stroke = 0: Dipyridamole]                                    0.07       0.05
#> d[stroke = 0: Fixed dose warfarin]                             0.20       0.23
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]          0.07       0.05
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]       0.03       0.02
#> d[stroke = 0: High dose aspirin]                               0.08       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.07       0.03
#> 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.15       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.34
#> d[stroke = 1: Acenocoumarol]                                  0.03      0.02      0.01      0.02
#> d[stroke = 1: Alternate day aspirin]                          0.36      0.10      0.05      0.07
#> d[stroke = 1: Dipyridamole]                                   0.00      0.00      0.00      0.00
#> d[stroke = 1: Fixed dose warfarin]                            0.00      0.01      0.02      0.06
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.00      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.03      0.03
#> d[stroke = 1: Indobufen]                                      0.04      0.09      0.10      0.19
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.45      0.33      0.11      0.06
#> 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.01      0.02
#> 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.08      0.27      0.32      0.19
#>                                                          p_rank[5] p_rank[6] p_rank[7] p_rank[8]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]          0.13      0.04      0.01      0.00
#> d[stroke = 1: Acenocoumarol]                                  0.01      0.02      0.02      0.02
#> d[stroke = 1: Alternate day aspirin]                          0.08      0.09      0.05      0.03
#> d[stroke = 1: Dipyridamole]                                   0.01      0.04      0.08      0.11
#> d[stroke = 1: Fixed dose warfarin]                            0.19      0.26      0.15      0.09
#> 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.10      0.08
#> d[stroke = 1: Indobufen]                                      0.26      0.16      0.08      0.03
#> 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.04      0.07
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.07      0.13      0.20      0.15
#> d[stroke = 1: Medium dose aspirin]                            0.01      0.06      0.19      0.26
#> d[stroke = 1: Placebo/Standard care]                          0.00      0.01      0.01      0.05
#> d[stroke = 1: Triflusal]                                      0.02      0.03      0.04      0.05
#> d[stroke = 1: Ximelagatran]                                   0.09      0.03      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.01       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.13       0.13
#> d[stroke = 1: Fixed dose warfarin]                            0.06       0.04       0.03       0.03
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.01       0.01       0.01       0.01
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]      0.01       0.01       0.01       0.01
#> d[stroke = 1: High dose aspirin]                              0.07       0.07       0.06       0.06
#> d[stroke = 1: Indobufen]                                      0.02       0.01       0.01       0.01
#> 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.12       0.17       0.23
#> d[stroke = 1: Low dose aspirin + copidogrel]                  0.10       0.12       0.15       0.17
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.11       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.12       0.19       0.21       0.17
#> d[stroke = 1: Triflusal]                                      0.05       0.05       0.05       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.04       0.46
#> d[stroke = 1: Alternate day aspirin]                           0.03       0.03       0.01
#> d[stroke = 1: Dipyridamole]                                    0.12       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.26
#> d[stroke = 1: High dose aspirin]                               0.10       0.13       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.11       0.04
#> d[stroke = 1: Low dose aspirin + copidogrel]                   0.17       0.10       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.13       0.07       0.02
#> d[stroke = 1: Triflusal]                                       0.13       0.35       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.00       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.18       0.67
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]       0.51       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.02       0.01
#> 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.06
#> 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.25      0.50      0.64      0.73
#> d[stroke = 0: Alternate day aspirin]                          0.43      0.58      0.67      0.73
#> d[stroke = 0: Dipyridamole]                                   0.00      0.01      0.02      0.04
#> 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.04
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.05      0.14      0.26      0.37
#> d[stroke = 0: High dose aspirin]                              0.03      0.10      0.17      0.24
#> d[stroke = 0: Indobufen]                                      0.17      0.43      0.63      0.77
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.04      0.17      0.40      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.01      0.01      0.03
#> d[stroke = 0: Ximelagatran]                                   0.00      0.02      0.06      0.16
#>                                                          p_rank[5] p_rank[6] p_rank[7] p_rank[8]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.11      0.25      0.46      0.67
#> d[stroke = 0: Acenocoumarol]                                  0.79      0.84      0.86      0.88
#> d[stroke = 0: Alternate day aspirin]                          0.77      0.80      0.82      0.84
#> d[stroke = 0: Dipyridamole]                                   0.08      0.13      0.19      0.26
#> d[stroke = 0: Fixed dose warfarin]                            0.01      0.02      0.04      0.05
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.08      0.13      0.18      0.24
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.47      0.54      0.60      0.65
#> d[stroke = 0: High dose aspirin]                              0.31      0.36      0.40      0.45
#> d[stroke = 0: Indobufen]                                      0.84      0.89      0.91      0.94
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.75      0.83      0.89      0.92
#> d[stroke = 0: Low dose aspirin]                               0.00      0.00      0.00      0.01
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.02      0.03      0.06      0.10
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.33      0.42      0.51      0.60
#> d[stroke = 0: Medium dose aspirin]                            0.06      0.17      0.31      0.49
#> 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.33      0.50      0.63      0.74
#>                                                          p_rank[9] p_rank[10] p_rank[11] p_rank[12]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.84       0.94       0.98       0.99
#> d[stroke = 0: Acenocoumarol]                                  0.90       0.92       0.94       0.95
#> d[stroke = 0: Alternate day aspirin]                          0.86       0.88       0.89       0.91
#> d[stroke = 0: Dipyridamole]                                   0.33       0.41       0.51       0.62
#> d[stroke = 0: Fixed dose warfarin]                            0.08       0.12       0.18       0.25
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.31       0.41       0.51       0.61
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.70       0.75       0.80       0.84
#> d[stroke = 0: High dose aspirin]                              0.49       0.54       0.59       0.63
#> d[stroke = 0: Indobufen]                                      0.95       0.97       0.98       0.98
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.95       0.97       0.99       0.99
#> d[stroke = 0: Low dose aspirin]                               0.04       0.10       0.21       0.39
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.17       0.27       0.39       0.53
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.68       0.75       0.82       0.87
#> d[stroke = 0: Medium dose aspirin]                            0.67       0.83       0.92       0.97
#> d[stroke = 0: Placebo/Standard care]                          0.02       0.03       0.08       0.16
#> d[stroke = 0: Triflusal]                                      0.18       0.21       0.26       0.32
#> d[stroke = 0: Ximelagatran]                                   0.83       0.90       0.95       0.98
#>                                                          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.98       0.99
#> d[stroke = 0: Alternate day aspirin]                           0.93       0.95       0.96
#> d[stroke = 0: Dipyridamole]                                    0.71       0.80       0.88
#> d[stroke = 0: Fixed dose warfarin]                             0.33       0.42       0.57
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]          0.70       0.79       0.88
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]       0.87       0.90       0.94
#> d[stroke = 0: High dose aspirin]                               0.68       0.73       0.78
#> d[stroke = 0: Indobufen]                                       0.99       0.99       1.00
#> d[stroke = 0: Low adjusted dose anti-coagulant]                1.00       1.00       1.00
#> d[stroke = 0: Low dose aspirin]                                0.60       0.80       0.92
#> d[stroke = 0: Low dose aspirin + copidogrel]                   0.67       0.79       0.90
#> d[stroke = 0: Low dose aspirin + dipyridamole]                 0.91       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.47       0.69
#> d[stroke = 0: Triflusal]                                       0.38       0.44       0.53
#> d[stroke = 0: Ximelagatran]                                    0.99       1.00       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.98          1
#> d[stroke = 0: Dipyridamole]                                    0.95          1
#> d[stroke = 0: Fixed dose warfarin]                             0.77          1
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]          0.95          1
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]       0.98          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.97          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.82
#> d[stroke = 1: Acenocoumarol]                                  0.03      0.06      0.07      0.09
#> d[stroke = 1: Alternate day aspirin]                          0.36      0.47      0.51      0.58
#> d[stroke = 1: Dipyridamole]                                   0.00      0.00      0.00      0.01
#> d[stroke = 1: Fixed dose warfarin]                            0.00      0.02      0.03      0.09
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.00      0.01      0.01      0.02
#> 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.05      0.07      0.10
#> d[stroke = 1: Indobufen]                                      0.04      0.12      0.22      0.41
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.45      0.78      0.88      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.00
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.00      0.01      0.02      0.05
#> 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.01      0.01
#> d[stroke = 1: Ximelagatran]                                   0.08      0.35      0.67      0.87
#>                                                          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.13      0.14      0.16
#> d[stroke = 1: Alternate day aspirin]                          0.66      0.75      0.80      0.84
#> d[stroke = 1: Dipyridamole]                                   0.02      0.06      0.14      0.25
#> d[stroke = 1: Fixed dose warfarin]                            0.28      0.54      0.69      0.78
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.02      0.03      0.04      0.05
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]      0.00      0.01      0.01      0.03
#> d[stroke = 1: High dose aspirin]                              0.16      0.26      0.36      0.44
#> d[stroke = 1: Indobufen]                                      0.67      0.83      0.91      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.07      0.14
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.12      0.25      0.45      0.61
#> d[stroke = 1: Medium dose aspirin]                            0.02      0.07      0.26      0.52
#> d[stroke = 1: Placebo/Standard care]                          0.00      0.01      0.02      0.07
#> d[stroke = 1: Triflusal]                                      0.03      0.06      0.10      0.15
#> d[stroke = 1: Ximelagatran]                                   0.96      0.98      0.99      1.00
#>                                                          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.18       0.19       0.20       0.22
#> d[stroke = 1: Alternate day aspirin]                          0.86       0.89       0.91       0.93
#> d[stroke = 1: Dipyridamole]                                   0.36       0.48       0.61       0.74
#> d[stroke = 1: Fixed dose warfarin]                            0.83       0.88       0.91       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.06
#> d[stroke = 1: High dose aspirin]                              0.51       0.58       0.64       0.69
#> 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.10       0.21       0.39       0.62
#> d[stroke = 1: Low dose aspirin + copidogrel]                  0.24       0.36       0.51       0.68
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.72       0.81       0.88       0.93
#> d[stroke = 1: Medium dose aspirin]                            0.75       0.88       0.95       0.98
#> d[stroke = 1: Placebo/Standard care]                          0.19       0.38       0.59       0.76
#> d[stroke = 1: Triflusal]                                      0.20       0.25       0.31       0.38
#> 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.24       0.28       0.73
#> d[stroke = 1: Alternate day aspirin]                           0.96       0.99       0.99
#> d[stroke = 1: Dipyridamole]                                    0.86       0.95       0.98
#> d[stroke = 1: Fixed dose warfarin]                             0.96       0.99       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.07       0.08       0.34
#> d[stroke = 1: High dose aspirin]                               0.79       0.93       0.96
#> d[stroke = 1: Indobufen]                                       1.00       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.83       0.94       0.98
#> d[stroke = 1: Low dose aspirin + copidogrel]                   0.85       0.94       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.89       0.96       0.98
#> d[stroke = 1: Triflusal]                                       0.51       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.33          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]                                0.99          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.94          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.4 (on 61 data points)
#>                pD: 48.7
#>               DIC: 109.1
(af_dic_4b <- dic(af_fit_4b))
#> Residual deviance: 58.4 (on 61 data points)
#>                pD: 47.7
#>               DIC: 106.1

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.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.