Example: Atrial fibrillation

library(multinma)
options(mc.cores = parallel::detectCores())
#> For execution on a local, multicore CPU with excess RAM we recommend calling
#> options(mc.cores = parallel::detectCores())
#> 
#> Attaching package: 'multinma'
#> The following objects are masked from 'package:stats':
#> 
#>     dgamma, pgamma, qgamma

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         Treatments                                                                         
#>  ACTIVE-W      2: Standard adjusted dose anti-coagulant | Low dose aspirin + copidogrel           
#>  AFASAK 1      3: Placebo/Standard care | Standard adjusted dose anti-coagulant | Low dose aspirin
#>  AFASAK 2      4: Standard adjusted dose anti-coagulant | Fixed dose warfarin | Medium dose asp...
#>  BAATAF        2: Placebo/Standard care | Low adjusted dose anti-coagulant                        
#>  BAFTA         2: Standard adjusted dose anti-coagulant | Low dose aspirin                        
#>  CAFA          2: Placebo/Standard care | Standard adjusted dose anti-coagulant                   
#>  Chinese ATAFS 2: Standard adjusted dose anti-coagulant | Low dose aspirin                        
#>  EAFT          3: Placebo/Standard care | Standard adjusted dose anti-coagulant | Medium dose a...
#>  ESPS 2        4: Placebo/Standard care | Low dose aspirin | Dipyridamole | Low dose aspirin + ...
#>  JAST          2: Placebo/Standard care | Low dose aspirin                                        
#>  ... 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.01 0.82    -2.45    -1.31    -0.73
#> d[Alternate day aspirin]                        -1.00    0.02 1.37    -4.12    -1.77    -0.84
#> d[Dipyridamole]                                  0.57    0.01 0.44    -0.31     0.28     0.58
#> d[Fixed dose warfarin]                           0.93    0.01 0.41     0.12     0.67     0.93
#> d[Fixed dose warfarin + low dose aspirin]        0.47    0.01 0.45    -0.44     0.19     0.47
#> d[Fixed dose warfarin + medium dose aspirin]     0.89    0.01 0.32     0.25     0.69     0.90
#> d[High dose aspirin]                             0.53    0.01 0.77    -1.01     0.04     0.54
#> d[Indobufen]                                     0.25    0.01 0.44    -0.62    -0.04     0.25
#> d[Low adjusted dose anti-coagulant]             -0.31    0.01 0.38    -1.09    -0.55    -0.30
#> d[Low dose aspirin]                              0.61    0.00 0.21     0.19     0.48     0.62
#> d[Low dose aspirin + copidogrel]                 0.51    0.01 0.34    -0.21     0.32     0.52
#> d[Low dose aspirin + dipyridamole]               0.25    0.01 0.46    -0.68    -0.05     0.25
#> d[Medium dose aspirin]                           0.39    0.00 0.20    -0.02     0.27     0.39
#> d[Placebo/Standard care]                         0.75    0.00 0.20     0.35     0.63     0.75
#> d[Triflusal]                                     0.66    0.01 0.62    -0.55     0.26     0.65
#> d[Ximelagatran]                                 -0.08    0.00 0.25    -0.60    -0.24    -0.09
#> lp__                                         -4771.91    0.23 7.18 -4786.76 -4776.55 -4771.63
#> tau                                              0.28    0.01 0.14     0.03     0.19     0.27
#>                                                   75%    97.5% n_eff Rhat
#> d[Acenocoumarol]                                -0.20     0.75  3356    1
#> d[Alternate day aspirin]                        -0.04     1.23  3943    1
#> d[Dipyridamole]                                  0.86     1.42  2640    1
#> d[Fixed dose warfarin]                           1.20     1.72  3459    1
#> d[Fixed dose warfarin + low dose aspirin]        0.74     1.39  2540    1
#> d[Fixed dose warfarin + medium dose aspirin]     1.10     1.53  3071    1
#> d[High dose aspirin]                             1.03     2.00  3662    1
#> d[Indobufen]                                     0.53     1.13  3285    1
#> d[Low adjusted dose anti-coagulant]             -0.06     0.40  2943    1
#> d[Low dose aspirin]                              0.75     1.03  2147    1
#> d[Low dose aspirin + copidogrel]                 0.71     1.23  3178    1
#> d[Low dose aspirin + dipyridamole]               0.56     1.12  2743    1
#> d[Medium dose aspirin]                           0.52     0.75  2298    1
#> d[Placebo/Standard care]                         0.89     1.14  1708    1
#> d[Triflusal]                                     1.06     1.90  3041    1
#> d[Ximelagatran]                                  0.07     0.42  2972    1
#> lp__                                         -4766.86 -4758.56   949    1
#> tau                                              0.36     0.58   643    1
#> 
#> Samples were drawn using NUTS(diag_e) at Thu Nov 26 10:53:11 2020.
#> 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.89 -0.75 -0.63 -0.35     1720
#> d[Acenocoumarol]                             -1.52 0.84 -3.22 -2.07 -1.49 -0.96  0.07     3272
#> d[Alternate day aspirin]                     -1.76 1.37 -4.88 -2.51 -1.60 -0.81  0.45     4765
#> d[Dipyridamole]                              -0.18 0.42 -1.05 -0.46 -0.17  0.09  0.67     3892
#> d[Fixed dose warfarin]                        0.17 0.44 -0.71 -0.11  0.16  0.46  1.04     3188
#> d[Fixed dose warfarin + low dose aspirin]    -0.28 0.41 -1.09 -0.54 -0.29 -0.04  0.57     3706
#> d[Fixed dose warfarin + medium dose aspirin]  0.14 0.36 -0.61 -0.09  0.15  0.38  0.83     2849
#> d[High dose aspirin]                         -0.22 0.76 -1.76 -0.71 -0.22  0.27  1.25     4404
#> d[Indobufen]                                 -0.51 0.49 -1.47 -0.82 -0.50 -0.20  0.47     2797
#> d[Low adjusted dose anti-coagulant]          -1.06 0.35 -1.76 -1.28 -1.05 -0.83 -0.38     4766
#> d[Low dose aspirin]                          -0.14 0.22 -0.58 -0.28 -0.14  0.00  0.27     3967
#> d[Low dose aspirin + copidogrel]             -0.24 0.40 -1.04 -0.48 -0.24  0.00  0.55     2444
#> d[Low dose aspirin + dipyridamole]           -0.50 0.44 -1.41 -0.79 -0.50 -0.21  0.33     4110
#> d[Medium dose aspirin]                       -0.36 0.22 -0.81 -0.50 -0.35 -0.22  0.06     2887
#> d[Triflusal]                                 -0.09 0.64 -1.34 -0.51 -0.10  0.33  1.19     3050
#> d[Ximelagatran]                              -0.84 0.32 -1.48 -1.04 -0.84 -0.65 -0.19     2278
#>                                              Tail_ESS Rhat
#> d[Standard adjusted dose anti-coagulant]         1977    1
#> d[Acenocoumarol]                                 3028    1
#> d[Alternate day aspirin]                         2630    1
#> d[Dipyridamole]                                  2993    1
#> d[Fixed dose warfarin]                           2863    1
#> d[Fixed dose warfarin + low dose aspirin]        2955    1
#> d[Fixed dose warfarin + medium dose aspirin]     2699    1
#> d[High dose aspirin]                             2869    1
#> d[Indobufen]                                     2382    1
#> d[Low adjusted dose anti-coagulant]              3428    1
#> d[Low dose aspirin]                              2771    1
#> d[Low dose aspirin + copidogrel]                 2368    1
#> d[Low dose aspirin + dipyridamole]               3161    1
#> d[Medium dose aspirin]                           2893    1
#> d[Triflusal]                                     2461    1
#> d[Ximelagatran]                                  2668    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
#> rank[Standard adjusted dose anti-coagulant]      5.29 1.42    3   4   5  6.00  8.00     2461
#> rank[Acenocoumarol]                              3.09 3.12    1   1   2  3.25 13.00     3448
#> rank[Alternate day aspirin]                      3.81 4.38    1   1   2  5.00 16.00     5079
#> rank[Dipyridamole]                              11.09 3.79    3   8  11 14.00 17.00     3515
#> rank[Fixed dose warfarin]                       14.10 3.05    6  12  15 16.00 17.00     3905
#> rank[Fixed dose warfarin + low dose aspirin]    10.05 3.85    3   7  10 13.00 17.00     3187
#> rank[Fixed dose warfarin + medium dose aspirin] 14.15 2.62    8  13  15 16.00 17.00     2792
#> rank[High dose aspirin]                         10.43 5.24    1   6  11 16.00 17.00     4114
#> rank[Indobufen]                                  8.03 3.95    2   5   8 11.00 16.00     3240
#> rank[Low adjusted dose anti-coagulant]           3.68 2.11    1   2   3  5.00  9.00     3288
#> rank[Low dose aspirin]                          11.74 2.26    7  10  12 13.00 16.00     3601
#> rank[Low dose aspirin + copidogrel]             10.58 3.40    4   8  11 13.00 17.00     2816
#> rank[Low dose aspirin + dipyridamole]            8.03 3.81    2   5   8 11.00 16.00     3608
#> rank[Medium dose aspirin]                        9.19 2.15    5   8   9 11.00 13.00     2966
#> rank[Placebo/Standard care]                     13.39 1.82   10  12  14 15.00 16.03     3198
#> rank[Triflusal]                                 11.54 4.59    3   8  12 16.00 17.00     3241
#> rank[Ximelagatran]                               4.82 2.22    2   3   4  6.00 10.00     2633
#>                                                 Tail_ESS Rhat
#> rank[Standard adjusted dose anti-coagulant]         2620    1
#> rank[Acenocoumarol]                                 2677    1
#> rank[Alternate day aspirin]                         3638    1
#> rank[Dipyridamole]                                    NA    1
#> rank[Fixed dose warfarin]                             NA    1
#> rank[Fixed dose warfarin + low dose aspirin]        2884    1
#> rank[Fixed dose warfarin + medium dose aspirin]       NA    1
#> rank[High dose aspirin]                               NA    1
#> rank[Indobufen]                                     3178    1
#> rank[Low adjusted dose anti-coagulant]              3340    1
#> rank[Low dose aspirin]                              3626    1
#> rank[Low dose aspirin + copidogrel]                 2568    1
#> rank[Low dose aspirin + dipyridamole]               2848    1
#> rank[Medium dose aspirin]                           3220    1
#> rank[Placebo/Standard care]                         3745    1
#> rank[Triflusal]                                       NA    1
#> rank[Ximelagatran]                                  2768    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.01      0.08      0.20      0.29
#> d[Acenocoumarol]                                  0.37      0.28      0.09      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.01      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.06      0.05      0.04
#> d[Indobufen]                                      0.01      0.05      0.07      0.08      0.08
#> d[Low adjusted dose anti-coagulant]               0.08      0.24      0.26      0.15      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.08
#> 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.10      0.19      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.01       0.00
#> d[Acenocoumarol]                                  0.03      0.02      0.02      0.02       0.01
#> d[Alternate day aspirin]                          0.03      0.02      0.02      0.02       0.02
#> d[Dipyridamole]                                   0.05      0.07      0.07      0.08       0.09
#> d[Fixed dose warfarin]                            0.01      0.02      0.02      0.03       0.04
#> d[Fixed dose warfarin + low dose aspirin]         0.06      0.08      0.09      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.04      0.05      0.05      0.05       0.05
#> d[Indobufen]                                      0.10      0.10      0.09      0.09       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.08       0.12
#> d[Low dose aspirin + copidogrel]                  0.05      0.06      0.11      0.11       0.10
#> d[Low dose aspirin + dipyridamole]                0.10      0.12      0.10      0.08       0.07
#> d[Medium dose aspirin]                            0.06      0.12      0.16      0.20       0.16
#> d[Placebo/Standard care]                          0.00      0.00      0.01      0.02       0.04
#> d[Triflusal]                                      0.04      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.00       0.01
#> d[Alternate day aspirin]                           0.01       0.01       0.02       0.01       0.01
#> d[Dipyridamole]                                    0.09       0.08       0.08       0.08       0.09
#> d[Fixed dose warfarin]                             0.05       0.07       0.07       0.10       0.14
#> d[Fixed dose warfarin + low dose aspirin]          0.09       0.08       0.07       0.06       0.05
#> d[Fixed dose warfarin + medium dose aspirin]       0.05       0.06       0.09       0.12       0.17
#> d[High dose aspirin]                               0.04       0.04       0.04       0.05       0.08
#> d[Indobufen]                                       0.05       0.05       0.04       0.04       0.03
#> d[Low adjusted dose anti-coagulant]                0.00       0.00       0.00       0.00       0.00
#> d[Low dose aspirin]                                0.16       0.17       0.16       0.12       0.07
#> d[Low dose aspirin + copidogrel]                   0.10       0.10       0.08       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.18
#> d[Triflusal]                                       0.06       0.05       0.05       0.07       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.00       0.00
#> d[Alternate day aspirin]                           0.02       0.02
#> d[Dipyridamole]                                    0.08       0.07
#> d[Fixed dose warfarin]                             0.20       0.24
#> d[Fixed dose warfarin + low dose aspirin]          0.05       0.05
#> d[Fixed dose warfarin + medium dose aspirin]       0.23       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.03       0.01
#> d[Low dose aspirin + copidogrel]                   0.05       0.04
#> d[Low dose aspirin + dipyridamole]                 0.02       0.02
#> d[Medium dose aspirin]                             0.00       0.00
#> d[Placebo/Standard care]                           0.09       0.03
#> d[Triflusal]                                       0.11       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.29      0.58
#> d[Acenocoumarol]                                  0.37      0.66      0.75      0.81      0.85
#> d[Alternate day aspirin]                          0.46      0.64      0.71      0.75      0.78
#> 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.02
#> d[Fixed dose warfarin + low dose aspirin]         0.00      0.02      0.05      0.08      0.13
#> d[Fixed dose warfarin + medium dose aspirin]      0.00      0.00      0.00      0.00      0.00
#> d[High dose aspirin]                              0.03      0.08      0.14      0.19      0.24
#> d[Indobufen]                                      0.01      0.06      0.13      0.21      0.30
#> d[Low adjusted dose anti-coagulant]               0.08      0.33      0.59      0.74      0.83
#> 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.02      0.04
#> d[Placebo/Standard care]                          0.00      0.00      0.00      0.00      0.00
#> d[Triflusal]                                      0.00      0.02      0.06      0.10      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.94      0.99      1.00       1.00
#> d[Acenocoumarol]                                  0.88      0.90      0.92      0.94       0.95
#> d[Alternate day aspirin]                          0.80      0.83      0.85      0.87       0.89
#> d[Dipyridamole]                                   0.13      0.19      0.27      0.35       0.44
#> d[Fixed dose warfarin]                            0.03      0.05      0.07      0.10       0.14
#> d[Fixed dose warfarin + low dose aspirin]         0.19      0.27      0.36      0.45       0.55
#> d[Fixed dose warfarin + medium dose aspirin]      0.01      0.02      0.04      0.07       0.12
#> d[High dose aspirin]                              0.28      0.34      0.39      0.44       0.49
#> d[Indobufen]                                      0.39      0.49      0.58      0.67       0.74
#> d[Low adjusted dose anti-coagulant]               0.89      0.94      0.96      0.98       0.99
#> d[Low dose aspirin]                               0.01      0.03      0.09      0.16       0.29
#> d[Low dose aspirin + copidogrel]                  0.12      0.18      0.29      0.39       0.50
#> d[Low dose aspirin + dipyridamole]                0.38      0.49      0.59      0.67       0.74
#> d[Medium dose aspirin]                            0.09      0.21      0.37      0.57       0.74
#> d[Placebo/Standard care]                          0.00      0.00      0.01      0.02       0.06
#> d[Triflusal]                                      0.18      0.23      0.29      0.35       0.40
#> d[Ximelagatran]                                   0.81      0.89      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.97       0.98       0.98       0.99
#> d[Alternate day aspirin]                           0.90       0.91       0.93       0.94       0.96
#> d[Dipyridamole]                                    0.52       0.60       0.69       0.77       0.85
#> d[Fixed dose warfarin]                             0.18       0.25       0.32       0.42       0.56
#> d[Fixed dose warfarin + low dose aspirin]          0.64       0.71       0.79       0.85       0.90
#> d[Fixed dose warfarin + medium dose aspirin]       0.17       0.23       0.32       0.43       0.60
#> d[High dose aspirin]                               0.53       0.57       0.62       0.67       0.75
#> d[Indobufen]                                       0.79       0.84       0.88       0.92       0.95
#> d[Low adjusted dose anti-coagulant]                1.00       1.00       1.00       1.00       1.00
#> d[Low dose aspirin]                                0.45       0.61       0.77       0.89       0.96
#> d[Low dose aspirin + copidogrel]                   0.60       0.70       0.78       0.86       0.92
#> d[Low dose aspirin + dipyridamole]                 0.80       0.85       0.90       0.93       0.96
#> d[Medium dose aspirin]                             0.86       0.93       0.98       0.99       1.00
#> d[Placebo/Standard care]                           0.15       0.29       0.50       0.71       0.88
#> d[Triflusal]                                       0.46       0.52       0.57       0.63       0.71
#> 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.93          1
#> d[Fixed dose warfarin]                             0.76          1
#> d[Fixed dose warfarin + low dose aspirin]          0.95          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.98          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.

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[.trtclassMixed:stroke]                      3.91    0.03 2.02    -0.05     2.55     3.91
#> beta[.trtclassAnti-platelet:stroke]              0.94    0.01 0.40     0.18     0.68     0.93
#> beta[.trtclassControl:stroke]                    0.71    0.01 0.42    -0.11     0.43     0.71
#> d[Acenocoumarol]                                 0.35    0.02 0.98    -1.66    -0.28     0.38
#> d[Alternate day aspirin]                        -0.90    0.03 1.35    -4.06    -1.66    -0.73
#> d[Dipyridamole]                                  0.57    0.01 0.39    -0.21     0.31     0.57
#> d[Fixed dose warfarin]                           0.64    0.00 0.38    -0.11     0.38     0.63
#> d[Fixed dose warfarin + low dose aspirin]        1.46    0.01 0.71     0.06     0.99     1.47
#> d[Fixed dose warfarin + medium dose aspirin]     1.01    0.00 0.30     0.43     0.81     1.01
#> d[High dose aspirin]                             0.41    0.01 0.74    -1.02    -0.09     0.41
#> d[Indobufen]                                    -0.42    0.01 0.47    -1.33    -0.73    -0.41
#> d[Low adjusted dose anti-coagulant]             -0.44    0.01 0.36    -1.14    -0.67    -0.44
#> d[Low dose aspirin]                              0.72    0.00 0.19     0.34     0.59     0.71
#> d[Low dose aspirin + copidogrel]                 0.65    0.00 0.26     0.11     0.50     0.65
#> d[Low dose aspirin + dipyridamole]               0.25    0.01 0.42    -0.59    -0.02     0.25
#> 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.18     0.42     0.67     0.79
#> d[Triflusal]                                     0.92    0.01 0.58    -0.17     0.54     0.90
#> d[Ximelagatran]                                 -0.08    0.00 0.20    -0.49    -0.21    -0.08
#> lp__                                         -4771.50    0.22 7.00 -4786.11 -4776.06 -4771.20
#> tau                                              0.16    0.01 0.12     0.01     0.07     0.15
#>                                                   75%    97.5% n_eff Rhat
#> beta[.trtclassMixed:stroke]                      5.27     7.91  4706 1.00
#> beta[.trtclassAnti-platelet:stroke]              1.20     1.75  4928 1.00
#> beta[.trtclassControl:stroke]                    0.99     1.55  4159 1.00
#> d[Acenocoumarol]                                 1.02     2.21  4056 1.00
#> d[Alternate day aspirin]                         0.02     1.25  2771 1.00
#> d[Dipyridamole]                                  0.83     1.34  5372 1.00
#> d[Fixed dose warfarin]                           0.89     1.39  5898 1.00
#> d[Fixed dose warfarin + low dose aspirin]        1.94     2.84  4666 1.00
#> d[Fixed dose warfarin + medium dose aspirin]     1.20     1.61  4879 1.00
#> d[High dose aspirin]                             0.91     1.83  5985 1.00
#> d[Indobufen]                                    -0.11     0.48  4341 1.00
#> d[Low adjusted dose anti-coagulant]             -0.19     0.26  4124 1.00
#> d[Low dose aspirin]                              0.85     1.09  4656 1.00
#> d[Low dose aspirin + copidogrel]                 0.80     1.17  3099 1.00
#> d[Low dose aspirin + dipyridamole]               0.53     1.05  5787 1.00
#> d[Medium dose aspirin]                           0.46     0.68  4290 1.00
#> d[Placebo/Standard care]                         0.91     1.14  3495 1.00
#> d[Triflusal]                                     1.29     2.06  5526 1.00
#> d[Ximelagatran]                                  0.04     0.32  4098 1.00
#> lp__                                         -4766.51 -4758.70  1008 1.00
#> tau                                              0.24     0.42   464 1.01
#> 
#> Samples were drawn using NUTS(diag_e) at Thu Nov 26 10:54:27 2020.
#> 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.23 -1.04 -0.73 -0.58 -0.42 -0.12
#> d[stroke = 0: Acenocoumarol]                             -1.38 0.82 -3.07 -1.90 -1.35 -0.81  0.14
#> d[stroke = 0: Alternate day aspirin]                     -1.76 1.34 -4.86 -2.52 -1.57 -0.86  0.41
#> d[stroke = 0: Dipyridamole]                              -0.29 0.42 -1.12 -0.56 -0.28 -0.01  0.54
#> d[stroke = 0: Fixed dose warfarin]                        0.06 0.44 -0.77 -0.24  0.06  0.35  0.92
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]    -0.28 0.32 -0.91 -0.48 -0.27 -0.07  0.34
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin] -0.73 0.63 -2.00 -1.14 -0.72 -0.31  0.52
#> d[stroke = 0: High dose aspirin]                         -0.44 0.77 -1.95 -0.95 -0.44  0.08  1.03
#> d[stroke = 0: Indobufen]                                 -1.27 0.56 -2.39 -1.63 -1.27 -0.89 -0.16
#> d[stroke = 0: Low adjusted dose anti-coagulant]          -1.02 0.33 -1.67 -1.23 -1.02 -0.80 -0.40
#> d[stroke = 0: Low dose aspirin]                          -0.14 0.22 -0.57 -0.29 -0.14  0.01  0.30
#> d[stroke = 0: Low dose aspirin + copidogrel]             -0.21 0.34 -0.87 -0.42 -0.21  0.01  0.48
#> d[stroke = 0: Low dose aspirin + dipyridamole]           -0.61 0.45 -1.50 -0.91 -0.61 -0.31  0.28
#> d[stroke = 0: Medium dose aspirin]                       -0.51 0.26 -1.02 -0.68 -0.51 -0.34  0.02
#> d[stroke = 0: Triflusal]                                  0.06 0.61 -1.09 -0.35  0.05  0.46  1.30
#> d[stroke = 0: Ximelagatran]                              -0.66 0.30 -1.26 -0.85 -0.67 -0.47 -0.06
#>                                                          Bulk_ESS Tail_ESS Rhat
#> d[stroke = 0: Standard adjusted dose anti-coagulant]         3619     3116    1
#> d[stroke = 0: Acenocoumarol]                                 3984     2734    1
#> d[stroke = 0: Alternate day aspirin]                         3571     1997    1
#> d[stroke = 0: Dipyridamole]                                  5059     3198    1
#> d[stroke = 0: Fixed dose warfarin]                           4925     2890    1
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]        5199     2928    1
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]     4415     2599    1
#> d[stroke = 0: High dose aspirin]                             6091     2994    1
#> d[stroke = 0: Indobufen]                                     4254     3217    1
#> d[stroke = 0: Low adjusted dose anti-coagulant]              5465     3238    1
#> d[stroke = 0: Low dose aspirin]                              4172     2970    1
#> d[stroke = 0: Low dose aspirin + copidogrel]                 3506     2534    1
#> d[stroke = 0: Low dose aspirin + dipyridamole]               5305     3128    1
#> d[stroke = 0: Medium dose aspirin]                           4493     3561    1
#> d[stroke = 0: Triflusal]                                     5200     3034    1
#> d[stroke = 0: Ximelagatran]                                  3770     2926    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.29 0.33 -1.95 -1.50 -1.29 -1.07 -0.66
#> d[stroke = 1: Acenocoumarol]                              1.82 2.18 -2.37  0.32  1.82  3.30  6.05
#> d[stroke = 1: Alternate day aspirin]                     -1.53 1.37 -4.68 -2.32 -1.35 -0.59  0.73
#> d[stroke = 1: Dipyridamole]                              -0.06 0.38 -0.81 -0.30 -0.04  0.19  0.66
#> d[stroke = 1: Fixed dose warfarin]                       -0.65 0.51 -1.64 -1.00 -0.65 -0.31  0.35
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]     2.92 2.08 -1.12  1.52  2.92  4.33  7.01
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]  2.47 1.56 -0.58  1.42  2.46  3.52  5.56
#> d[stroke = 1: High dose aspirin]                         -0.21 0.73 -1.62 -0.69 -0.22  0.28  1.21
#> d[stroke = 1: Indobufen]                                 -1.04 0.50 -2.02 -1.36 -1.04 -0.72 -0.08
#> d[stroke = 1: Low adjusted dose anti-coagulant]          -1.73 0.48 -2.67 -2.05 -1.73 -1.41 -0.77
#> d[stroke = 1: Low dose aspirin]                           0.09 0.28 -0.45 -0.09  0.09  0.28  0.63
#> d[stroke = 1: Low dose aspirin + copidogrel]              0.02 0.36 -0.69 -0.20  0.02  0.25  0.72
#> d[stroke = 1: Low dose aspirin + dipyridamole]           -0.38 0.41 -1.20 -0.64 -0.37 -0.10  0.40
#> d[stroke = 1: Medium dose aspirin]                       -0.28 0.23 -0.76 -0.42 -0.27 -0.12  0.17
#> d[stroke = 1: Triflusal]                                  0.29 0.63 -0.90 -0.13  0.28  0.69  1.60
#> d[stroke = 1: Ximelagatran]                              -1.37 0.39 -2.15 -1.61 -1.37 -1.11 -0.63
#>                                                          Bulk_ESS Tail_ESS Rhat
#> d[stroke = 1: Standard adjusted dose anti-coagulant]         5038     3415    1
#> d[stroke = 1: Acenocoumarol]                                 4458     3247    1
#> d[stroke = 1: Alternate day aspirin]                         3615     2234    1
#> d[stroke = 1: Dipyridamole]                                  5622     3183    1
#> d[stroke = 1: Fixed dose warfarin]                           5274     3488    1
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]        4582     3108    1
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]     4727     3099    1
#> d[stroke = 1: High dose aspirin]                             6300     2982    1
#> d[stroke = 1: Indobufen]                                     4593     3247    1
#> d[stroke = 1: Low adjusted dose anti-coagulant]              4353     3088    1
#> d[stroke = 1: Low dose aspirin]                              4719     2990    1
#> d[stroke = 1: Low dose aspirin + copidogrel]                 4055     2896    1
#> d[stroke = 1: Low dose aspirin + dipyridamole]               5171     2810    1
#> d[stroke = 1: Medium dose aspirin]                           4765     3160    1
#> d[stroke = 1: Triflusal]                                     5441     2956    1
#> d[stroke = 1: Ximelagatran]                                  4593     3135    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[ , , 1:2] <- sweep(af_4b_beta[ , , 1:2], 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)[3] <- "beta[.trtclassAnti-coagulant:stroke]"

# Summarise
summary(af_4b_beta)
#>                                       mean   sd  2.5%   25%   50%   75% 97.5% Bulk_ESS Tail_ESS
#> beta[.trtclassMixed:stroke]           3.20 2.06 -0.83  1.84  3.21  4.58  7.27     4695     3081
#> beta[.trtclassAnti-platelet:stroke]   0.23 0.32 -0.41  0.02  0.24  0.44  0.86     4268     2715
#> beta[.trtclassAnti-coagulant:stroke] -0.71 0.42 -1.55 -0.99 -0.71 -0.43  0.11     4270     3121
#>                                      Rhat
#> beta[.trtclassMixed:stroke]             1
#> beta[.trtclassAnti-platelet:stroke]     1
#> beta[.trtclassAnti-coagulant: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.74 1.82    4   6   8   9    11
#> rank[stroke = 0: Acenocoumarol]                              3.94 3.60    1   1   3   5    15
#> rank[stroke = 0: Alternate day aspirin]                      3.97 4.48    1   1   2   5    17
#> rank[stroke = 0: Dipyridamole]                              11.09 3.65    4   8  11  14    17
#> rank[stroke = 0: Fixed dose warfarin]                       14.14 2.93    7  12  15  16    17
#> rank[stroke = 0: Fixed dose warfarin + low dose aspirin]    11.11 3.64    4   9  11  14    17
#> rank[stroke = 0: Fixed dose warfarin + medium dose aspirin]  7.26 4.50    1   3   6  11    16
#> rank[stroke = 0: High dose aspirin]                          9.57 5.29    1   5  10  15    17
#> rank[stroke = 0: Indobufen]                                  3.57 2.65    1   2   3   4    11
#> rank[stroke = 0: Low adjusted dose anti-coagulant]           4.43 2.31    1   3   4   6    10
#> rank[stroke = 0: Low dose aspirin]                          12.95 1.94    9  12  13  14    16
#> rank[stroke = 0: Low dose aspirin + copidogrel]             12.05 2.83    6  10  12  14    17
#> rank[stroke = 0: Low dose aspirin + dipyridamole]            7.85 3.72    2   5   7  11    16
#> rank[stroke = 0: Medium dose aspirin]                        8.63 2.17    5   7   9  10    13
#> rank[stroke = 0: Placebo/Standard care]                     14.32 1.89   10  13  15  16    17
#> rank[stroke = 0: Triflusal]                                 13.48 3.92    4  11  15  17    17
#> rank[stroke = 0: Ximelagatran]                               6.92 2.49    3   5   7   8    12
#>                                                             Bulk_ESS Tail_ESS Rhat
#> rank[stroke = 0: Standard adjusted dose anti-coagulant]         4374     3446    1
#> rank[stroke = 0: Acenocoumarol]                                 4459     3202    1
#> rank[stroke = 0: Alternate day aspirin]                         5170     3676    1
#> rank[stroke = 0: Dipyridamole]                                  5370       NA    1
#> rank[stroke = 0: Fixed dose warfarin]                           4901       NA    1
#> rank[stroke = 0: Fixed dose warfarin + low dose aspirin]        4865     3271    1
#> rank[stroke = 0: Fixed dose warfarin + medium dose aspirin]     4402     2948    1
#> rank[stroke = 0: High dose aspirin]                             6063       NA    1
#> rank[stroke = 0: Indobufen]                                     4348     3292    1
#> rank[stroke = 0: Low adjusted dose anti-coagulant]              4947     3734    1
#> rank[stroke = 0: Low dose aspirin]                              3842     2930    1
#> rank[stroke = 0: Low dose aspirin + copidogrel]                 3606     2490    1
#> rank[stroke = 0: Low dose aspirin + dipyridamole]               5258     3262    1
#> rank[stroke = 0: Medium dose aspirin]                           4753     3142    1
#> rank[stroke = 0: Placebo/Standard care]                         3342       NA    1
#> rank[stroke = 0: Triflusal]                                     5194       NA    1
#> rank[stroke = 0: Ximelagatran]                                  3998     2854    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.62 1.06    2   3   4   4     6
#> rank[stroke = 1: Acenocoumarol]                             13.25 4.27    1  14  15  16    17
#> rank[stroke = 1: Alternate day aspirin]                      4.46 4.01    1   1   3   6    14
#> rank[stroke = 1: Dipyridamole]                              10.58 2.66    6   9  11  13    15
#> rank[stroke = 1: Fixed dose warfarin]                        7.04 2.69    3   5   6   8    14
#> rank[stroke = 1: Fixed dose warfarin + low dose aspirin]    15.87 2.78    6  16  17  17    17
#> rank[stroke = 1: Fixed dose warfarin + medium dose aspirin] 15.50 1.81    9  15  16  16    17
#> rank[stroke = 1: High dose aspirin]                          9.42 3.97    2   6   9  13    16
#> rank[stroke = 1: Indobufen]                                  4.94 2.11    1   4   5   6    10
#> rank[stroke = 1: Low adjusted dose anti-coagulant]           1.95 1.22    1   1   2   2     5
#> rank[stroke = 1: Low dose aspirin]                          11.89 1.76    8  11  12  13    15
#> rank[stroke = 1: Low dose aspirin + copidogrel]             11.15 2.32    6  10  11  13    15
#> rank[stroke = 1: Low dose aspirin + dipyridamole]            8.22 2.61    4   6   8  10    14
#> rank[stroke = 1: Medium dose aspirin]                        8.62 1.66    6   8   8  10    12
#> rank[stroke = 1: Placebo/Standard care]                     11.14 1.93    7  10  11  12    15
#> rank[stroke = 1: Triflusal]                                 12.21 3.03    5  10  13  14    17
#> rank[stroke = 1: Ximelagatran]                               3.13 1.31    1   2   3   4     6
#>                                                             Bulk_ESS Tail_ESS Rhat
#> rank[stroke = 1: Standard adjusted dose anti-coagulant]         3879     3501    1
#> rank[stroke = 1: Acenocoumarol]                                 4010       NA    1
#> rank[stroke = 1: Alternate day aspirin]                         4915     3057    1
#> rank[stroke = 1: Dipyridamole]                                  5016     3279    1
#> rank[stroke = 1: Fixed dose warfarin]                           5162     3496    1
#> rank[stroke = 1: Fixed dose warfarin + low dose aspirin]        3289       NA    1
#> rank[stroke = 1: Fixed dose warfarin + medium dose aspirin]     3533       NA    1
#> rank[stroke = 1: High dose aspirin]                             5772     3371    1
#> rank[stroke = 1: Indobufen]                                     4936     3552    1
#> rank[stroke = 1: Low adjusted dose anti-coagulant]              3430     3256    1
#> rank[stroke = 1: Low dose aspirin]                              4304     3328    1
#> rank[stroke = 1: Low dose aspirin + copidogrel]                 3789     2685    1
#> rank[stroke = 1: Low dose aspirin + dipyridamole]               4761     3186    1
#> rank[stroke = 1: Medium dose aspirin]                           4269     3120    1
#> rank[stroke = 1: Placebo/Standard care]                         4517     3022    1
#> rank[stroke = 1: Triflusal]                                     4553       NA    1
#> rank[stroke = 1: Ximelagatran]                                  3482     3315    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.02
#> d[stroke = 0: Acenocoumarol]                                  0.25      0.25      0.13      0.09
#> d[stroke = 0: Alternate day aspirin]                          0.45      0.15      0.09      0.05
#> d[stroke = 0: Dipyridamole]                                   0.00      0.01      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.00      0.01      0.03
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.04      0.10      0.11      0.10
#> d[stroke = 0: High dose aspirin]                              0.03      0.06      0.08      0.08
#> d[stroke = 0: Indobufen]                                      0.17      0.25      0.20      0.14
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.04      0.15      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.07      0.11
#> 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.01      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.07      0.15      0.20      0.20
#> d[stroke = 0: Acenocoumarol]                                  0.06      0.04      0.02      0.03
#> 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.06
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.10      0.07      0.06      0.05
#> d[stroke = 0: High dose aspirin]                              0.06      0.05      0.04      0.05
#> d[stroke = 0: Indobufen]                                      0.08      0.04      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.01      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.05      0.09      0.14      0.17
#> 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.17      0.15      0.12
#>                                                          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.05       0.02
#> d[stroke = 0: Acenocoumarol]                                  0.02       0.02       0.01       0.01
#> d[stroke = 0: Alternate day aspirin]                          0.02       0.02       0.02       0.02
#> d[stroke = 0: Dipyridamole]                                   0.07       0.09       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.07       0.10       0.09       0.11
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.05       0.05       0.05       0.05
#> d[stroke = 0: High dose aspirin]                              0.04       0.05       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.02       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.09       0.14       0.13
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.07       0.08       0.07       0.05
#> d[stroke = 0: Medium dose aspirin]                            0.19       0.15       0.09       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.05       0.05
#> d[stroke = 0: Ximelagatran]                                   0.08       0.06       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.01       0.02       0.02
#> d[stroke = 0: Dipyridamole]                                    0.09       0.08       0.09
#> d[stroke = 0: Fixed dose warfarin]                             0.07       0.10       0.13
#> 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.03       0.03       0.04
#> d[stroke = 0: High dose aspirin]                               0.05       0.04       0.06
#> 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.19       0.13
#> d[stroke = 0: Low dose aspirin + copidogrel]                   0.14       0.12       0.09
#> d[stroke = 0: Low dose aspirin + dipyridamole]                 0.04       0.03       0.02
#> d[stroke = 0: Medium dose aspirin]                             0.03       0.01       0.00
#> d[stroke = 0: Placebo/Standard care]                           0.13       0.18       0.24
#> 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.03
#> d[stroke = 0: Dipyridamole]                                    0.07       0.05
#> d[stroke = 0: Fixed dose warfarin]                             0.21       0.24
#> 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.13
#> 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.07       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.20       0.10
#> d[stroke = 0: Triflusal]                                       0.14       0.31
#> 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.11      0.34      0.35
#> d[stroke = 1: Acenocoumarol]                                  0.04      0.02      0.01      0.01
#> d[stroke = 1: Alternate day aspirin]                          0.37      0.11      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.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.03      0.09      0.10      0.18
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.45      0.33      0.11      0.05
#> 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.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.32      0.19
#>                                                          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.08      0.05      0.03
#> d[stroke = 1: Dipyridamole]                                   0.01      0.04      0.08      0.11
#> d[stroke = 1: Fixed dose warfarin]                            0.18      0.25      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.11      0.11      0.08
#> d[stroke = 1: Indobufen]                                      0.25      0.17      0.08      0.04
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.03      0.01      0.00      0.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.02      0.04      0.08
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.07      0.13      0.19      0.16
#> d[stroke = 1: Medium dose aspirin]                            0.01      0.06      0.17      0.26
#> d[stroke = 1: Placebo/Standard care]                          0.00      0.01      0.02      0.05
#> d[stroke = 1: Triflusal]                                      0.02      0.03      0.05      0.05
#> d[stroke = 1: Ximelagatran]                                   0.10      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.02       0.01       0.02
#> d[stroke = 1: Alternate day aspirin]                          0.03       0.02       0.02       0.02
#> d[stroke = 1: Dipyridamole]                                   0.11       0.13       0.12       0.13
#> d[stroke = 1: Fixed dose warfarin]                            0.07       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.06       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.05       0.11       0.19       0.23
#> d[stroke = 1: Low dose aspirin + copidogrel]                  0.10       0.12       0.16       0.16
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.11       0.09       0.07       0.06
#> d[stroke = 1: Medium dose aspirin]                            0.23       0.14       0.06       0.03
#> d[stroke = 1: Placebo/Standard care]                          0.12       0.18       0.20       0.17
#> d[stroke = 1: Triflusal]                                      0.06       0.06       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.04       0.45
#> d[stroke = 1: Alternate day aspirin]                           0.02       0.03       0.01
#> d[stroke = 1: Dipyridamole]                                    0.12       0.10       0.02
#> d[stroke = 1: Fixed dose warfarin]                             0.03       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.00       0.02       0.25
#> d[stroke = 1: High dose aspirin]                               0.09       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.22       0.11       0.04
#> d[stroke = 1: Low dose aspirin + copidogrel]                   0.16       0.10       0.03
#> d[stroke = 1: Low dose aspirin + dipyridamole]                 0.04       0.02       0.01
#> d[stroke = 1: Medium dose aspirin]                             0.02       0.01       0.00
#> d[stroke = 1: Placebo/Standard care]                           0.14       0.07       0.02
#> d[stroke = 1: Triflusal]                                       0.13       0.34       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.06
#> d[stroke = 1: Alternate day aspirin]                           0.00       0.00
#> d[stroke = 1: Dipyridamole]                                    0.02       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.17
#> 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.03
#> d[stroke = 0: Acenocoumarol]                                  0.25      0.50      0.63      0.72
#> d[stroke = 0: Alternate day aspirin]                          0.45      0.59      0.68      0.74
#> 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.04      0.14      0.25      0.36
#> d[stroke = 0: High dose aspirin]                              0.03      0.09      0.17      0.25
#> d[stroke = 0: Indobufen]                                      0.17      0.42      0.62      0.76
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.04      0.19      0.40      0.61
#> 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.01      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.10      0.26      0.46      0.66
#> d[stroke = 0: Acenocoumarol]                                  0.78      0.82      0.85      0.88
#> d[stroke = 0: Alternate day aspirin]                          0.78      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.06
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.09      0.14      0.19      0.25
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.46      0.53      0.58      0.63
#> d[stroke = 0: High dose aspirin]                              0.31      0.36      0.40      0.45
#> d[stroke = 0: Indobufen]                                      0.85      0.89      0.92      0.94
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.75      0.84      0.90      0.93
#> d[stroke = 0: Low dose aspirin]                               0.00      0.00      0.01      0.02
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.02      0.04      0.07      0.10
#> d[stroke = 0: Low dose aspirin + dipyridamole]                0.33      0.43      0.52      0.59
#> d[stroke = 0: Medium dose aspirin]                            0.07      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.06      0.08      0.11      0.15
#> d[stroke = 0: Ximelagatran]                                   0.31      0.48      0.63      0.76
#>                                                          p_rank[9] p_rank[10] p_rank[11] p_rank[12]
#> d[stroke = 0: Standard adjusted dose anti-coagulant]          0.84       0.93       0.98       1.00
#> 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.32       0.41       0.51       0.61
#> d[stroke = 0: Fixed dose warfarin]                            0.09       0.13       0.19       0.25
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]         0.31       0.41       0.50       0.61
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]      0.69       0.74       0.79       0.84
#> d[stroke = 0: High dose aspirin]                              0.50       0.54       0.59       0.64
#> d[stroke = 0: Indobufen]                                      0.95       0.97       0.98       0.98
#> d[stroke = 0: Low adjusted dose anti-coagulant]               0.96       0.98       0.99       0.99
#> d[stroke = 0: Low dose aspirin]                               0.05       0.10       0.21       0.38
#> d[stroke = 0: Low dose aspirin + copidogrel]                  0.17       0.26       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.82       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.27       0.33
#> d[stroke = 0: Ximelagatran]                                   0.84       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.97       0.99
#> d[stroke = 0: Alternate day aspirin]                           0.92       0.94       0.96
#> d[stroke = 0: Dipyridamole]                                    0.71       0.79       0.88
#> d[stroke = 0: Fixed dose warfarin]                             0.33       0.43       0.55
#> d[stroke = 0: Fixed dose warfarin + low dose aspirin]          0.70       0.80       0.88
#> d[stroke = 0: Fixed dose warfarin + medium dose aspirin]       0.87       0.90       0.94
#> d[stroke = 0: High dose aspirin]                               0.69       0.73       0.79
#> 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.59       0.79       0.92
#> d[stroke = 0: Low dose aspirin + copidogrel]                   0.68       0.80       0.89
#> d[stroke = 0: Low dose aspirin + dipyridamole]                 0.91       0.95       0.97
#> d[stroke = 0: Medium dose aspirin]                             0.98       0.99       1.00
#> d[stroke = 0: Placebo/Standard care]                           0.29       0.47       0.70
#> d[stroke = 0: Triflusal]                                       0.39       0.46       0.54
#> 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.97          1
#> d[stroke = 0: Dipyridamole]                                    0.95          1
#> d[stroke = 0: Fixed dose warfarin]                             0.76          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.87          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.69          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.13      0.47      0.82
#> d[stroke = 1: Acenocoumarol]                                  0.04      0.06      0.07      0.08
#> d[stroke = 1: Alternate day aspirin]                          0.37      0.47      0.52      0.59
#> d[stroke = 1: Dipyridamole]                                   0.00      0.00      0.00      0.01
#> d[stroke = 1: Fixed dose warfarin]                            0.00      0.02      0.04      0.10
#> 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.03      0.12      0.22      0.41
#> d[stroke = 1: Low adjusted dose anti-coagulant]               0.45      0.79      0.89      0.95
#> 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.07      0.35      0.66      0.85
#>                                                          p_rank[5] p_rank[6] p_rank[7] p_rank[8]
#> d[stroke = 1: Standard adjusted dose anti-coagulant]          0.96      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.68      0.75      0.81      0.84
#> d[stroke = 1: Dipyridamole]                                   0.02      0.06      0.14      0.25
#> d[stroke = 1: Fixed dose warfarin]                            0.29      0.53      0.68      0.77
#> 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.01      0.01      0.02      0.02
#> d[stroke = 1: High dose aspirin]                              0.16      0.27      0.38      0.45
#> d[stroke = 1: Indobufen]                                      0.66      0.83      0.91      0.95
#> 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.04
#> 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.60
#> d[stroke = 1: Medium dose aspirin]                            0.01      0.07      0.25      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.95      0.99      1.00      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.17       0.19       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.48       0.60       0.73
#> d[stroke = 1: Fixed dose warfarin]                            0.84       0.88       0.91       0.94
#> d[stroke = 1: Fixed dose warfarin + low dose aspirin]         0.06       0.06       0.07       0.08
#> d[stroke = 1: Fixed dose warfarin + medium dose aspirin]      0.03       0.03       0.04       0.05
#> d[stroke = 1: High dose aspirin]                              0.52       0.58       0.64       0.70
#> d[stroke = 1: Indobufen]                                      0.97       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.24       0.37       0.52       0.69
#> d[stroke = 1: Low dose aspirin + dipyridamole]                0.72       0.81       0.87       0.93
#> d[stroke = 1: Medium dose aspirin]                            0.74       0.88       0.95       0.98
#> d[stroke = 1: Placebo/Standard care]                          0.20       0.38       0.58       0.75
#> d[stroke = 1: Triflusal]                                      0.20       0.26       0.32       0.39
#> 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.29       0.74
#> 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.97       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.05       0.07       0.33
#> d[stroke = 1: High dose aspirin]                               0.79       0.92       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.84       0.95       0.98
#> d[stroke = 1: Low dose aspirin + copidogrel]                   0.85       0.95       0.98
#> d[stroke = 1: Low dose aspirin + dipyridamole]                 0.97       0.99       0.99
#> d[stroke = 1: Medium dose aspirin]                             0.99       1.00       1.00
#> d[stroke = 1: Placebo/Standard care]                           0.90       0.96       0.99
#> d[stroke = 1: Triflusal]                                       0.52       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.94          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.83          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.6 (on 61 data points)
#>                pD: 48.7
#>               DIC: 109.2
(af_dic_4b <- dic(af_fit_4b))
#> Residual deviance: 58.3 (on 61 data points)
#>                pD: 47.6
#>               DIC: 105.9

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)