create.graph: Creates 'igraph' graph and MST results

create.graphR Documentation

Creates igraph graph and MST results

Description

This function creates igraph graph and corresponding minimum spanning tree (MST) results from an adjacency matrix that is produced out of an input data table, using an estimation method specified by the user.

Usage

create.graph(A, methodlist, thresh = 0.05)

Arguments

A

input data table from which the adjacency matrix will be generated, to be provided in form of a matrix, array, data frame or tibble

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

Details

This function creates igraph graph and corresponding minimum spanning tree (MST; derived using Prim's algorithm) results from an adjacency matrix that is produced out of an input data table, using an estimation method specified by the user. The function builds on respective implementations in the igraph R package.
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.

Value

a list with 15 elements: the adjacency matrix, the igraph graph, the graph communities (derived by the Girvan-Newman algorithm based on edge betweenness), the graph clustering, the graph vertex degrees, the graph number of edges, the graph number of clusters, the graph number of isolated nodes, the minimum spanning tree (MST), the MST communities (derived by the Girvan-Newman algorithm based on edge betweenness), the MST clustering, the MST vertex degrees, the MST number of edges, the MST number of clusters and the MST number of isolated nodes

Examples

create.graph(ExDataA,methodlist=list("Spearman"))
create.graph(ExDataA,methodlist=list("Spearman.adj","bonferroni"))
create.graph(ExDataA,methodlist=list("PCSpearman"),thresh=0.1)
create.graph(ExDataA,methodlist=list("PCSpearman.adj","BH"),thresh=0.1)
create.graph(ExDataA,methodlist=list("DistCorr"))
create.graph(ExDataA,methodlist=list("DistCorr.adj","bonferroni"))
create.graph(ExDataB,methodlist=list("EBICglasso","spearman",0.1))
create.graph(ExDataB,methodlist=list("EBICglasso","pearson",0.05))

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