Learn R Programming

backShift (version 0.1.4.3)

plotGraphEdgeAttr: Plotting function to visualize directed graphs

Description

Given a point estimate of the connectivety matrix or the adjacency matrix, this function visualizes the directed graph using plot.igraph from the package igraph. If a point estimate is plotted, the edges' intensity reflects the magnitude of the coefficients. If the result is an adjacency matrix estimated by stability selection then the edges' width reflects how often an edge was selected and the intensity reflects the magnitude of the coefficients (if this information is also provided).

Usage

plotGraphEdgeAttr(
  estimate,
  plotStabSelec,
  labels,
  thres.point,
  edgeWeights = NULL,
  thres.stab = 0.75,
  main = "",
  edge.color = "blue",
  ...
)

Arguments

estimate

Estimate of connectivity matrix. This can be a point estimate with entry \(A_{ij}\) being the estimated edge weight for the edge from node \(i\) to node \(j\). Otherwise, it can be the estimated adjacency matrix by a stability selection procedure as in backShift. In this case, the entry \(A_{ij}\) indicates how often the edge from node \(i\) to node \(j\) was selected.

plotStabSelec

Set to TRUE if estimate results from the stability selection procedure. Otherwise, estimate is assumed to be a point estimate.

labels

Variable labels to be displayed in plot.

thres.point

Value at which the point estimate should be thresholded, i.e. edges with coefficients smaller than thres.point are not displayed.

edgeWeights

If stability selection result should be visualized, provide edgeWeights as a (pxp)-matrix to display the magnitude of the coefficients as the intensity of the edges.

thres.stab

Indicate the threhold value that was used in the stability selection procedure. Used to determine the width of the plotted edges.

main

Provide the title of the plot.

edge.color

Color of the edges. Defaults to blue.

...

Optional arguments passed to the plotting function. Consists of igraph-type options like vertex.label.cex,vertex.label.color, edge.arrow.size or vertex.size etc.

@examples # create a matrix A to be visualized p <- 3 A <- diag(p)*0 A[1,2] <- 0.8 A[2,3] <- -0.8 A[3,1] <- 0.8

# add column names to use as labels for nodes colnames(A) <- c("1", "2", "3")

# plot plotGraphEdgeAttr(estimate = A, plotStabSelec = FALSE, labels = colnames(A), thres.point = 0, thres.stab = NULL, main = "True graph")

Details

Currently not all options of igraph are used; additional arguments are ignored.