boot_and_evaluate: Bootstrap and Evaluate Network Analysis

View source: R/boot_and_evaluate.R

boot_and_evaluateR Documentation

Bootstrap and Evaluate Network Analysis

Description

Performs bootstrap evaluation of network analysis algorithms.

Usage

boot_and_evaluate(
  data,
  true_network,
  algorithms,
  correlation_methods,
  sample_sizes = c(100, 250, 500, 1000),
  n_simulations = 100,
  seed = NULL,
  n_cores = 2
)

Arguments

data

Data frame with the data.

true_network

Reference network used as the truth: an object returned by EGAnet::EGA() (its network element is compared with each estimate).

algorithms

Vector of algorithm names to evaluate.

correlation_methods

Vector of correlation methods.

sample_sizes

Vector of sample sizes to test (default c(100, 250, 500, 1000)).

n_simulations

Number of simulations (default 100).

seed

Optional random seed for reproducible results. NULL (default) leaves the random number generator untouched.

n_cores

Number of cores for parallel processing (default 2). With n_cores = 1 the simulations run sequentially.

Value

Data frame with performance metrics.

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))

true_net <- EGAnet::EGA(items, plot.EGA = FALSE)
res <- boot_and_evaluate(items, true_network = true_net,
                         algorithms = "walktrap",
                         correlation_methods = "pearson",
                         sample_sizes = c(100, 200),
                         n_simulations = 2, seed = 1, n_cores = 1)
head(res)


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