Calculates several centrality measures. See 'Details' for information about the measures.
Usage
centralities(x, loops = FALSE, normalize = FALSE, invert = TRUE, measures)
# S3 method for class 'tna'
centralities(x, loops = FALSE, normalize = FALSE, invert = TRUE, measures)
# S3 method for class 'matrix'
centralities(x, loops = FALSE, normalize = FALSE, invert = TRUE, measures)
# S3 method for class 'group_tna'
centralities(x, loops = FALSE, normalize = FALSE, invert = TRUE, measures)Arguments
- x
A
tnaobject, agroup_tnaobject, or a squarematrixrepresenting edge weights.- loops
A
logicalvalue indicating whether to include loops in the network when computing the centrality measures. The default isFALSE.- normalize
A
logicalvalue indicating whether the centralities should be normalized. The default isFALSE.Diffusionis always normalized (see 'Details').- invert
A
logicalvalue indicating whether the weights should be inverted for distance-based measures. The default isTRUE.- measures
A
charactervector indicating which centrality measures should be computed. If missing, all available measures are returned. See 'Details' for the available measures.
Value
A tna_centralities object, which is a tibble (tbl_df) with
one row per state, the column state, and one numeric column per
requested measure (in the order listed in 'Details'). For a group_tna
object, a group_tna_centralities object: the same table for every
group stacked, with the group name in the first column group.
Details
The following measures are provided:
OutStrength: Outgoing strength centrality, calculated usingigraph::strength()withmode = "out". It measures the total weight of the outgoing edges from each node.InStrength: Incoming strength centrality, calculated usingigraph::strength()withmode = "in". It measures the total weight of the incoming edges to each node.ClosenessIn: Closeness centrality (incoming), calculated usingigraph::closeness()withmode = "in". It measures how close a node is to all other nodes based on the incoming paths.ClosenessOut: Closeness centrality (outgoing), calculated usingigraph::closeness()withmode = "out". It measures how close a node is to all other nodes based on the outgoing paths.Closeness: Closeness centrality (overall), calculated usingigraph::closeness()withmode = "all". It measures how close a node is to all other nodes based on both incoming and outgoing paths.Betweenness: Betweenness centrality defined by the number of geodesics calculated usingigraph::betweenness().BetweennessRSP: Betweenness centrality based on randomized shortest paths (Kivimäki et al. 2016). It measures the extent to which a node lies on the shortest paths between other nodes.Diffusion: Diffusion centrality of Banerjee et.al. (2014). It measures the influence of a node in spreading information through the network. Diffusion is always min-max normalized to the range from 0 to 1, whatever the value ofnormalize, because its raw values grow with powers of the edge weights (for a frequency model they easily exceed1e30). When the raw values are equal for every state, for example in a relative transition network withloops = TRUEwhere every row sums to one, the normalized values areNaN: the measure does not distinguish the states.Clustering: Signed clustering coefficient of Zhang and Horvath (2005) based on the symmetric adjacency matrix (sum of the adjacency matrix and its transpose). It measures the degree to which nodes tend to cluster together.PageRank: Weighted PageRank centrality calculated usingigraph::page_rank()on the directed transition network.
References
Banerjee, A., Chandrasekhar, A. G., Duflo, E., & Jackson, M. O. (2014). Gossip: Identifying central individuals in a social network. Working Paper.
Kivimaki, I., Lebichot, B., Saramaki, J., & Saerens, M. (2016). Two betweenness centrality measures based on randomized shortest paths. Scientific Reports, 6, 19668. doi:10.1038/srep19668
Zhang, B., & Horvath, S. (2005). A general framework for weighted gene co-expression network analysis. Statistical Applications in Genetics and Molecular Biology, 4(1), Article 17. doi:10.2202/1544-6115.1128
See also
Centrality measure functions
betweenness_network(),
plot.group_tna_centralities(),
plot.tna_centralities(),
print.group_tna_centralities(),
print.tna_centralities()
Examples
model <- tna(group_regulation)
# Centrality measures excluding loops in the network (the default)
centralities(model)
#> # A tibble: 9 × 11
#> state OutStrength InStrength ClosenessIn ClosenessOut Closeness Betweenness
#> * <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 adapt 1 0.345 0.00834 0.0152 0.0248 1
#> 2 cohesion 0.973 0.812 0.0138 0.0124 0.0265 0
#> 3 consens… 0.918 2.67 0.0351 0.0125 0.0383 30
#> 4 coregul… 0.977 0.567 0.0155 0.0150 0.0210 0
#> 5 discuss 0.805 1.19 0.0196 0.0131 0.0271 16
#> 6 emotion 0.923 0.894 0.0141 0.0121 0.0231 5
#> 7 monitor 0.982 0.346 0.00758 0.0137 0.0193 0
#> 8 plan 0.626 1.19 0.0274 0.0115 0.0274 9
#> 9 synthes… 1 0.192 0.00997 0.0158 0.0243 7
#> # ℹ 4 more variables: BetweennessRSP <dbl>, Diffusion <dbl>, Clustering <dbl>,
#> # PageRank <dbl>
# Centrality measures including loops in the network
centralities(model, loops = TRUE)
#> # A tibble: 9 × 11
#> state OutStrength InStrength ClosenessIn ClosenessOut Closeness Betweenness
#> * <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 adapt 1 0.345 0.00834 0.0152 0.0248 1
#> 2 cohesion 1 0.839 0.0138 0.0124 0.0265 0
#> 3 consens… 1 2.75 0.0351 0.0125 0.0383 30
#> 4 coregul… 1 0.590 0.0155 0.0150 0.0210 0
#> 5 discuss 1 1.38 0.0196 0.0131 0.0271 16
#> 6 emotion 1 0.971 0.0141 0.0121 0.0231 5
#> 7 monitor 1 0.364 0.00758 0.0137 0.0193 0
#> 8 plan 1 1.57 0.0274 0.0115 0.0274 9
#> 9 synthes… 1 0.192 0.00997 0.0158 0.0243 7
#> # ℹ 4 more variables: BetweennessRSP <dbl>, Diffusion <dbl>, Clustering <dbl>,
#> # PageRank <dbl>
# Centrality measures normalized
centralities(model, normalize = TRUE)
#> # A tibble: 9 × 11
#> state OutStrength InStrength ClosenessIn ClosenessOut Closeness Betweenness
#> * <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 adapt 1 0.0618 0.0276 0.855 0.290 0.0333
#> 2 cohesion 0.927 0.250 0.226 0.205 0.382 0
#> 3 consens… 0.781 1 1 0.240 1 1
#> 4 coregul… 0.938 0.151 0.289 0.816 0.0928 0
#> 5 discuss 0.479 0.403 0.436 0.365 0.412 0.533
#> 6 emotion 0.795 0.284 0.237 0.128 0.202 0.167
#> 7 monitor 0.952 0.0623 0 0.508 0 0
#> 8 plan 0 0.405 0.721 0 0.428 0.3
#> 9 synthes… 1 0 0.0867 1 0.265 0.233
#> # ℹ 4 more variables: BetweennessRSP <dbl>, Diffusion <dbl>, Clustering <dbl>,
#> # PageRank <dbl>
