Skip to contents

Memberships from community detection algorithms do not always align numerically. This function seeks to homogenize community memberships between a target membership (the membership to homogenize toward) and one or more other memberships. This function is the core of the dimensionStability and itemStability functions

Usage

community.homogenize(target.membership, convert.membership)

Arguments

target.membership

Vector, matrix, or data frame. The target memberships that all other memberships input into convert.membership should be homogenize toward

convert.membership

Vector, matrix, or data frame. Either a vector of memberships the same length as target.membership or a matrix or data frame of many membership solutions with either across rows or down columns the same length as target.membership (this function will automatically determine this orientation for you with precedence given solutions across rows)

Value

Returns a vector or matrix the length or size of convert.membership with memberships homogenized toward target.membership

References

Original implementation of bootEGA
Christensen, A. P., & Golino, H. (2021). Estimating the stability of the number of factors via Bootstrap Exploratory Graph Analysis: A tutorial. Psych, 3(3), 479-500.

Author

Hudson Golino <hfg9s at virginia.edu> and Alexander P. Christensen <alexpaulchristensen@gmail.com>

Examples

# Get network
network <- network.estimation(wmt2[,7:24])

# Apply Walktrap
network_walktrap <- community.detection(
  network, algorithm = "walktrap"
)

# Apply Louvain
network_louvain <- community.detection(
  network, algorithm = "louvain"
)

# Homogenize toward Walktrap
community.homogenize(network_walktrap, network_louvain)
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
#> [1,]    1    1    1    1    1    2    2    2    3     3     2     2     3     3
#>      [,15] [,16] [,17] [,18]
#> [1,]     2     3     2     2