Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gcor

Find the (Product-Moment) Correlation Between Two or More Labeled Graphs


Description

gcor finds the product-moment correlation between the adjacency matrices of graphs indicated by g1 and g2 in stack dat (or possibly dat2). Missing values are permitted.

Usage

gcor(dat, dat2=NULL, g1=NULL, g2=NULL, diag=FALSE, mode="digraph")

Arguments

dat

one or more input graphs.

dat2

optionally, a second stack of graphs.

g1

the indices of dat reflecting the first set of graphs to be compared; by default, all members of dat are included.

g2

the indices or dat (or dat2, if applicable) reflecting the second set of graphs to be compared; by default, all members of dat are included.

diag

boolean indicating whether or not the diagonal should be treated as valid data. Set this true if and only if the data can contain loops. diag is FALSE by default.

mode

string indicating the type of graph being evaluated. "Digraph" indicates that edges should be interpreted as directed; "graph" indicates that edges are undirected. mode is set to "digraph" by default.

Details

The (product moment) graph correlation between labeled graphs G and H is given by

cor(G,H) = cov(G,V)/sqrt(cov(G,G)cov(H,H))

where the graph covariance is defined as

cov(G,H) = sum( (A^G_ij-mu_G)(A^H_ij-mu_H), {i,j} )/Choose(|V|,2)

(with A^G being the adjacency matrix of G). The graph correlation/covariance is at the center of a number of graph comparison methods, including network variants of regression analysis, PCA, CCA, and the like.

Note that gcor computes only the correlation between uniquely labeled graphs. For the more general case, gscor is recommended.

Value

A graph correlation matrix

Note

The gcor routine is really just a front-end to the standard cor method; the primary value-added is the transparent vectorization of the input graphs (with intelligent handling of simple versus directed graphs, diagonals, etc.). As noted, the correlation coefficient returned is a standard Pearson's product-moment coefficient, and output should be interpreted accordingly. Classical null hypothesis testing procedures are not recommended for use with graph correlations; for nonparametric null hypothesis testing regarding graph correlations, see cugtest and qaptest. For multivariate correlations among graph sets, try netcancor.

Author(s)

Carter T. Butts buttsc@uci.edu

References

Butts, C.T., and Carley, K.M. (2001). “Multivariate Methods for Interstructural Analysis.” CASOS Working Paper, Carnegie Mellon University.

Krackhardt, D. (1987). “QAP Partialling as a Test of Spuriousness.” Social Networks, 9, 171-86

See Also

Examples

#Generate two random graphs each of low, medium, and high density
g<-rgraph(10,6,tprob=c(0.2,0.2,0.5,0.5,0.8,0.8))

#Examine the correlation matrix
gcor(g)

sna

Tools for Social Network Analysis

v2.6
GPL (>= 2)
Authors
Carter T. Butts [aut, cre, cph]
Initial release
2020-10-5

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.