modularity {EGAnet} | R Documentation |
Computes the (Signed) Modularity Statistic
Description
Computes (signed) modularity statistic given a network and community structure. Allows the resolution parameter to be set
Usage
modularity(network, memberships, resolution = 1, signed = FALSE)
Arguments
network |
Matrix or data frame. A symmetric matrix representing a network |
memberships |
Numeric (length = |
resolution |
Numeric (length = 1).
A parameter that adjusts modularity to
prefer smaller ( |
signed |
Boolean (length = 1).
Whether signed or absolute modularity should be computed.
The most common modularity metric is defined by positive values only.
Gomez et al. (2009) introduced a signed version of modularity that
will discount modularity for edges with negative values. This property
isn't always desired for psychometric networks. If |
Value
Returns the modularity statistic
Author(s)
Alexander P. Christensen <alexpaulchristensen@gmail.com> with assistance from GPT-4
References
Gomez, S., Jensen, P., & Arenas, A. (2009). Analysis of community structure in networks of correlated data. Physical Review E, 80(1), 016114.
Examples
# Load data
wmt <- wmt2[,7:24]
# Estimate EGA
ega.wmt <- EGA(wmt, model = "glasso")
# Compute standard (absolute values) modularity
modularity(
network = ega.wmt$network,
memberships = ega.wmt$wc,
signed = FALSE
)
# 0.1697952
# Compute signed modularity
modularity(
network = ega.wmt$network,
memberships = ega.wmt$wc,
signed = TRUE
)
# 0.1701946