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 |
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 |
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 |
level |
A string indicating whether nodes/facets should represent |
remove.loops |
A boolean value indicating whether to include loops that indicate comparisons within a node. |
v.color |
Can take either |
v.scale |
A number with which to scale the size of the nodes. If the variable |
layout |
An igraph layout specification. This is a function specifying an igraph
layout that determines the arrangement of the vertices (nodes). The default
|
legend |
A boolean value indicating whether or not to plot a legend with class names if |
legend.x |
Can be either a string or a numerical x-coordinate indicating where the legend should be
plotted (see |
legend.y |
A numerical y-coordinate indicating where the legend should be plotted - only required if |
... |
Options for plotting in |
data.ab |
A data frame of arm-level data in "long" format containing the columns:
|
reference |
A number or character (depending on the format of |
cfb |
A logical vector whose length is equal to the unique number of studies in |
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:
-
description
A short description of the network -
data.ab
A data frame containing the arm-level network data (treatment identifiers will have been recoded to a sequential numeric code) -
studyID
A character vector with the IDs of included studies. -
cfb
A logical vector indicating which studies report change from baseline data -
treatments
A character vector indicating the treatment identifiers that correspond to the new treatment codes. -
classes
A character vector indicating the class identifiers (if included in the original data) that correspond to the new class codes.
Methods (by generic)
-
plot(mb.network)
: Generate a network plot
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)