Visualize clusters of individual networks identified by
infoCluster (or another clustering method) applied to a
dynEGA object
Provides visualization modes:
"population": Cluster-level "population" networks, obtained by stacking derivatives across individuals and estimating a new EGA"average": Cluster-average networks, obtained by averaging adjacency matrices across individuals in the cluster
Usage
plot_clusters(
dynEGA.object,
clustering,
include,
type = c("population", "average"),
node.size = 3,
label.size = 1.2,
...
)Arguments
- dynEGA.object
A
dynEGAor adynEGA.ind.popobject- clustering
Vector (length of individuals). A vector of cluster membership for each individual in the
dynEGA.object. A common and easy option is to use aninfoClusterobject containing cluster assignments for individuals (seeinfoCluster). Accepts any vector of memberships- include
Numeric vector. Specifies which cluster memberships should be explicitly included in the plot. By default, all clusters are shown. Use this argument to restrict the visualization to a subset of clusters (e.g., `include = c(1, 3, 5)` will only display clusters 1, 3, and 5)
- type
Character (length = 1). Type of visualization to produce:
"population"(default) — Cluster-level population networks by stacking derivatives across individuals in the cluster and re-estimating withEGA"average"— Averaged networks with a consensus clustering matrix (pairwise) membership similarity that is supplied tocommunity.detection
In either type, the argument setting applied in your `dynEGA.object` will be carried forward into the network estimation (`"population"`) and community detection (both)
- node.size
Numeric (length = 1 or number of variables). Node size in network visualizations. Defaults to
3- label.size
Numeric (length = 1 or number of nodes. Label size in network visualizations. Defaults to
1.2- ...
Additional arguments passed to
EGAandcompare.EGA.plots
Value
Plots created using compare.EGA.plots:
- "population"
A plot combining cluster-level population network plots
- "average"
A plot combining cluster-average network plots
Details
This function provides flexible visualization of individual clusters obtained from
infoCluster (or other clustering input; see examples):
Cluster-level population networks treat each cluster as a "mini-population," stacking derivatives across individuals to re-estimate an EGA
Average networks show the mean connectivity structure for each cluster, with consensus clustering memberships
Function automatically extracts the appropriate derivatives ("population") and
networks ("average") from the dynEGA.object results.
Examples
# Load data
data <- sim.dynEGA
if (FALSE) { # \dontrun{
# Run dynEGA with optimization
optimized_all <- dynEGA(
data = data, level = c("individual", "population"),
n.embed = 3:25, n.embed.optimize = TRUE
)
# Cluster individuals
clust <- infoCluster(dynEGA.object = optimized_all)
# Cluster-level population networks
plot_clusters(
dynEGA.object = optimized_all,
clustering = clust,
type = "population"
)
# Average networks per cluster
plot_clusters(
dynEGA.object = optimized_all,
clustering = clust,
type = "average"
)
# Cluster-level population networks, including only Cluster 2:
plot_clusters(
dynEGA.object = optimized_all,
clustering = clust, include = 2,
type = "population"
)
# Using alternative clusters
plot_clusters(
dynEGA.object = optimized_all,
clustering = rep(1:2, each = 50), # vector of memberships
type = "population"
)
# Run with non-optimized dynEGA
standard_all <- dynEGA(
data = data,
level = c("individual", "population")
)
# Obtain clusters
clust_standard <- infoCluster(dynEGA.object = standard_all)
# Plot clusters with population
plot_clusters(
dynEGA.object = standard_all,
clustering = clust_standard,
type = "population"
)} # }