Author: Hugo Pedder
Date: 2025-02-06

# MBNMAdose: Exploring the data

#### Hugo Pedder

#### 2025-02-06

## Exploring the data

Before embarking on an analysis, the first step is to have a look at the raw data. Two features (network connectivity and dose-response relationship) are particularly important for MBNMA. For this we want to get our dataset into the right format for the package. We can do this using `mbnma.network()`.

    # Using the triptans dataset
    network <- mbnma.network(triptans)
    #> Values for `agent` with dose = 0 have been recoded to `Placebo`
    #> agent is being recoded to enforce sequential numbering
    summary(network)
    #> Description: Network
    #> Number of studies: 70
    #> Number of treatments: 23
    #> Number of agents: 8
    #> Median (min, max) doses per agent (incl placebo): 4 (3, 6)
    #> Agent-level network is CONNECTED
    #> Ttreatment-level network is CONNECTED

This function takes a dataset with the columns:

- `studyID` Study identifiers
- `agent` Agent identifiers (can be character, factor or numeric)
- `dose` Numeric data indicating the dose of the given agent within the study arm
- `class` An optional column indicating a particular class code. Agents with the same name/identifier must also have the same class code.

Depending on the type of data (and the likelihood) the following columns are required:

- Normal likelihood
  - `y` Numeric data indicating the mean response for a given study arm
  - `se` Numeric data indicating the standard error for a given study arm
- Binomial likelihood
  - `r` Numeric data indicating the number of responders in a given study arm
  - `n` Numeric data indicating the total number of participants in a given study arm
- Poisson likelihood
  - `r` Numeric data indicating the number of events in a given study arm
  - `E` Numeric data indicating the total exposure time in a given study arm

It then performs the following checks on the data:

- The dataset has the required column names
- There are no missing values
- All doses are positive
- All SE, r, N and E are positive
- Class labels are consistent within each agent
- Studies have at least two arms
- Studies do not only compare the same agent at the same dose

Finally it converts the data frame into an object of `class("mbnma.network")`, which contains indices for study arms, numeric variables for treatments, agents and classes, and stores a vector of treatment, agent and class names as an element within the object. By convention, agents are numbered alphabetically, though if the original data for agents is provided as a factor then the factor codes will be used. This then contains all the necessary information for subsequent `MBNMAdose` functions.

### Examining network connectivity

Examining how the evidence in the network is connected and identifying which studies compare which treatments/agents helps to understand which effects can be estimated, what information will be helping to inform those estimates, and whether linking via the dose-response relationship is possible if the network is disconnected at the treatment-level. The complexity of dose-response relationships that can be estimated is dependent on the number of doses of each agent available, so this is also important to know.

Network plots can be plotted which shows which treatments/agents have been compared in head-to-head trials. Typically the thickness of connecting lines (“edges”) is proportional to the number of studies that make a particular comparison and the size of treatment nodes (“vertices”) is proportional to the total number of patients in the network who were randomised to a given treatment/agent (provided `N` is included as a variable in the original dataset for `mbnma.network()`).

In `MBNMAdose` these plots are generated using `igraph`, and can be plotted by calling `plot()`. The generated plots are objects of `class("igraph")` meaning that, in addition to the options specified in `plot()`, various `igraph` functions can subsequently be used to make more detailed edits to them.

Within these network plots, vertices are automatically aligned in a circle (as the default) and can be tidied by shifting the label distance away from the nodes.

    # Prepare data using the triptans dataset
    tripnet <- mbnma.network(triptans)
    #> Values for `agent` with dose = 0 have been recoded to `Placebo`
    #> agent is being recoded to enforce sequential numbering
    summary(tripnet)
    #> Description: Network
    #> Number of studies: 70
    #> Number of treatments: 23
    #> Number of agents: 8
    #> Median (min, max) doses per agent (incl placebo): 4 (3, 6)
    #> Agent-level network is CONNECTED
    #> Ttreatment-level network is CONNECTED

    # Draw network plot
    plot(tripnet)

If some vertices are not connected to the network reference treatment through any pathway of head-to-head evidence, a warning will be given. The nodes that are coloured white represent these disconnected vertices.

    # Prepare data using the gout dataset
    goutnet <- mbnma.network(gout)
    summary(goutnet)
    #> Description: Network
    #> Number of studies: 10
    #> Number of treatments: 19
    #> Number of agents: 6
    #> Median (min, max) doses per agent (incl placebo): 5 (3, 6)
    #> Agent-level network is DISCONNECTED
    #> Treatment-level network is DISCONNECTED

    plot(goutnet, label.distance = 5)
    #> Warning in check.network(g): The following treatments/agents are not connected
    #> to the network reference:
    #> Allo_245
    #> Allo_256
    #> Allo_300
    #> Allo_400
    #> Benz_50
    #> Benz_139
    #> Benz_143
    #> Benz_200
    #> Febu_40
    #> Febu_80
    #> Febu_120
    #> RDEA_100
    #> RDEA_200
    #> RDEA_400

However, whilst at the treatment-level (specific dose of a specific agent), many of these vertices are disconnected, at the agent level they are connected (via different doses of the same agent), meaning that via the dose-response relationship it is possible to estimate results.

    # Plot at the agent-level
    plot(goutnet, level = "agent", label.distance = 6)
    #> Warning in check.network(g): The following treatments/agents are not connected
    #> to the network reference:
    #> RDEA

One agent (RDEA) is still not connected to the network, but `MBNMAdose` allows agents to connect via a placebo response even if they do not include placebo in a head-to-head trial (see [Linking disconnected treatments via the dose-response relationship]).

    # Plot connections to placebo via a two-parameter dose-response function (e.g.
    # Emax)
    plot(goutnet, level = "agent", doselink = 2, remove.loops = TRUE, label.distance = 6)
    #> Dose-response connections to placebo plotted based on a dose-response
    #>                    function with 1 degrees of freedom

It is also possible to plot a network at the treatment level but to colour the doses by the agent that they belong to.

    # Colour vertices by agent
    plot(goutnet, v.color = "agent", label.distance = 5)
    #> Warning in check.network(g): The following treatments/agents are not connected
    #> to the network reference:
    #> Allo_245
    #> Allo_256
    #> Allo_300
    #> Allo_400
    #> Benz_50
    #> Benz_139
    #> Benz_143
    #> Benz_200
    #> Febu_40
    #> Febu_80
    #> Febu_120
    #> RDEA_100
    #> RDEA_200
    #> RDEA_400

Several further options exist to allow for inclusion of disconnected treatments, such as assuming some sort of common effect among agents within the same class. This is discussed in more detail later in the vignette.

### Examining the dose-response relationship

In order to consider which functional forms may be appropriate for modelling the dose-response relationship, it is useful to look at results from a “split” network meta-analysis (NMA), in which each dose of an agent is considered as separate and unrelated (i.e. we are not assuming any dose-response relationship). The `nma.run()` function performs a simple NMA, and by default it drops studies that are disconnected at the treatment-level (since estimates for these will be very uncertain if included).

    # Run a random effect split NMA using the alogliptin dataset
    alognet <- mbnma.network(alog_pcfb)
    nma.alog <- nma.run(alognet, method = "random")

    print(nma.alog)
    #> $jagsresult
    #> Inference for Bugs model at "C:\Users\hp17602\AppData\Local\Temp\Rtmpesrqof\file80a458c727e6", fit using jags,
    #>  3 chains, each with 20000 iterations (first 10000 discarded), n.thin = 10
    #>  n.sims = 3000 iterations saved. Running time = 2.45 secs
    #>            mu.vect sd.vect     2.5%      25%      50%      75%    97.5%  Rhat
    #> d[1]         0.000   0.000    0.000    0.000    0.000    0.000    0.000 1.000
    #> d[2]        -0.456   0.089   -0.626   -0.518   -0.457   -0.397   -0.277 1.001
    #> d[3]        -0.655   0.047   -0.747   -0.686   -0.655   -0.625   -0.560 1.001
    #> d[4]        -0.710   0.046   -0.799   -0.739   -0.711   -0.681   -0.617 1.001
    #> d[5]        -0.758   0.086   -0.925   -0.813   -0.759   -0.705   -0.588 1.001
    #> d[6]        -0.688   0.166   -1.013   -0.801   -0.693   -0.577   -0.364 1.002
    #> sd           0.124   0.029    0.075    0.104    0.121    0.141    0.186 1.001
    #> totresdev   47.051   9.757   30.348   40.212   46.359   53.128   68.306 1.001
    #> deviance  -124.263   9.757 -140.966 -131.102 -124.955 -118.186 -103.008 1.001
    #>           n.eff
    #> d[1]          1
    #> d[2]       2200
    #> d[3]       3000
    #> d[4]       3000
    #> d[5]       3000
    #> d[6]       1100
    #> sd         2600
    #> totresdev  3000
    #> deviance   3000
    #>
    #> For each parameter, n.eff is a crude measure of effective sample size,
    #> and Rhat is the potential scale reduction factor (at convergence, Rhat=1).
    #>
    #> DIC info (using the rule: pV = var(deviance)/2)
    #> pV = 47.6 and DIC = -76.7
    #> DIC is an estimate of expected predictive error (lower deviance is better).
    #>
    #> $trt.labs
    #> [1] "Placebo_0"       "alogliptin_6.25" "alogliptin_12.5" "alogliptin_25"
    #> [5] "alogliptin_50"   "alogliptin_100"
    #>
    #> $UME
    #> [1] FALSE
    #>
    #> attr(,"class")
    #> [1] "nma"

    # Draw plot of NMA estimates plotted by dose
    plot(nma.alog)

In the alogliptin dataset there appears to be a dose-response relationship, and it also appears to be non-linear.

One additional use of `nma.run()` is that is can be used after fitting an MBNMA to ensure that fitting a dose-response function is not leading to poorer model fit than when conducting a conventional NMA. Comparing the total residual deviance between NMA and MBNMA models is useful to identify if introducing a dose-response relationship is leading to poorer model fit. However, it is important to note that if treatments are disconnected in the NMA and have been dropped (`drop.discon=TRUE`), there will be fewer observations present in the dataset, which will subsequently lead to lower pD and lower residual deviance, meaning that model fit statistics from NMA and MBNMA may not be directly comparable.

## References