gcov                   package:sna                   R Documentation

_F_i_n_d _t_h_e _C_o_v_a_r_i_a_n_c_e(_s) _B_e_t_w_e_e_n _T_w_o _o_r _M_o_r_e _L_a_b_e_l_e_d _G_r_a_p_h_s

_D_e_s_c_r_i_p_t_i_o_n:

     `gcov' finds the covariances between the adjacency matrices of
     graphs indicated by `g1' and `g2' in stack `dat' (or possibly
     `dat2').  Missing values are permitted.

_U_s_a_g_e:

     gcov(dat, dat2=NULL, g1=c(1:dim(dat)[1]), g2=c(1:dim(dat)[1]), 
         diag=FALSE, mode="digraph")

_A_r_g_u_m_e_n_t_s:

     dat: A graph stack 

    dat2: Optionally, a second graph stack 

      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. 

_D_e_t_a_i_l_s:

     The graph covariance between two labeled graphs 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 `gcov' computes only the covariance between uniquely
     labeled graphs.  For the more general case, `gscov' is
     recommended.

_V_a_l_u_e:

     A graph covariance matrix

_N_o_t_e:

     The `gcov' routine is really just a front-end to the standard
     `cov' method; the primary value-added is the transparent
     vectorization of the input graphs (with intelligent handling of
     simple versus directed graphs, diagonals, etc.).  Classical null
     hypothesis testing procedures are not recommended for use with
     graph covariance; for nonparametric null hypothesis testing
     regarding graph covariance, see `cugtest' and `qaptest'.

_A_u_t_h_o_r(_s):

     Carter T. Butts ctb@andrew.cmu.edu

_R_e_f_e_r_e_n_c_e_s:

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

_S_e_e _A_l_s_o:

     `gscov', `gcor', `gscor'

_E_x_a_m_p_l_e_s:

     #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 covariance matrix
     gcov(g)

