View source: R/plot_clusters.R
| plot_clusters | R Documentation |
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
plot_clusters(
dynEGA.object,
clustering,
include,
type = c("population", "average"),
node.size = 3,
label.size = 1.2,
...
)
dynEGA.object |
A |
clustering |
Vector (length of individuals).
A vector of cluster membership for each individual in the |
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:
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 |
label.size |
Numeric (length = 1 or number of nodes.
Label size in network visualizations.
Defaults to |
... |
Additional arguments passed to
|
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.
Plots created using compare.EGA.plots:
"population" |
A plot combining cluster-level population network plots |
"average" |
A plot combining cluster-average network plots |
Hudson Golino <hfg9s at virginia.edu>
dynEGA, infoCluster, EGA,
compare.EGA.plots
# Load data
data <- sim.dynEGA
## Not run:
# 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"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.