View source: R/graph_node_compar.R
graph_node_compar | R Documentation |
The function computes a correlation coefficient between the graph-theoretic metric values computed at the node-level in two graphs sharing the same nodes. It allows to assess whether the connectivity properties of the nodes in one graph are similar to that of the same nodes in the other graph. Alternatively, the correlation is computed between a graph-theoretic metric values and the values of an attribute associated to the nodes of a graph.
graph_node_compar( x, y, metrics = c("siw", "siw"), method = "spearman", weight = TRUE, test = TRUE )
x |
An object of class |
y |
An object of class |
metrics |
Two-element character vector specifying the graph-theoretic metrics computed at the node-level in the graphs or the node attribute values to be correlated to these metrics. Graph-theoretic metrics can be:
Node attributes must have the same names as in the |
method |
A character string indicating which correlation coefficient
is to be computed ( |
weight |
Logical which indicates whether the links are weighted during
the calculation of the centrality indices betweenness and closeness.
(default: |
test |
Logical. Should significance testing be performed? (default = TRUE) |
The correlation coefficients between the metrics can be computed
in different ways, as initial assumptions (e.g. linear relationship) are
rarely verified. Pearson's r, Spearman's rho and Kendall's tau can be
computed (from function cor
).
When x
is similar to y
, then the correlation is computed
between two metrics characterizing the nodes of the same graph.
A list
summarizing the correlation analysis.
P. Savary
data(data_ex_genind) data(pts_pop_ex) mat_dist <- suppressWarnings(graph4lg::mat_geo_dist(data = pts_pop_ex, ID = "ID", x = "x", y = "y")) mat_dist <- mat_dist[order(as.character(row.names(mat_dist))), order(as.character(colnames(mat_dist)))] graph_obs <- gen_graph_thr(mat_w = mat_dist, mat_thr = mat_dist, thr = 9500, mode = "larger") mat_gen <- mat_gen_dist(x = data_ex_genind, dist = "DPS") graph_pred <- gen_graph_topo(mat_w = mat_gen, mat_topo = mat_dist, topo = "gabriel") res_cor <- graph_node_compar(x = graph_obs, y = graph_pred, metrics = c("siw", "siw"), method = "spearman", test = TRUE, weight = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.