View source: R/centrality_plots2.R
| centrality_plots2 | R Documentation |
Creates centrality plots with optional bridge metrics.
centrality_plots2(
qgraph_obj,
network,
groups = NULL,
measure0 = "ExpectedInfluence",
measure1 = NULL,
color_palette = c("#FF0000", "#00A08A"),
labels = NULL,
legend_labels = NULL,
use_abbrev = TRUE
)
qgraph_obj |
A qgraph object. |
network |
Estimated network object. |
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. |
labels |
Named vector mapping node names to custom labels. |
legend_labels |
Custom legend labels. |
use_abbrev |
Logical; use abbreviated node names. |
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_plots2(g, net,
groups = rep(c("A", "B"), each = 4),
measure1 = "Bridge Expected Influence (1-step)")
res$table
res$plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.