calculate_centrality_sd_correlation: Centrality-SD Correlation

View source: R/calculate_centrality_sd_correlation.R

calculate_centrality_sd_correlationR Documentation

Centrality-SD Correlation

Description

Calculates correlation between centrality indices and standard deviations.

Usage

calculate_centrality_sd_correlation(Data, Centralitys)

Arguments

Data

Data frame with the original data (one column per node).

Centralitys

A list with a table element: a data frame with a node column and two centrality indices in its third and fourth columns.

Value

A correlation object (from the correlation package) with the correlation of each of the two centrality indices with the standard deviation of the nodes.

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")
ct <- qgraph::centralityTable(net)
ct <- ct[ct$measure %in% c("Strength", "ExpectedInfluence"),
         c("graph", "node", "measure", "value")]
tab <- tidyr::pivot_wider(ct, names_from = "measure", values_from = "value")
calculate_centrality_sd_correlation(items, list(table = tab))

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