Skip to contents

summary_actor provides detailed actor-level statistics for netify objects, handling different network structures and weight conditions. It produces a data frame summarizing various network metrics like degree, strength, closeness, betweenness, and centrality measures.

Usage

summary_actor(netlet, invert_weights_for_igraph = TRUE, other_stats = NULL)

Arguments

netlet

Object of class netify, typically produced by get_adjacency or other network creation functions within the package.

invert_weights_for_igraph

Logical; if TRUE, the weights of the edges are inverted before being used in the calculation of closeness or betweenness centrality. This is because igraph treats edge weights as distances. Inverting weights can be crucial when higher weights should imply stronger (or more valuable) connections rather than longer distances. Default is TRUE.

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 object summarizing actor-level statistics of the network(s). Depending on the structure and attributes of the netify object, the output includes:

  • Symmetric Unweighted: Various network measures for actor \(i\) include:

    • Degree: The count of unique actors that actor \(i\) is directly connected to – calculated as \(d_i = \sum_{j=1}^{n} a_{ij}\), where \(a_{ij}\) is the adjacency matrix element indicating the presence (1) or absence (0) of a tie between actors \(i\) and \(j\).

    • Proportion of ties: The percentage of actors in the network with whom actor \(i\) has a direct relationship – calculated as \(p_i = \frac{d_i}{n-1}\), where \(d_i\) is the degree of actor \(i\) and \(n\) is the total number of actors in the network.

    • Network share: The fraction of the network's total connections that include actor \(i\) – calculated as \(s_i = \frac{d_i}{\sum_{j=1}^{n} d_j}\), where \(d_i\) is the degree of actor \(i\) and \(\sum_{j=1}^{n} d_j\) is the total number of ties in the network.

    • Closeness (\(C_i\)): A measure of how close actor \(i\) is to all other actors in the network – calculated as \(C_i = \frac{1}{\sum_{j} d(i, j)}\), where \(d(i, j)\) is the distance to every other actor \(j\).

    • Betweenness (\(B_i\)): A measure of actor \(i\)'s importance in connecting different parts of the network – calculated as \(B_i = \sum_{s \neq i \neq t} \frac{\sigma_{st}(i)}{\sigma_{st}}\), where \(\sigma_{st}\) is the total number of shortest paths from node \(s\) to node \(t\) and \(\sigma_{st}(i)\) is the number of those paths that pass through \(i\).

    • Eigenvector centrality (\(EC_i\)): A measure of actor \(i\)'s influence based on their connections to other highly connected actors in the network, calculated using the principal eigenvector of the network's adjacency matrix.

  • Symmetric Weighted: Includes the same statistics as the symmetric unweighted case, with additional measures accounting for the weight of connections:

    • Strength sum: The total weight of the ties connected to actor \(i\) in the network – calculated as \(s_i^{sum} = \sum_{j=1}^{n} w_{ij}\), where \(w_{ij}\) is the weight of the tie between actors \(i\) and \(j\).

    • Strength average: The average weight of the ties connected to actor \(i\) – calculated as \(s_i^{avg} = \frac{s_i^{sum}}{d_i}\), where \(s_i^{sum}\) is the strength sum of actor \(i\) and \(d_i\) is the degree of actor \(i\).

  • Strength standard deviation: The variability in the weights of ties connected to actor \(i\) – calculated as \(s_i^{sd} = \sqrt{\frac{1}{d_i} \sum_{j=1}^{n} (w_{ij} - s_i^{avg})^2}\), where \(w_{ij}\) is the weight of the tie between actors \(i\) and \(j\).

  • Strength median: The median weight of the ties connected to actor \(i\) – calculated as the middle value of the sorted weights.

  • For closeness and betweenness, edge weights are typically inverted to treat them as distances, following the convention in igraph. This behavior can be modified by setting the invert_weights_for_igraph parameter in the summary_actor function to FALSE.

  • Asymmetric Unweighted: Same as the symmetric case but now a statistics for the row and column are calculated separately; when relevant a total statistic is calculated as well.

  • Asymmetric Weighted: Same as the symmetric case but now a statistics for the row and column are calculated separately; when relevant a total statistic is calculated as well.

Details

The function automatically adjusts calculations based on network symmetry and weight attributes, offering tailored statistical outputs for comprehensive network analysis. It supports handling of both cross-sectional and longitudinal network data, ensuring that each actor's metrics are accurately computed over time if applicable. Examples of additional computations (like authority or hub scores) are provided only for asymmetric networks.

Author

Cassy Dorff, Shahryar Minhas

Examples

# load icews data
data(icews)

# create a netify object
netlet = netify(
    dyad_data=icews, actor1='i', actor2='j',
    time = 'year',
    symmetric=FALSE, weight='verbCoop',
    mode='unipartite', sum_dyads=FALSE,
    actor_time_uniform=TRUE, actor_pds=NULL,
    diag_to_NA=TRUE, missing_to_zero=TRUE
)

# get actor-level statistics
actor_stats <- summary_actor(netlet)
head(actor_stats)
#>         actor time degree_in degree_out degree_total prop_ties_in prop_ties_out
#> 1 Afghanistan 2002        81         92          173    0.5364238     0.6092715
#> 2     Albania 2002        49         46           95    0.3245033     0.3046358
#> 3     Algeria 2002        65         68          133    0.4304636     0.4503311
#> 4      Angola 2002        67         64          131    0.4437086     0.4238411
#> 5   Argentina 2002        48         48           96    0.3178808     0.3178808
#> 6     Armenia 2002        66         71          137    0.4370861     0.4701987
#>   prop_ties_total strength_sum_in strength_sum_out strength_sum_total
#> 1               1            8694            10160              18854
#> 2               1             943             1022               1965
#> 3               1            1123             1205               2328
#> 4               1            1111             1311               2422
#> 5               1            1261             1427               2688
#> 6               1            2642             2665               5307
#>   strength_avg_in strength_avg_out strength_avg_total strength_std_in
#> 1       57.576159        67.284768          62.430464       198.98323
#> 2        6.245033         6.768212           6.506623        21.17104
#> 3        7.437086         7.980132           7.708609        17.00179
#> 4        7.357616         8.682119           8.019868        20.18988
#> 5        8.350993         9.450331           8.900662        39.54933
#> 6       17.496689        17.649007          17.572848        62.13790
#>   strength_std_out strength_std_total strength_median_in strength_median_out
#> 1        227.24232          213.11277                  1                   2
#> 2         22.27089           21.72096                  0                   0
#> 3         18.93197           17.96688                  0                   0
#> 4         24.29633           22.24310                  0                   0
#> 5         45.34294           42.44614                  0                   0
#> 6         66.88569           64.51180                  0                   0
#>   strength_median_total network_share_in network_share_out network_share_total
#> 1                   1.5      0.019334694       0.022594950         0.020964822
#> 2                   0.0      0.002097149       0.002272838         0.002184994
#> 3                   0.0      0.002497454       0.002679814         0.002588634
#> 4                   0.0      0.002470767       0.002915549         0.002693158
#> 5                   0.0      0.002804354       0.003173523         0.002988938
#> 6                   0.0      0.005875577       0.005926727         0.005901152
#>   closeness_in closeness_out closeness_all  betweenness authority_score
#> 1     71.13409      68.44904      78.06787 1.324503e-02      0.26866096
#> 2     42.48817      43.64733      47.16201 0.000000e+00      0.01252200
#> 3     44.78256      39.95772      47.41426 0.000000e+00      0.01406673
#> 4     51.35489      46.60123      54.85391 8.830022e-05      0.01905067
#> 5     63.91481      61.26657      69.47750 0.000000e+00      0.03580770
#> 6     65.51012      63.04273      71.46157 0.000000e+00      0.05049222
#>     hub_score
#> 1 0.183233794
#> 2 0.009730031
#> 3 0.010671854
#> 4 0.011275109
#> 5 0.024732267
#> 6 0.039622725

# add statistic that get 
# the max incoming and outgoing tie
max_out <- function(mat){ apply(mat, 1, max, na.rm=TRUE) }
max_in <- function(mat){ apply(mat, 2, max, na.rm=TRUE) }
actor_stats_custom <- summary_actor(netlet, other_stats = list(max_out = max_out, max_in = max_in))
head(actor_stats_custom)
#>         actor time degree_in degree_out degree_total prop_ties_in prop_ties_out
#> 1 Afghanistan 2002        81         92          173    0.5364238     0.6092715
#> 2     Albania 2002        49         46           95    0.3245033     0.3046358
#> 3     Algeria 2002        65         68          133    0.4304636     0.4503311
#> 4      Angola 2002        67         64          131    0.4437086     0.4238411
#> 5   Argentina 2002        48         48           96    0.3178808     0.3178808
#> 6     Armenia 2002        66         71          137    0.4370861     0.4701987
#>   prop_ties_total strength_sum_in strength_sum_out strength_sum_total
#> 1               1            8694            10160              18854
#> 2               1             943             1022               1965
#> 3               1            1123             1205               2328
#> 4               1            1111             1311               2422
#> 5               1            1261             1427               2688
#> 6               1            2642             2665               5307
#>   strength_avg_in strength_avg_out strength_avg_total strength_std_in
#> 1       57.576159        67.284768          62.430464       198.98323
#> 2        6.245033         6.768212           6.506623        21.17104
#> 3        7.437086         7.980132           7.708609        17.00179
#> 4        7.357616         8.682119           8.019868        20.18988
#> 5        8.350993         9.450331           8.900662        39.54933
#> 6       17.496689        17.649007          17.572848        62.13790
#>   strength_std_out strength_std_total strength_median_in strength_median_out
#> 1        227.24232          213.11277                  1                   2
#> 2         22.27089           21.72096                  0                   0
#> 3         18.93197           17.96688                  0                   0
#> 4         24.29633           22.24310                  0                   0
#> 5         45.34294           42.44614                  0                   0
#> 6         66.88569           64.51180                  0                   0
#>   strength_median_total network_share_in network_share_out network_share_total
#> 1                   1.5      0.019334694       0.022594950         0.020964822
#> 2                   0.0      0.002097149       0.002272838         0.002184994
#> 3                   0.0      0.002497454       0.002679814         0.002588634
#> 4                   0.0      0.002470767       0.002915549         0.002693158
#> 5                   0.0      0.002804354       0.003173523         0.002988938
#> 6                   0.0      0.005875577       0.005926727         0.005901152
#>   closeness_in closeness_out closeness_all  betweenness authority_score
#> 1     71.13409      68.44904      78.06787 1.324503e-02      0.26866096
#> 2     42.48817      43.64733      47.16201 0.000000e+00      0.01252200
#> 3     44.78256      39.95772      47.41426 0.000000e+00      0.01406673
#> 4     51.35489      46.60123      54.85391 8.830022e-05      0.01905067
#> 5     63.91481      61.26657      69.47750 0.000000e+00      0.03580770
#> 6     65.51012      63.04273      71.46157 0.000000e+00      0.05049222
#>     hub_score max_out max_in
#> 1 0.183233794    1516   1847
#> 2 0.009730031     160    157
#> 3 0.010671854      91    114
#> 4 0.011275109     147    176
#> 5 0.024732267     424    469
#> 6 0.039622725     547    609