```
#> 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 smoking cessation data (Hasselblad 1998), replicating the analysis in NICE Technical Support Document 4 (Dias et al. 2011). The data are available in this package as `smoking`

:

```
head(smoking)
#> studyn trtn trtc r n
#> 1 1 1 No intervention 9 140
#> 2 1 3 Individual counselling 23 140
#> 3 1 4 Group counselling 10 138
#> 4 2 2 Self-help 11 78
#> 5 2 3 Individual counselling 12 85
#> 6 2 4 Group counselling 29 170
```

We begin by setting up the network. We have arm-level count data giving the number quitting smoking (`r`

) out of the total (`n`

) in each arm, so we use the function `set_agd_arm()`

. Treatment “No intervention” is set as the network reference treatment.

```
smknet <- set_agd_arm(smoking,
study = studyn,
trt = trtc,
r = r,
n = n,
trt_ref = "No intervention")
smknet
#> A network with 24 AgD studies (arm-based).
#>
#> ------------------------------------------------------- AgD studies (arm-based) ----
#> Study Treatments
#> 1 3: No intervention | Individual counselling | Group counselling
#> 2 3: Self-help | Individual counselling | Group counselling
#> 3 2: No intervention | Individual counselling
#> 4 2: No intervention | Individual counselling
#> 5 2: No intervention | Individual counselling
#> 6 2: No intervention | Individual counselling
#> 7 2: No intervention | Individual counselling
#> 8 2: No intervention | Individual counselling
#> 9 2: No intervention | Individual counselling
#> 10 2: No intervention | Self-help
#> ... plus 14 more studies
#>
#> Outcome type: count
#> ------------------------------------------------------------------------------------
#> Total number of treatments: 4
#> Total number of studies: 24
#> Reference treatment is: No intervention
#> Network is connected
```

Plot the network structure.

Following TSD 4, we fit a random effects NMA 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 distribution for the between-study 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.
```

The model is fitted using the `nma()`

function. By default, this will use a Binomial likelihood and a logit link function, auto-detected from the data.

```
smkfit <- nma(smknet,
trt_effects = "random",
prior_intercept = normal(scale = 100),
prior_trt = normal(scale = 100),
prior_het = normal(scale = 5))
```

Basic parameter summaries are given by the `print()`

method:

```
smkfit
#> 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% 75% 97.5% n_eff
#> d[Group counselling] 1.12 0.01 0.44 0.27 0.84 1.10 1.40 2.02 1821
#> d[Individual counselling] 0.85 0.01 0.24 0.42 0.70 0.85 1.00 1.35 1056
#> d[Self-help] 0.52 0.01 0.41 -0.27 0.26 0.51 0.78 1.38 1732
#> lp__ -5768.09 0.19 6.45 -5781.44 -5772.24 -5767.93 -5763.48 -5756.37 1168
#> tau 0.84 0.01 0.19 0.55 0.71 0.82 0.95 1.29 1248
#> Rhat
#> d[Group counselling] 1
#> d[Individual counselling] 1
#> d[Self-help] 1
#> lp__ 1
#> tau 1
#>
#> Samples were drawn using NUTS(diag_e) at Tue Jun 23 16:20:18 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:

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

function:

By default, this displays all model parameters given prior distributions (in this case \(d_k\), \(\mu_j\), and \(\tau\)), but this may be changed using the `prior`

argument:

Model fit can be checked using the `dic()`

function

```
(dic_consistency <- dic(smkfit))
#> Residual deviance: 54.1 (on 50 data points)
#> pD: 44.2
#> DIC: 98.3
```

and the residual deviance contributions examined with the corresponding `plot()`

method

Overall model fit seems to be adequate, with almost all points showing good fit (mean residual deviance contribution of 1). The only two points with higher residual deviance (i.e. worse fit) correspond to the two zero counts in the data:

We fit an unrelated mean effects (UME) model (Dias et al. 2011) to assess the consistency assumption. Again, we use the function `nma()`

, but now with the argument `consistency = "ume"`

.

```
smkfit_ume <- nma(smknet,
consistency = "ume",
trt_effects = "random",
prior_intercept = normal(scale = 100),
prior_trt = normal(scale = 100),
prior_het = normal(scale = 5))
smkfit_ume
#> A random effects NMA with a binomial likelihood (logit link).
#> An inconsistency model ('ume') was fitted.
#> 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[Group counselling vs. No intervention] 1.12 0.01 0.79 -0.34 0.58 1.11
#> d[Individual counselling vs. No intervention] 0.90 0.01 0.28 0.37 0.72 0.89
#> d[Self-help vs. No intervention] 0.35 0.01 0.61 -0.85 -0.04 0.35
#> d[Individual counselling vs. Group counselling] -0.29 0.01 0.62 -1.53 -0.68 -0.29
#> d[Self-help vs. Group counselling] -0.63 0.01 0.72 -2.00 -1.09 -0.64
#> d[Self-help vs. Individual counselling] 0.12 0.02 1.07 -1.97 -0.57 0.13
#> lp__ -5765.13 0.19 6.38 -5778.65 -5769.14 -5764.64
#> tau 0.94 0.01 0.23 0.59 0.78 0.91
#> 75% 97.5% n_eff Rhat
#> d[Group counselling vs. No intervention] 1.62 2.81 2963 1
#> d[Individual counselling vs. No intervention] 1.07 1.48 1232 1
#> d[Self-help vs. No intervention] 0.75 1.58 2178 1
#> d[Individual counselling vs. Group counselling] 0.11 0.94 2478 1
#> d[Self-help vs. Group counselling] -0.16 0.80 2718 1
#> d[Self-help vs. Individual counselling] 0.83 2.20 3081 1
#> lp__ -5760.55 -5754.01 1111 1
#> tau 1.07 1.47 1280 1
#>
#> Samples were drawn using NUTS(diag_e) at Tue Jun 23 16:20:53 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).
```

Comparing the model fit statistics

```
dic_consistency
#> Residual deviance: 54.1 (on 50 data points)
#> pD: 44.2
#> DIC: 98.3
(dic_ume <- dic(smkfit_ume))
#> Residual deviance: 53.5 (on 50 data points)
#> pD: 44.9
#> DIC: 98.4
```

We see that there is little to choose between the two models. However, it is also important to examine the individual contributions to model fit of each data point under the two models (a so-called “dev-dev” plot). Passing two `nma_dic`

objects produced by the `dic()`

function to the `plot()`

method produces this dev-dev plot:

All points lie roughly on the line of equality, so there is no evidence for inconsistency here.

Pairwise relative effects, for all pairwise contrasts with `all_contrasts = TRUE`

.

```
(smk_releff <- relative_effects(smkfit, all_contrasts = TRUE))
#> mean sd 2.5% 25% 50% 75% 97.5% Bulk_ESS
#> d[Group counselling vs. No intervention] 1.12 0.44 0.27 0.84 1.10 1.40 2.02 1913
#> d[Individual counselling vs. No intervention] 0.85 0.24 0.42 0.70 0.85 1.00 1.35 1097
#> d[Self-help vs. No intervention] 0.52 0.41 -0.27 0.26 0.51 0.78 1.38 1748
#> d[Individual counselling vs. Group counselling] -0.27 0.41 -1.09 -0.53 -0.27 0.00 0.53 2748
#> d[Self-help vs. Group counselling] -0.60 0.50 -1.60 -0.93 -0.59 -0.29 0.40 2452
#> d[Self-help vs. Individual counselling] -0.34 0.42 -1.15 -0.60 -0.34 -0.07 0.51 2145
#> Tail_ESS Rhat
#> d[Group counselling vs. No intervention] 1888 1
#> d[Individual counselling vs. No intervention] 1536 1
#> d[Self-help vs. No intervention] 2192 1
#> d[Individual counselling vs. Group counselling] 2631 1
#> d[Self-help vs. Group counselling] 2642 1
#> d[Self-help vs. Individual counselling] 2281 1
plot(smk_releff, ref_line = 0)
```

Treatment rankings, rank probabilities, and cumulative rank probabilities. We set `lower_better = FALSE`

since a higher log odds of cessation is better (the outcome is positive).

```
(smk_ranks <- posterior_ranks(smkfit, lower_better = FALSE))
#> mean sd 2.5% 25% 50% 75% 97.5% Bulk_ESS Tail_ESS Rhat
#> rank[No intervention] 3.90 0.31 3 4 4 4 4 2241 NA 1
#> rank[Group counselling] 1.36 0.62 1 1 1 2 3 3065 3192 1
#> rank[Individual counselling] 1.94 0.62 1 2 2 2 3 2758 3099 1
#> rank[Self-help] 2.80 0.70 1 3 3 3 4 2361 NA 1
plot(smk_ranks)
```

```
(smk_rankprobs <- posterior_rank_probs(smkfit, lower_better = FALSE))
#> p_rank[1] p_rank[2] p_rank[3] p_rank[4]
#> d[No intervention] 0.00 0.00 0.10 0.9
#> d[Group counselling] 0.71 0.22 0.06 0.0
#> d[Individual counselling] 0.22 0.61 0.17 0.0
#> d[Self-help] 0.07 0.17 0.67 0.1
plot(smk_rankprobs)
```

```
(smk_cumrankprobs <- posterior_rank_probs(smkfit, lower_better = FALSE, cumulative = TRUE))
#> p_rank[1] p_rank[2] p_rank[3] p_rank[4]
#> d[No intervention] 0.00 0.00 0.1 1
#> d[Group counselling] 0.71 0.93 1.0 1
#> d[Individual counselling] 0.22 0.83 1.0 1
#> d[Self-help] 0.07 0.23 0.9 1
plot(smk_cumrankprobs)
```

Dias, S., N. J. Welton, A. J. Sutton, D. M. Caldwell, G. Lu, and A. E. Ades. 2011. “NICE DSU Technical Support Document 4: Inconsistency in Networks of Evidence Based on Randomised Controlled Trials.” National Institute for Health and Care Excellence. http://www.nicedsu.org.uk.

Hasselblad, Vic. 1998. “Meta-Analysis of Multitreatment Studies.” *Medical Decision Making* 18 (1): 37–43. https://doi.org/10.1177/0272989x9801800110.