Skip to contents

summary.netify processes a netify object to calculate and return a data frame of graph-level statistics. This function is designed to work with both cross-sectional and longitudinal netify data structures, providing a comprehensive overview of network characteristics such as density, reciprocity, and standard deviations of sending and receiving effects.

Usage

# S3 method for class 'netify'
summary(object, ...)

Arguments

object

An object of class netify, which should have been created using the function netify. This object contains the network data structured for analysis.

...

Additional parameters which can include user-defined statistical functions. These functions should take a matrix as input and return a scalar value. They will be applied to each network slice individually if the netify object represents longitudinal data.

  • other_stats: A named list of functions that take a matrix and return additional actor-level statistics to be included in the output. Each function should accept a matrix as input and return a vector or single value per actor. This allows for the inclusion of custom metrics in the summary output.

Value

A data frame where each row represents the network-level statistics for a single network or a single time point in a longitudinal study. Depending on the network type and data attributes, the columns can include:

  • num_actors: Number of actors in the network - for bipartite networks number of row and column actors are reported separately.

  • density: The proportion of possible connections that are actual connections within the network.

  • num_edges: The total number of edges in the network (does not take edge weight into account).

  • mean_edge_weight: The average weight of edges in the network, provided only for weighted networks.

  • sd_edge_weight: The standard deviation of edge weights in the network, provided only for weighted networks.

  • median_edge_weight: The median edge weight in the network, provided only for weighted networks.

  • prop_edges_missing: The proportion of potential edges that are missing.

  • min_edge_weight and max_edge_weight: The minimum and maximum edge weights observed in the network, provided only for weighted networks.

  • competition_row and competition_col (defaults to competition for undirected networks): Measures network competitiveness using the Herfindahl-Hirschman Index (HHI), defined as \(\sum_{i=1}^{n} (s_i)^2\), where \(s_i\) is the proportion of interactions by actor \(i\) and \(n\) is the total number of actors. The index ranges from 1/n (indicating high diversity and competitive interaction across actors) to 1 (one actor dominates all interactions). Refer to Dorff, Gallop, & Minhas (2023) for an application of this measure in conflict networks.

  • sd_of_row_means and sd_of_col_means: Standard deviations of the sending and receiving effects (row and column means). These statistics are meant to describe the variability in actor behavior across the network.

  • covar_of_row_col_means: The covariance between sending and receiving effects, always takes weights into account and is only calculated for unipartite networks.

  • reciprocity: The reciprocity of the network, defined as the correlation between the adjacency matrix and its transpose, always takes weights into account and is only calculated for unipartite networks.

  • transitivity: The overall transitivity or clustering coefficient of the network, reflecting the likelihood that two neighbors of a node are connected (calculated using transitivity function from igraph).

Details

This function is especially useful to simplify the process of extracting key network statistics across multiple networks in a netify object. It is capable of handling both weighted and unweighted networks and adjusts its calculations based on the nature of the network data (cross-sectional vs. longitudinal).

Author

Cassy Dorff, Shahryar Minhas

Examples


# load icews data
data(icews)

# create netlet
netlet = netify(
    dyad_data=icews, actor1='i', actor2='j',
    time = 'year', symmetric=FALSE, weight='verbCoop' )

# calculate default summary stats
summ_graph = summary(netlet)
head(summ_graph)
#>    net num_actors   density num_edges prop_edges_missing mean_edge_weight
#> 1 2002        152 0.3787034      8692                  0         19.59123
#> 2 2003        152 0.3871994      8887                  0         19.36358
#> 3 2004        152 0.4145173      9514                  0         19.84986
#> 4 2005        152 0.4071976      9346                  0         19.79488
#> 5 2006        152 0.4108139      9429                  0         21.09136
#> 6 2007        152 0.4243203      9739                  0         21.89753
#>   sd_edge_weight median_edge_weight min_edge_weight max_edge_weight
#> 1       143.8213                  0               0            6003
#> 2       144.5982                  0               0            5937
#> 3       137.7292                  0               0            5141
#> 4       148.6667                  0               0            6561
#> 5       160.0782                  0               0            7579
#> 6       162.4166                  0               0            7125
#>   competition_row competition_col sd_of_row_means sd_of_col_means
#> 1      0.04093116      0.03813621        44.91530        43.04935
#> 2      0.04199822      0.03930188        45.07759        43.32783
#> 3      0.03481011      0.03262993        41.25503        39.63005
#> 4      0.04067046      0.03624472        45.20964        42.17312
#> 5      0.04151400      0.03697499        48.76301        45.48502
#> 6      0.03887627      0.03514325        48.67808        45.77854
#>   covar_of_row_col_means reciprocity transitivity
#> 1              0.9946888   0.9778217    0.6058952
#> 2              0.9872959   0.9632488    0.6072045
#> 3              0.9923809   0.9769563    0.6215978
#> 4              0.9932157   0.9804325    0.6215075
#> 5              0.9909337   0.9771928    0.6277829
#> 6              0.9940837   0.9783703    0.6330626

# add custom summary stat
spinglass_ig = function(mat){
    g = prep_for_igraph(mat)
    comm = igraph::cluster_spinglass(g)
    num_comm = length(comm$csize)
    return( c(
        num_comm=num_comm,
        comm_modul = comm$modularity
    ) )
}

# since calculating communities can be intensive
# lets take subset of time periods
sub_net = subset_netlet(netlet, when_to_subset = as.character(2013:2014))

# feed custom summary stat into summary
summary(sub_net, 
    other_stats=list(spinglass_ig=spinglass_ig)) 
#>    net num_actors   density num_edges prop_edges_missing mean_edge_weight
#> 1 2013        152 0.4318142      9911                  0         17.21301
#> 2 2014        152 0.4258452      9774                  0         18.39291
#>   sd_edge_weight median_edge_weight min_edge_weight max_edge_weight
#> 1       130.4925                  0               0            6320
#> 2       136.5412                  0               0            6327
#>   competition_row competition_col sd_of_row_means sd_of_col_means
#> 1      0.04058869      0.03642385        39.26572        36.78299
#> 2      0.04058415      0.03521224        41.95447        38.49827
#>   covar_of_row_col_means reciprocity transitivity spinglass_ig.num_comm
#> 1              0.9939394   0.9782226    0.6314429                     6
#> 2              0.9904402   0.9730745    0.6297063                     5
#>   spinglass_ig.comm_modul
#> 1             0.004017763
#> 2             0.003848832