compute_netScores: Compute Network Scores

View source: R/compute_netScores.R

compute_netScoresR Documentation

Compute Network Scores

Description

Computes network scores with stability analysis using EGA.

Usage

compute_netScores(
  item_prefixes,
  data,
  rename_dims = TRUE,
  custom_names = NULL,
  add_sums = TRUE,
  stability_threshold = 0.7,
  stability_corr = "spearman",
  stability_model = "glasso",
  stability_algorithm = "louvain",
  stability_iter = 1000,
  stability_seed_start = NULL,
  stability_type = "resampling",
  stability_ncores = 2,
  stability_max_iter = 10,
  stability_plot = TRUE,
  ega_plot = TRUE,
  verbose = TRUE
)

Arguments

item_prefixes

Character vector of item prefix patterns.

data

Data frame with item responses.

rename_dims

Logical; ask for a name for each dimension. The prompt only appears in interactive sessions; otherwise, or when FALSE, the default names are used.

custom_names

Optional named list of dimension names.

add_sums

Logical; compute sum scores per dimension.

stability_threshold

Minimum item stability threshold.

stability_corr

Correlation method for stability analysis.

stability_model

Network model for stability analysis.

stability_algorithm

Community detection algorithm.

stability_iter

Number of bootstrap iterations.

stability_seed_start

Optional starting random seed (see refine_items_by_stability()). NULL (default) leaves the seed to EGAnet::bootEGA().

stability_type

Bootstrap type.

stability_ncores

Number of CPU cores (default 2).

stability_max_iter

Maximum refinement iterations.

stability_plot

Logical; plot item stability.

ega_plot

Logical; plot EGA results.

verbose

Logical; report the progress of each step as messages.

Value

A list of class ega_network_scores with data_complete (the data with the network scores and sums appended), net_scores, dimension_sums, dimensions_list, dimension_names, ega_objects, scale_columns, stability_results and removed_items.

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("SC", 1:4), paste0("SC", 5:8))

scores <- compute_netScores("SC", items, rename_dims = FALSE,
                            stability_corr = "pearson",
                            stability_iter = 20, stability_seed_start = 1,
                            stability_ncores = 1, stability_plot = FALSE,
                            ega_plot = FALSE)
head(scores$net_scores)


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