refine_items_by_stability: Iteratively refine items by bootstrap stability

View source: R/refine_items_by_stability.R

refine_items_by_stabilityR Documentation

Iteratively refine items by bootstrap stability

Description

Iteratively refine items by bootstrap stability

Usage

refine_items_by_stability(
  data,
  threshold = 0.8,
  corr = "spearman",
  model = "glasso",
  algorithm = "louvain",
  iter = 1000,
  seed_start = NULL,
  type = "resampling",
  ncores = 2,
  max_iter = 10,
  plot.itemStability = FALSE
)

Arguments

data

A data frame of items to analyze.

threshold

Stability threshold (default: 0.80).

corr

Correlation method (default: "spearman").

model

Network model (default: "glasso").

algorithm

Community detection algorithm (default: "louvain").

iter

Number of bootstrap iterations (default: 1000).

seed_start

Optional starting seed. When supplied, refinement round i uses the seed seed_start + i - 1, which makes the results reproducible. NULL (default) leaves the seed to EGAnet::bootEGA().

type

Bootstrap type (default: "resampling").

ncores

Number of cores for parallel processing (default: 2).

max_iter

Maximum number of refinement iterations (default: 10).

plot.itemStability

Logical; plot item stability (default: FALSE).

Value

A list containing the final bootstrap result, stability data, removed items, plots, and dimension consistency tables.

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

refined <- refine_items_by_stability(items, corr = "pearson", iter = 20,
                                     seed_start = 1, ncores = 1)
refined$stability_df
refined$removed_items


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