comp.plot: Provides plots allowing for visual comparison of two networks

View source: R/Plots.R

comp.plotR Documentation

Provides plots allowing for visual comparison of two networks

Description

This function provides plots allowing for visual comparison of two networks, which are given by adjacency matrices that are produced out of input data tables, using an estimation method specified by the user.

Usage

comp.plot(
  A,
  B,
  methodlist,
  thresh = 0.05,
  networkA = TRUE,
  networkB = TRUE,
  networkAtitle = "Network A",
  networkBtitle = "Network B",
  cluster = TRUE,
  negcol = "red",
  poscol = "blue",
  multiplier = 4,
  curved = TRUE,
  layout = igraph::layout.auto,
  vSize = 16,
  tSize = 0.8
)

Arguments

A, B

input data tables from which the adjacency matrices will be generated, to be provided in form of matrices, arrays, data frames or tibbles

methodlist

a list specifying the method which is used to estimate and create the adjacency matrix; see details for further information

thresh

a number between 0 and 1 (default is set to 0.05) specifying the singificance level: if the p-value corresponding to an edge weight is greater than thresh, the corresponding edge weight is not considered to be significant and thus set to zero

networkA

Boolean, indicating whether the network corresponding to the first data set shall be plotted

networkB

Boolean, indicating whether the network corresponding to the second data set shall be plotted

networkAtitle

a character, indicating the title of the first network

networkBtitle

a character, indicating the title of the second network

cluster

a Boolean, indicating whether the networks shall be plotted along with the derived communities/clusters

negcol

a character, specifying the color which is used to represent edges with a negative correlation

poscol

a character, specifying the color which is used to represent edges with a positive correlation

multiplier

a number, representing the factor with which an edge weight is multiplied in order to regulate the thickness of the drawn edges

curved

a Boolean, indicating whether the edges should be drawn using a curved or solid line

layout

a function specifying the layout of the networks; see details for possible options and further information

vSize

a number, specifying the size of the nodes

tSize

a number, specifying the node label size

Details

This function provides plots allowing for visual comparison of two networks, which are given by adjacency matrices that are produced out of input data tables, using an estimation method specified by the user. The network estimation method has to be specified in form of a list in the methodlist argument. Currently, the following estimation methods are supported:

  • list("Spearman")
    Edge weights are estimated using Spearman correlation, where unadjusted p-values are employed to determine significance. To apply this method, the expression list("Spearman") has to be provided in the methodlist argument.

  • list("Spearman.adj",adjustment method)
    Edge weights are estimated using Spearman correlation, where p-values adjusted for multiple testing are employed to determine significance. To apply this method, the expression list("Spearman.adj",adjustment method) has to be provided in the methodlist argument, where adjustment method has to be one of the options for multple testing adjustment provided by the standard p.adjust R function, i.e. one of "BH", "bonferroni", "BY", "fdr", "hochberg", "holm" or "hommel".

  • list("PCSpearman")
    Edge weights are estimated using partial Spearman correlation, where unadjusted p-values are employed to determine significance. To apply this method, the expression list("PCSpearman") has to be provided in the methodlist argument.

  • list("PCSpearman.adj",adjustment method)
    Edge weights are estimated using partial Spearman correlation, where p-values adjusted for multiple testing are employed to determine significance. To apply this method, the expression list("PCSpearman.adj",adjustment method) has to be provided in the methodlist argument, where adjustment method has to be one of the options for multple testing adjustment provided by the standard p.adjust R function, i.e. one of "BH", "bonferroni", "BY", "fdr", "hochberg", "holm" or "hommel".

  • list("DistCorr")
    Edge weights are estimated using distance correlation, where unadjusted p-values are employed to determine significance. To apply this method, the expression list("DistCorr") has to be provided in the methodlist argument. Note that the calculations may require larger computation times, as a permutation test is involved to derive the corresponding p-values for the distance correlations.

  • list("DistCorr.adj",adjustment method)
    Edge weights are estimated using distance correlation, where p-values adjusted for multiple testing are employed to determine significance. To apply this method, the expression list("DistCorr.adj",adjustment method) has to be provided in the methodlist argument, where adjustment method has to be one of the options for multple testing adjustment provided by the standard p.adjust R function, i.e. one of "BH", "bonferroni", "BY", "fdr", "hochberg", "holm" or "hommel". Note that the calculations may require larger computation times, as a permutation test is involved to derive the corresponding p-values for the distance correlations.

  • list("EBICglasso",correlation type,tuning parameter)
    Edge weights are estimated using the EBICglasso approach. To apply this method, the expression list("EBICglasso",correlation type,tuning parameter) has to be provided in the methodlist argument. Here, correlation type has to be one of the association options provided by the standard cor R function, i.e. one of "kendall", "pearson" or "spearman". Moreover, tuning parameter has to be a number specifying the EBIC tuning parameter γ. Typical choices include values between 0 and 0.5, where smaller values usually lead to a higher sensitivity in that more edges are included into the network.
    Note that for EBICglasso, an additional specification of the thresh argument is obsolete, as it is not used for the application of the method.

The following options (functions) from the igraph R package are provided to specify the layout of the plots in the layout argument:

  • igraph::layout.auto (default)

  • igraph::layout.circle

  • igraph::layout.davidson.harel

  • igraph::layout.drl

  • igraph::layout.fruchterman.reingold

  • igraph::layout.gem

  • igraph::layout.graphopt

  • igraph::layout.grid

  • igraph::layout.kamada.kawai

  • igraph::layout.lgl

  • igraph::layout.mds

  • igraph::layout.reingold.tilfort

  • igraph::layout.star

  • igraph::layout.svd

Value

a plot of the two specified networks, which allows for visual comparison

Examples

comp.plot(ExDataA,ExDataB,methodlist=list("Spearman"))
comp.plot(ExDataA,ExDataB,methodlist=list("PCSpearman.adj","bonferroni"),
layout=igraph::layout.circle,curved=FALSE)
comp.plot(ExDataA,ExDataB,methodlist=list("EBICglasso","spearman",0.1),
layout=igraph::layout.fruchterman.reingold,curved=FALSE)
comp.plot(ExDataA,ExDataB,methodlist=list("EBICglasso","pearson",0.05),
layout=igraph::layout.star,cluster=FALSE)

RomanSchefzik/DNT documentation built on Sept. 11, 2022, 10:29 p.m.