plot.mbnma.network {MBNMAdose} | R Documentation |
Create an mbnma.network object
Description
Creates an object of class("mbnma.network")
. Various MBNMA functions can subsequently be applied
to this object.
Usage
## 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 |
level |
A string indicating whether nodes/facets should represent |
v.color |
Can take either |
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 |
layout |
An igraph layout specification. This is a function specifying an igraph
layout that determines the arrangement of the vertices (nodes). The default
|
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 |
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 |
legend |
A boolean object to indicate whether or not to plot a legend to indicate which node colour
corresponds to which agent if |
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 |
... |
Options for plotting in |
data.ab |
A data frame of arm-level data in "long" format containing the columns:
|
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:
-
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 -
agents
A character vector indicating the agent identifiers that correspond to the new agent codes. -
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(mbnma.network)
: Generate a network plot
Examples
# Create an mbnma.network object from the data
network <- mbnma.network(triptans)
# 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(triptans)
# Define network
network <- mbnma.network(triptans, description="Example network")
summary(network)
plot(network)