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:
node_by_richness() measures the number of unique categories
of an attribute to which each node is connected.
node_by_diversity() measures the heterogeneity of each node's
alters, not including the node itself.
Nodes without alters return NA.
node_by_richness(.data, attribute)
node_by_diversity(
.data,
attribute,
diversity = c("blau", "teachman", "variation", "gini", "rao"),
normalized = TRUE,
distance = NULL
)A network object of class stocnet, igraph, tbl_graph, network, or similar.
Internally any of these will be coerced to an efficient implementation.
For more information on possible coercions, see e.g. manynet::as_stocnet().
Name of a nodal attribute, mark, measure, or membership vector. Where none is named and the network holds only one nodal attribute besides the reserved ones, such as "label" and "mode", that one is used.
Which method to use for *_diversity().
Either "blau" (Blau's index), "teachman" (Teachman's index),
or "rao" (Rao-Stirling diversity) for categorical attributes,
or "variation" (coefficient of variation) or "gini" (Gini coefficient) for numeric attributes.
Default is "blau".
If an incompatible method is chosen for the attribute type,
a suitable alternative will be used instead with a message.
Logical scalar, whether Blau's index is divided by its maximum for the attribute, \(1 - 1/k\), where \(k\) is the number of categories the attribute holds in the network. The index then runs from 0 to 1 whatever the number of categories, as the index of qualitative variation does (Agresti and Agresti 1978). The other indices are left as they are. By default TRUE.
For diversity = "rao", the distances among the
categories of the attribute: a matrix whose row and column names are the
categories, or a one-mode network of the categories,
with values between 0 (the same) and 1 (the most different).
By default NULL, so every two categories are 1 apart.
A node_measure numeric vector the length of the nodes in the network,
providing the scores for each node.
If the network is labelled,
then the scores will be labelled with the nodes' names.
The object also carries the measure it computed, the range its values
can fall within, and whether and how those values were normalized.
These are shown as a one-line header when the object is printed.
Where a measure offers a choice between several ways of counting the
same thing, it also carries the variant it used.
All can be retrieved with attr().
Other diversity:
measure_assort_net,
measure_assort_node,
measure_diverse_dispersion,
measure_diverse_net,
measure_diverse_tie,
motif_composition,
motif_homophily
Other measures:
measure_accuracy_net,
measure_accuracy_node,
measure_assort_net,
measure_assort_node,
measure_breadth,
measure_broker_node,
measure_brokerage,
measure_central_between,
measure_central_close,
measure_central_degree,
measure_central_eigen,
measure_central_tie_between,
measure_central_tie_close,
measure_central_tie_degree,
measure_central_tie_eigen,
measure_closure,
measure_closure_node,
measure_cohesion,
measure_core,
measure_diffusion_infection,
measure_diffusion_net,
measure_diffusion_node,
measure_diverse_dispersion,
measure_diverse_net,
measure_diverse_tie,
measure_domain,
measure_features,
measure_fit,
measure_fragmentation,
measure_hierarchy,
measure_opinion,
measure_periods,
tie_by_width()
Other nodal:
mark_core,
mark_degree,
mark_diff,
mark_nodes,
mark_select_node,
measure_accuracy_node,
measure_assort_node,
measure_broker_node,
measure_brokerage,
measure_central_between,
measure_central_close,
measure_central_degree,
measure_central_eigen,
measure_closure_node,
measure_core,
measure_diffusion_node,
measure_domain,
measure_opinion,
member_brokerage,
member_cliques,
member_community,
member_community_hier,
member_community_modular,
member_community_partition,
member_community_spread,
member_components,
member_core,
member_diffusion,
member_equivalence,
motif_accuracy_node,
motif_brokerage_node,
motif_clique,
motif_composition,
motif_exposure,
motif_node,
motif_path
node_by_richness(ison_networkers, "Discipline")
#> # Richness [0, Inf)
#> ▂▃▁▅
#> `Lin Freeman` `Doug White` `Ev Rogers` `Richard Alba` `Phipps Arabie`
#> 1 4 4 2 4 4
#> # ... and 27 more values from this nodeset. Use `print_all(...)` to print all values.
marvel_friends <- to_unsigned(to_layer(fict_marvel, "relationship"), "positive")
node_by_diversity(marvel_friends, "Gender")
#> # Blau's index, normalized [0, 1]
#> ▂▁▁▄▂
#> Abomination `Ant-Man` Apocalypse Beast `Black Panther` `Black Widow` Blade
#> 1 NA 0.75 0 0.75 0.702 0.521 0
#> # ... and 46 more values from this nodeset. Use `print_all(...)` to print all values.
node_by_diversity(marvel_friends, "Attractive")
#> # Coefficient of variation (-Inf, Inf)
#> ▂▅▁▁▁▁▁▁
#> Abomination `Ant-Man` Apocalypse Beast `Black Panther` `Black Widow` Blade
#> 1 NA 0.667 NA 0.342 0.324 0.3 0
#> # ... and 46 more values from this nodeset. Use `print_all(...)` to print all values.