mbnma.network: Create an mbnma.network object

Description Usage Arguments Details Value Methods (by generic) Examples

View source: R/prepare.functions.R

Description

Creates an object of class mbnma.network. Various MBNMA functions can subsequently be applied to this object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## S3 method for class 'mbnma.network'
plot(
  x,
  level = "treatment",
  v.color = "connect",
  doselink = NULL,
  layout = igraph::in_circle(),
  remove.loops = FALSE,
  edge.scale = 1,
  v.scale = NULL,
  label.distance = 0,
  legend = TRUE,
  legend.x = "bottomleft",
  legend.y = NULL,
  ...
)

mbnma.network(data.ab, description = "Network")

Arguments

x

An object of class mbnma.network.

level

A string indicating whether nodes/facets should represent "treatment" or "agent" in the plot. Can be used to examine the expected impact of modelling dose-response in terms of network connectivity.

v.color

Can take either "connect" (the default) to indicate that nodes should only be coloured if they are connected to the network reference treatment (indicates network connectivity) or "agent" to colour nodes by agent.

doselink

If given an integer value it indicates that connections via the dose-response relationship with placebo should be plotted. The integer represents the minimum number of doses from which a dose-response function could be estimated and is equivalent to the number of parameters in the desired dose-response function plus one. If left as NULL (the default), connections to placebo via dose-response relationships will not be included.

layout

An igraph layout specification. This is a function specifying an igraph layout that determines the arrangement of the vertices (nodes). The default igraph::as_circle() arranged vertices in a circle. Two other useful layouts for network plots are: igraph::as_star(), igraph::with_fr(). Others can be found in layout_

remove.loops

A boolean value indicating whether to include loops that indicate comparisons within a node.

edge.scale

A number to scale the thickness of connecting lines (edges). Line thickness is proportional to the number of studies for a given comparison. Set to 0 to make thickness equal for all comparisons.

v.scale

A number with which to scale the size of the nodes. If the variable N (to indicate the numbers of participants in each study arm) is included in the dataset then the size of the nodes will be proportional to the number of participants within a treatment/agent in the network.

label.distance

A number scaling the distance of labels from the nodes to improve readability. The labels will be directly on top of the nodes if the default of 0 is used. Option only applicable if layout_in_circle is set to TRUE.

legend

A boolean object to indicate whether or not to plot a legend to indicate which node colour corresponds to which agent if v.color="agent". Default is TRUE.

legend.x, legend.y

The x and y co-ordinates to be used to position the legend. They can be specified by keyword or in any way which is accepted by xy.coords.

...

Options for plotting in igraph.

data.ab

A data frame of arm-level data in "long" format containing the columns:

  • studyID Study identifiers

  • dose Numeric data indicating the dose (must take positive values)

  • agent Agent identifiers (can be numeric, factor or character)

  • y Numeric data indicating the aggregate response for a continuous outcome. Required for continuous data.

  • se Numeric data indicating the standard error for a given observation. Required for continuous data.

  • r Numeric data indicating the number of responders within a study arm. Required for binomial or poisson data.

  • N Numeric data indicating the total number of participants within a study arm. Required for binomial data

  • E Numeric data indicating the total exposure time for participants within a study arm. Required for poisson data.

  • class An optional column indicating a particular class code. Agents with the same identifier must also have the same class code.

description

Optional. Short description of the network.

Details

The S3 method plot() on an mbnma.network object generates a network plot that shows how different treatments are connected within the network via study comparisons. This can be used to identify how direct and indirect evidence are informing different treatment comparisons. Depends on igraph.

Agents/classes for arms that have dose = 0 will be relabelled as "Placebo". Missing values (NA) cannot be included in the dataset. Single arm studies cannot be included.

Value

plot(): An object of class("igraph") - any functions from the igraph package can be applied to this object to change its characteristics.

mbnma.network(): An object of class("mbnma.network") which is a list containing:

Methods (by generic)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Create an mbnma.network object from the data
network <- mbnma.network(HF2PPITT)

# Generate a network plot from the data
plot(network)

# Generate a network plot at the agent level that removes loops indicating comparisons
#within a node
plot(network, level="agent", remove.loops=TRUE)

# Generate a network plot at the treatment level that colours nodes by agent
plot(network, v.color="agent", remove.loops=TRUE)

# Generate a network plot that includes connections via the dose-response function
# For a one parameter dose-response function (e.g. exponential)
plot(network, level="treatment", doselink=1, remove.loops=TRUE)

# For a two parameter dose-response function (e.g. Emax)
plot(network, level="treatment", doselink=2, remove.loops=TRUE)

# Arrange network plot in a star with the reference treatment in the centre
plot(network, layout=igraph::as_star(), label.distance=3)

#### Plot a network with no placebo data included ####
# Make data with no placebo
noplac.df <- network$data.ab[network$data.ab$narm>2 & network$data.ab$agent!=1,]
net.noplac <- mbnma.network(noplac.df)

# Plotting network automatically plots connections to Placebo via dose-response
plot(net.noplac)
# Using the triptans headache dataset
print(HF2PPITT)

# Define network
network <- mbnma.network(HF2PPITT, description="Example")

# Plot network
plot(network)

MBNMAdose documentation built on Sept. 13, 2020, 5:08 p.m.