View source: R/centrality_duo_plot.R
| centrality_duo_plot | R Documentation |
Creates a plot comparing two centrality measures.
centrality_duo_plot(
qgraph_obj,
network,
groups = NULL,
measure0 = "ExpectedInfluence",
measure1 = NULL,
color_palette = c("#6C5CE7", "#00B894"),
use_abbrev = TRUE,
labels = NULL
)
qgraph_obj |
A qgraph object. |
network |
Estimated network object (e.g., from bootnet). |
groups |
List of communities for bridge calculation. |
measure0 |
Primary centrality measure name. |
measure1 |
Secondary bridge measure name (NULL for single measure). |
color_palette |
Character vector of colors. |
use_abbrev |
Logical; use abbreviated node names. |
labels |
Optional character vector of custom node labels. |
A list with table (a data frame with the centrality values of
each node) and plot (a ggplot object).
set.seed(123)
n <- 300
f1 <- rnorm(n)
f2 <- 0.3 * f1 + rnorm(n)
items <- data.frame(
sapply(1:4, function(i) 0.7 * f1 + rnorm(n, 0, 0.7)),
sapply(1:4, function(i) 0.7 * f2 + rnorm(n, 0, 0.7))
)
names(items) <- c(paste0("A", 1:4), paste0("B", 1:4))
net <- bootnet::estimateNetwork(items, default = "EBICglasso")
g <- qgraph::qgraph(net$graph, DoNotPlot = TRUE)
res <- centrality_duo_plot(g, net,
groups = rep(c("A", "B"), each = 4),
measure1 = "Bridge Expected Influence (1-step)")
res$plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.