Learn R Programming

netmeta (version 0.7-0)

netgraph: Network graph

Description

This function generates a graph of the evidence network.

Usage

netgraph(x, seq=x$seq,
         labels=rownames(x$TE.fixed),
         cex=1, col="slateblue", offset=0.0175, scale=1.10,
         plastic, thickness, lwd=5, lwd.min=lwd/2.5, lwd.max=lwd*4,
         highlight=NULL, col.highlight="red2",
         lwd.highlight=lwd, highlight.split=":",
         multiarm=any(x$narms>2), col.multiarm=NULL,
         alpha.transparency=0.5,
         points=FALSE, col.points="red", cex.points=1, pch.points=20,
         start.layout="circle", eig1=2, eig2=3,
         iterate, tol=0.0001, maxit=500, allfigures=FALSE,
         A.matrix=x$A.matrix, N.matrix=sign(A.matrix),
         xpos=NULL, ypos=NULL,
         ...)

Arguments

x
An object of class netmeta (mandatory).
seq
A character or numerical vector specifying the sequence of treatments arrangement (anticlockwise if start.layout="circle").
labels
An optional vector with treatment labels.
cex
The magnification to be used for treatment labels.
col
Color of lines connecting treatments if argument plastic=FALSE.
offset
Distance between edges (i.e. treatments) in graph and treatment labels (value of 0.0175 corresponds to a difference of 1.75% of the range on x- and y-axis).
scale
Additional space added outside of edges (i.e. treatments). Increase this value for larger treatment labels (value of 1.10 corresponds to an additional space of 10% around the network graph).
plastic
A logical indicating whether the appearance of the comparisons should be in 3D look.
thickness
Either a character variable to determine the method to plot line widths (see Details) or a matrix of the same dimension and row and column names as argument A.matrix with information on line width.
lwd
A numeric for scaling the line width of comparisons.
lwd.max
Maximum line width in network graph. The connection with the largest value according to argument thickness will be set to this value.
lwd.min
Minimum line width in network graph. All connections with line widths below this values will be set to lwd.min.
highlight
A character vector identifying comparisons that should be marked in the network graph, e.g. highlight="treat1:treat2".
col.highlight
Color for highlighting the comparisons given by highlight.
lwd.highlight
A numeric for the line width for highlighting the comparisons given by highlight.
highlight.split
A character defining splitting criterion (only necessary if colon is used in treatment labels).
multiarm
A logical indicating whether multi-arm studies should marked in plot.
col.multiarm
Either a function from R library colorspace or grDevice to define colors for multi-arm studies or a character vector with colors to highlight multi-arm studies.
alpha.transparency
The alpha transparency of colors used to highlight multi-arm studies (0 means transparent and 1 means opaque).
points
A logical indicating whether points should be printed at nodes (i.e. treatments) of the network graph.
col.points, cex.points, pch.points
Corresponding color, size, type for points.
start.layout
A character string indicating which starting layout is used if iterate=TRUE. If "circle" (default), the iteration starts with a circular ordering of the vertices; if "eigen", eigenvectors of the Laplacian matrix are used, calculat
eig1
A numeric indicating which eigenvector is used as x coordinate if start="eigen" or "prcomp" and iterate=TRUE. Default is 2, the eigenvector to the second-smallest eigenvalue of the Laplacian matrix.
eig2
A numeric indicating which eigenvector is used as y-coordinate if start="eigen" or "prcomp" and iterate=TRUE. Default is 3, the eigenvector to the third-smallest eigenvalue of the Laplacian matrix.
iterate
A logical indicating whether the stress majorization algorithm is carried out for optimization of the layout.
tol
A numeric for the tolerance for convergence if iterate=TRUE.
maxit
An integer defining the maximum number of iteration steps if iterate=TRUE.
allfigures
A logical indicating whether all iteration steps are shown if iterate=TRUE. May slow down calculations if set to TRUE (especially if plastic=TRUE).
A.matrix
Adjacency matrix (nxn) characterizing the structure of the network graph. Row and column names must be the same set of values as provided by argument seq.
N.matrix
Neighborhood matrix (nxn) replacing A.matrix if neighborhood is to be specified differently from node adjacency in the network graph, for example content-based. Row and column names must be the same set of values as provided
xpos
Vector (n) of x coordinates.
ypos
Vector (n) of y coordinates.
...
Additional graphical arguments.

Details

The network is laid out in the plane, where the nodes in the graph layout correspond to the treatments and edges display the observed treatment comparisons. For the default setting, nodes are placed on a circle. Other starting layouts are "eigen", "prcomp", and "random". If iterate=TRUE, the layout is further optimized using the stress majorization algorithm. This algorithm specifies an 'ideal' distance (e.g., the graph distance) between two nodes in the plane. In the optimal layout, these distances are best approximated in the sense of least squares. Starting from an initial layout, the optimum is approximated in an iterative process called stress majorization (Kamada and Kawai 1989, Michailidis and de Leeuw 2001, Hu 2012). The starting layout can be chosen as a circle or coming from eigenvectors of the Laplacian matrix (corresponding to Hall's algorithm, Hall 1970), calculated in different ways, or random. Moreover, it can be chosen whether the iteration steps are shown (argument allfigures=TRUE).

Argument thickness providing the line width of the nodes (comparisons) can be a matrix of the same dimension as argument A.matrix or any of the following character variables:

  • Same line width (argumentlwd) for all comparisons (thickness="equal")
  • Proportional to number of studies comparing two treatments (thickness="number.of.studies")
  • Proportional to inverse standard error of fixed effect model comparing two treatments (thickness="se.fixed")
  • Proportional to inverse standard error of random effects model comparing two treatments (thickness="se.random")
  • Weight from fixed effect model comparing two treatments (thickness="w.fixed")
  • Weight from random effects model comparing two treatments (thickness="w.random")
Only evidence from direct treatment comparisons is considered to determine the line width if argument thickness is equal to any but the first method. By default, thickness="se.fixed" is used if start.layout="circle", iterate=FALSE, and plastic=TRUE. Otherwise, the same line width is used. Further, a couple of graphical parameters can be specified, such as color and appearance of the edges (treatments) and the nodes (comparisons), whether special comparisons should be highlighted and whether multi-arm studies should be indicated as colored polygons. By default, if R package colorspace is available the sequential_hcl function is used to highlight multi-arm studies; otherwise the rainbow is used.

References

Krahn U, Binder H, König J (2013), A graphical tool for locating inconsistency in network meta-analyses. BMC Medical Research Methodology, 13, 35. Hall, K.M. (1970). An r-dimensional quadratic placement algorithm. Management Science, 17, 219--229.

Hu, Y. (2012). Combinatorial Scientific Computing, Chapter Algorithms for Visualizing Large Networks, pages 525--549. Chapman and Hall/CRC Computational Science.

Kamada, T. and Kawai, S. (1989). An algorithm for drawing general undirected graphs. Information Processing Letters, 31(1), 7--15.

Michailidis, G. and de Leeuw, J. (2001). Data visualization through graph drawing. Computational Statistics, 16(3), 435--450.

See Also

netmeta

Examples

Run this code
data(Senn2013)

## Generation of an object of class 'netmeta' with reference treatment 'plac'
##
net1 <- netmeta(TE, seTE, treat1, treat2, studlab,
        data=Senn2013, sm="MD", reference="plac")

## Network graph with default settings
##
netgraph(net1)

## Network graph with specified order of the treatments and one
## highlighted comparison
##
trts <- c("plac", "benf", "migl", "acar", "sulf",
          "metf", "rosi", "piog", "sita", "vild")
netgraph(net1, highlight="acar:metf", seq=trts)

## Same network graph using argument 'seq' in netmeta function
###
net2 <- netmeta(TE, seTE, treat1, treat2, studlab,
                data=Senn2013, sm="MD", reference="plac",
                seq=trts)
netgraph(net2, highlight="acar:metf")

## Network graph optimized, starting from a circle, with multi-arm
## study colored
##
netgraph(net1, start="circle", iterate=TRUE, col.multiarm="purple")

## Network graph optimized, starting from a circle, with multi-arm
## study colored and all intermediate iteration steps visible
##
netgraph(net1, start="circle", iterate=TRUE, col.multiarm="purple",
         allfigures=TRUE)

## Network graph optimized, starting from Laplacian eigenvectors, with
## multi-arm study colored
##
netgraph(net1, start="eigen", col.multiarm="purple")

## Network graph optimized, starting from different Laplacian
## eigenvectors, with multi-arm study colored
##
netgraph(net1, start="prcomp", col.multiarm="purple")

## Network graph optimized, starting from random initial layout, with
## multi-arm study colored
##
netgraph(net1, start="random", col.multiarm="purple")

## Network graph without 3D look of the comparisons and one
## highlighted comparison
##
netgraph(net1, plastic=FALSE, highlight="acar:metf")

## Network graph without 3D look and comparisons with same thickness
##
netgraph(net1, plastic=FALSE, thickness=FALSE)

## Network graph with changed labels and specified order of the
## treatments
##
netgraph(net1, seq=c(1, 3, 5, 2, 9, 4, 7, 6, 8, 10),
         labels=LETTERS[1:10])

Run the code above in your browser using DataLab