plot.mb.network {MBNMAtime}R Documentation

Create an mb.network object

Description

Creates an object of class("mb.network"). Various MBNMA functions can subsequently be applied to this object.

Usage

## S3 method for class 'mb.network'
plot(
  x,
  edge.scale = 1,
  label.distance = 0,
  level = "treatment",
  remove.loops = FALSE,
  v.color = "connect",
  v.scale = NULL,
  layout = igraph::in_circle(),
  legend = TRUE,
  legend.x = "bottomleft",
  legend.y = NULL,
  ...
)

mb.network(data.ab, reference = 1, cfb = NULL, description = "Network")

Arguments

x

An object of class mb.network.

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.

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.

level

A string indicating whether nodes/facets should represent treatment or class in the plot. Can be used to examine the expected impact of modelling class/agent effects.

remove.loops

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

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 "class" to colour nodes by class (this requires that the variable class be included in the dataset).

v.scale

A number with which to scale the size of the nodes. If the variable N (to indicate the numbers of participants at each observation) is included in the dataset then the size of the nodes will be proportional to the number of participants within a treatment/class in the network at the earliest time point reported in each study.

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_

legend

A boolean value indicating whether or not to plot a legend with class names if v.color="class"

legend.x

Can be either a string or a numerical x-coordinate indicating where the legend should be plotted (see legend).

legend.y

A numerical y-coordinate indicating where the legend should be plotted - only required if legend.x is also a numeric co-ordinate.

...

Options for plotting in igraph.

data.ab

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

  • studyID Study identifiers

  • time Numeric data indicating follow-up times

  • y Numeric data indicating the aggregate response for a given observation (e.g. mean)

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

  • treatment Treatment identifiers (can be numeric, factor or character)

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

  • n An optional column indicating the number of participants used to calculate the response at a given observation (required if modelling using Standardised Mean Differences)

  • standsd An optional column of numeric data indicating reference SDs used to standardise treatment effects when modelling using Standardised Mean Differences (SMD).

reference

A number or character (depending on the format of treatment within data.ab) indicating the reference treatment in the network (i.e. those for which estimated relative treatment effects estimated by the model will be compared to).

cfb

A logical vector whose length is equal to the unique number of studies in data.ab, where each element is TRUE if the study data reported is change-from-baseline and FALSE otherwise. If left as NULL (the default) then this will be identified from the data by assuming any study for which there is no data at time=0 reports change-from-baseline.

description

Optional. Short description of the network.

Details

The S3 method plot() on an mb.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.

Missing values (NA) cannot be included in the dataset. Studies must have a baseline measurement and more than a single follow-up time (unless change from baseline data are being used). Data must be present for all arms within a study at each follow-up time.

Value

Returns an object of class "igraph", which can be modified by other functions within the igraph package.

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

Methods (by generic)

Examples




# Create an mb.network object from the data
network <- mb.network(osteopain)

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

# Generate a network plot at the class level that removes loops indicating comparisons
#within a node
goutnet <- mb.network(goutSUA_CFB)
plot(goutnet, level="class", remove.loops=TRUE)

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

# Plot network in which node size is proportional to number of participants
alognet <- mb.network(alog_pcfb)
plot(alognet, v.scale=2)



# Using the osteoarthritis dataset
print(osteopain)

# Define network
network <- mb.network(osteopain, description="Osteoarthritis Dataset")

# Define network with different network reference treatment
network <- mb.network(osteopain, reference="Ce_200")


# Using the alogliptin dataset
network <- mb.network(alog_pcfb, description="Alogliptin Dataset")

# Examine networks
print(network)
plot(network)


[Package MBNMAtime version 0.2.4 Index]