Tutorial on R package **mtrank**

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "##",
  message = TRUE,
  warning = FALSE
  )
options(knitr.kable.NA = ".")

This vignette serves as a tutorial for R package mtrank. This package allows R users to produce treatment hierarchies in network meta-analysis using the ranking method proposed by @Evre:Niko:Schw:prod:2024.

You could either install R package mtrank from CRAN

install.packages("mtrank")

or the development version from GitHub

remotes::install_github("TEvrenoglou/mtrank")

Next, we make the package available.

library("mtrank")

We see that loading mtrank will automatically load the R packages meta, metadat and netmeta.

Next, we load the 'antidepressants' dataset which is part of R package mtrank and conduct a network meta-analysis. You can get information about this dataset using the command help(antidepressants).

data("antidepressants")
#
pw <- pairwise(studlab = studyid, treat = drug_name,
  n = ntotal, event = responders,
  data = antidepressants, sm = "OR")
#
net <- netmeta(pw, reference.group = "tra")

Define treatment-choice criterion

In the next step, we set the treatment-choice criterion and get treatment preferences from NMA estimates using the function tcc(). More details about this function can be obtained using the command help(tcc).

The treatment-choice criterion is determined by the smallest worthwhile difference (SWD), which represents the smallest relative effect between two treatments that can influence the selection of the preferable treatment. Users can set this value using argument 'swd' in tcc(), which then defines the range of equivalence (ROE) based on the swd and its reciprocal. For binary outcomes, the swd must be specified on its natural scale. The ROE constructed using the swd is always symmetrical, but for users who require a non-symmetrical ROE, the arguments 'swd.below.null' and 'swd.above.null' allow for explicit specification of preferred bounds. However, if argument 'swd' is specified, arguments 'swd.below.null' and 'swd.above.null' are ignored.

ranks <- tcc(net, swd = 1.25, small.values = "undesirable")

We could print the preferences with the following command (result not shown).

ranks$preferences

As argument 'swd = 1.25' the ROE is defined as [1 / swd, swd] = [0.8, 1.25]. The ROE is stored as the lower and upper bound.

c(ranks$swd.below.null, ranks$swd.above.null)

Alternatively, we could define a ROE by specifying its lower and upper bound.

ranks <- tcc(net, swd.below = 0.80, swd.above = 1.25,
  small.values = "undesirable")

Note, an asymmetric ROE could be defined in this way.

Forest plot showing impact of treatment choice criterion

R function forest.tcc() can be used to create a forest plot. This function gets as first argument the object created from tcc() and as second the argument 'reference.group' which specifies the treatment for which the treatment choice criterion needs to be inspected. If users do not specify the argument 'treat' then forest plots are generated for every direct comparison in the network.

forest(ranks, xlim = c(-1, 2),
  reference.group = "bupropion", baseline.reference = FALSE,
  label.left = "Favors other drug",
  label.right = "Favors bupropion",
  fill.equi = "lightblue", spacing = 1.5)
forest(ranks, xlim = c(-1, 2),
  reference.group = "bupropion", baseline.reference = FALSE,
  label.left = "Favors other drug",
  label.right = "Favors bupropion",
  fill.equi = "lightblue", spacing = 1.5,
  file = "forest1.pdf")
knitr::include_graphics("forest1.pdf")

Probabilistic ranking model

The probabilistic ranking model can be fitted using mtrank() from R package mtrank. The ability estimates obtained from mtrank() can then be visualised in a forest plot.

fit <- mtrank(ranks)

We can print the ability estimates and the probabilities of each treatment to rank first.

fit

Forest plot of log-ability estimates

R function forest.mtrank() can be used to create a forest plot of ability estimates. By default, log-ability estimates are shown in the forest plot.

forest(fit)
forest(fit, file = "forest2.pdf")
knitr::include_graphics("forest2.pdf")

Alternatively, we could plot the abilities using argument 'backtransf' (figure not shown).

forest(fit, backtransf = TRUE)

Sensitivity analysis

Given the subjectivity of the choice of the SWD value which determines the TCC, it is natural one to investigate the robustness of the treatment hierarchy under different SWD values. The R package mtrank allows for such a sensitivity analysis to be performed and presented in a linegraph through the function linegraph(). This function takes the following arguments:

For more details about this function please use help(linegraph).

# Perform a sensitivity analysis across different swd values assuming that 1.20 is the reference value
swd.vec <- seq(1.10, 1.50, by = 0.10)
swd.ref <- 1.20
# plot all the treatments in the network
linegraph(fit, swd = swd.vec, swd.ref = swd.ref)
# plot only the first six treatments in the order appearing at the 'swd.ref' value
linegraph(fit, swd = swd.vec, swd.ref = swd.ref, k = 6)
# plot in terms of ability estimates 
linegraph(fit, swd = swd.vec, swd.ref = swd.ref, type = "ability")

Fitted probabilities

Finally, R package mtrank allows the calculation of pairwise preferences through the function fitted(). This function expects the following arguments:

For more details about this function please use help(fitted.mtrank).

# Get probability fitted probabilities for comparison bupropion vs trazodone
fitted(fit, treat1 = "bupropion", treat2 = "trazodone",
  type = "all")

It is also possible to contrast one drug with several others (and to provide abbreviated but unambiguous drug names).

# Get probability that bupropion is better than other drugs
fitted(fit, treat1 = "bupr",
  treat2 = c("fluo", "paro", "sert", "traz", "venl"), type = "all")

References



Try the mtrank package in your browser

Any scripts or data that you put into this service are public.

mtrank documentation built on June 8, 2025, 11:12 a.m.