centrality_duo_plot: Dual Centrality Plot

View source: R/centrality_duo_plot.R

centrality_duo_plotR Documentation

Dual Centrality Plot

Description

Creates a plot comparing two centrality measures.

Usage

centrality_duo_plot(
  qgraph_obj,
  network,
  groups = NULL,
  measure0 = "ExpectedInfluence",
  measure1 = NULL,
  color_palette = c("#6C5CE7", "#00B894"),
  use_abbrev = TRUE,
  labels = NULL
)

Arguments

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.

Value

A list with table (a data frame with the centrality values of each node) and plot (a ggplot object).

Examples

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

InterconectaR documentation built on Oct. 16, 2026, 1:06 a.m.