These functions offer ways to measure the heterogeneity of an attribute across a network, within groups of a network, or the distribution of ties across this attribute:

  • net_richness() measures the number of unique categories in a network attribute.

  • node_richness() measures the number of unique categories of an attribute to which each node is connected.

  • net_diversity() measures the heterogeneity of ties across a network or within clusters by node attributes.

  • node_diversity() measures the heterogeneity of each node's local neighbourhood.

  • net_heterophily() measures how embedded nodes in the network are within groups of nodes with the same attribute.

  • node_heterophily() measures each node's embeddedness within groups of nodes with the same attribute.

  • net_assortativity() measures the degree assortativity in a network.

  • net_spatial() measures the spatial association/autocorrelation (global Moran's I) in a network.

net_richness(.data, attribute)

node_richness(.data, attribute)

net_diversity(.data, attribute, clusters = NULL)

node_diversity(.data, attribute)

net_heterophily(.data, attribute)

node_heterophily(.data, attribute)

net_assortativity(.data)

net_spatial(.data, attribute)

Arguments

.data

An object of a manynet-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

attribute

Name of a nodal attribute or membership vector to use as categories for the diversity measure.

clusters

A nodal cluster membership vector or name of a vertex attribute.

net_diversity

Blau's index (1977) uses a formula known also in other disciplines by other names (Gini-Simpson Index, Gini impurity, Gini's diversity index, Gibbs-Martin index, and probability of interspecific encounter (PIE)): $$1 - \sum\limits_{i = 1}^k {p_i^2 }$$, where \(p_i\) is the proportion of group members in \(i\)th category and \(k\) is the number of categories for an attribute of interest. This index can be interpreted as the probability that two members randomly selected from a group would be from different categories. This index finds its minimum value (0) when there is no variety, i.e. when all individuals are classified in the same category. The maximum value depends on the number of categories and whether nodes can be evenly distributed across categories.

net_homophily

Given a partition of a network into a number of mutually exclusive groups then The E-I index is the number of ties between (or external) nodes grouped in some mutually exclusive categories minus the number of ties within (or internal) these groups divided by the total number of ties. This value can range from 1 to -1, where 1 indicates ties only between categories/groups and -1 ties only within categories/groups.

References

On diversity

Blau, Peter M. 1977. Inequality and heterogeneity. New York: Free Press.

On heterophily

Krackhardt, David, and Robert N. Stern. 1988. Informal networks and organizational crises: an experimental simulation. Social Psychology Quarterly 51(2): 123-140. doi:10.2307/2786835

McPherson, Miller, Lynn Smith-Lovin, and James M. Cook. 2001. "Birds of a Feather: Homophily in Social Networks". Annual Review of Sociology, 27(1): 415-444. doi:10.1146/annurev.soc.27.1.415

On assortativity

Newman, Mark E.J. 2002. "Assortative Mxing in Networks". Physical Review Letters, 89(20): 208701. doi:10.1103/physrevlett.89.208701

On spatial autocorrelation

Moran, Patrick Alfred Pierce. 1950. "Notes on Continuous Stochastic Phenomena". Biometrika 37(1): 17-23. doi:10.2307/2332142

Examples

net_richness(ison_networkers)
#> [1] 3
node_richness(ison_networkers, "Discipline")
#>   `Lin Freeman` `Doug White` `Ev Rogers` `Richard Alba` `Phipps Arabie`
#> 1             4            4           2              4               4
#> # ... with 27 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
marvel_friends <- to_unsigned(ison_marvel_relationships, "positive")
net_diversity(marvel_friends, "Gender")
#> [1] 0.306
net_diversity(marvel_friends, "Attractive")
#> [1] 0.35
net_diversity(marvel_friends, "Gender", "Rich")
#> [1] 0.337 0.165
node_diversity(marvel_friends, "Gender")
#>   Abomination `Ant-Man` Apocalypse Beast `Black Panther` `Black Widow` Blade
#> 1           0      0.48          0 0.363            0.34         0.337     0
#> # ... with 46 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
node_diversity(marvel_friends, "Attractive")
#>   Abomination `Ant-Man` Apocalypse Beast `Black Panther` `Black Widow` Blade
#> 1           0      0.32          0 0.172           0.159         0.133     0
#> # ... with 46 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
net_heterophily(marvel_friends, "Gender")
#> [1] -0.285
net_heterophily(marvel_friends, "Attractive")
#> [1] -0.632
node_heterophily(marvel_friends, "Gender")
#>   Abomination `Ant-Man` Apocalypse Beast `Black Panther` `Black Widow` Blade
#> 1         NaN       0.5         -1  -0.5          -0.545         0.692    -1
#> # ... with 46 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
node_heterophily(marvel_friends, "Attractive")
#>   Abomination `Ant-Man` Apocalypse Beast `Black Panther` `Black Widow` Blade
#> 1         NaN      -0.5         -1  -0.8          -0.818        -0.846    -1
#> # ... with 46 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
net_assortativity(ison_networkers)
#> [1] -0.41
net_spatial(ison_lawfirm, "age")
#> [1] 0.126