Calculate node-level diversity of ties through Simpson's Diversity Index.
simpsd(g, dim, values, mode = "all", std = FALSE, include_att = TRUE)
g | igraph graph |
---|---|
dim | Character string; dimension on which to calculate diversity--the name of a graph attribute in quotes (e.g., "race") |
values | Optional vector of character strings; all possible values of dim (e.g., c("Black", "White", "Latinx", "Asian")). If not provided, will assume that all possible values are represented in graph attributes and will issue message listing those values. Only used if std = TRUE. To suppress message, use values = NULL. |
mode | Character string; calculate diversity of all ties of a node ("all"; default), or just outgoing ties ("out") or incoming ties ("in"). |
std | Logical; if FALSE (default), Simpson's D will not be standardized (the maximum D will decrease as the number of groups increases) and can be interpreted as the probability that two individuals picked at random come from the same group; if TRUE, will use standardized version of Simpson's D (see Details) such that 1 = maximum diversity for that attribute (i.e., ties are equally distributed across all possible groups). |
include_att | Logical; if TRUE (default), will include a column containing node values of specified dimension (e.g., participants' races) |
A dataframe of Simpson's D for a particular attribute, along with optional node values for that attribute. Simpson's D will be NaN for individuals with no ties.
Simpson's D is standardized by dividing by 1 - (1/k), where k is the number of groups in the network.
Simpson, E. H. (1949). Measurement of diversity. Nature, 163, 688; Mcdonald, D. G., & Dimmick, J. (2003). The Conceptualization and Measurement of Diversity. Communication Research, 30(1), 60–79. https://doi.org/10.1177/0093650202239026