net_reduce2: Network Reduction

View source: R/net_reduce2.R

net_reduce2R Documentation

Network Reduction

Description

Reduces redundant node pairs using PCA or best goldbricker selection.

Usage

net_reduce2(
  data,
  badpairs,
  method = c("PCA", "best_goldbricker"),
  keep_unpaired = TRUE
)

Arguments

data

Data frame with item responses.

badpairs

Goldbricker object or list of redundant node pairs.

method

Reduction method: "PCA" or "best_goldbricker".

keep_unpaired

Logical; keep unpaired items in result.

Value

A list with data (the reduced data frame), removed_items, added_variables, kept_from_original and pair_summary (a data frame describing what was done with each redundant pair).

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))
# a near-duplicate of A1
items$A1_copy <- items$A1 + rnorm(n, 0, 0.2)

redundant <- networktools::goldbricker(items, threshold = 0.5)
reduced <- net_reduce2(items, redundant, method = "PCA")
reduced$pair_summary

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