Learn R Programming

nda (version 0.3.0)

ndr: Generalized Network-Based Dimensionality Reduction and Analysis

Description

Builds a squared-association network, detects indicator communities, and estimates one centrality-weighted latent variable per retained community.

Usage

ndr(r, covar = FALSE, cor_method = 1, cor_type = 1, min_R = 0,
    min_comm = 2, Gamma = 1, null_model_type = 4, mod_mode = 6,
    min_evalue = 0, min_communality = 0, com_communalities = 0,
    use_rotation = FALSE, rotation = "oblimin", weight = NULL,
    seed = NULL, parallel = FALSE, cores = 1L, sparsecalc = FALSE,
    membership = NULL,
    centrality = c("eigenvector", "authority", "hub", "pagerank"),
    standardized = TRUE, P_mat = NULL, test = FALSE,
    p_adjust = "BH", alpha = NULL, bootstrap = FALSE,
    n_boot = 200L, conf = 0.95)

Value

An object of class nda. Important elements include scores, loadings, communality, uniqueness, membership, EVCs, R, correlation, modularity, reconstruction, and stats. The stats list contains indicator p-values, optional bootstrap intervals, retained and dropped indicators, community sizes, and null-model metadata. Scores are unavailable for association-matrix input, but reconstruction-consistent loadings, communalities, and a loading-based reconstructed association matrix are returned.

Arguments

r

Numeric row-level data, or a square association matrix when covar = TRUE. Sparse Matrix inputs are accepted.

covar

Use r as an association matrix instead of estimating associations from rows.

cor_method

Association method. Numeric values 1--6 retain compatibility; textual values are "pearson", "spearman", "kendall", "distance", "gaussian_rank", and "biweight". Gaussian-rank correlation is a fast monotone robust alternative; biweight correlation limits outlier influence.

cor_type

Association type: "full", "partial", or "semipartial"; 1--3 are accepted aliases.

min_R

Minimum squared association retained as an edge.

min_comm

Minimum preferred community size. A singleton is retained when it is the only feasible result.

Gamma

Positive resolution multiplier used by community detection and null-model subtraction.

null_model_type

Null model: 1 configuration-model expectation, 2 mean positive similarity, 3 min_R, or 4 no matrix modification (default).

mod_mode

Community method: Louvain, fast greedy, leading eigenvector, Infomap, Walktrap, or Leiden; either names or values 1--6.

min_evalue

Minimum selected centrality weight for periphery filtering.

min_communality

Minimum indicator communality.

com_communalities

Minimum separation between the two largest squared loadings for common-indicator filtering. Zero disables this filter.

use_rotation

Rotate a multi-factor solution.

rotation

Rotation understood by psych::principal.

weight

One finite observation-score weight per indicator.

seed

Optional random seed.

parallel

Use multicore calculation for pairwise distance associations and bootstrap replicates where supported.

cores

Number of requested cores.

sparsecalc

Store and process the thresholded similarity network as a sparse matrix.

membership

Optional supplied community membership, one value per indicator. Zero excludes an indicator.

centrality

Latent-variable weighting: eigenvector, authority, hub, or PageRank centrality.

standardized

Standardize input indicators using training means and standard deviations before weighting.

P_mat

Optional finite expected-edge matrix. When supplied it overrides null_model_type.

test

Calculate association p-values.

p_adjust

Method passed to p.adjust for false-discovery-rate control.

alpha

Optional adjusted-p threshold; nonsignificant associations are set to zero.

bootstrap

Bootstrap loading intervals from row-level data.

n_boot

Number of bootstrap replicates.

conf

Bootstrap confidence level.

Details

The method follows three stages: construct a squared-association graph, detect network communities, and form standardized centrality-weighted latent scores. Partial and semipartial networks can be asymmetric. Null-model types 1--3 operate on nonnegative residual similarities; type 4 leaves the similarity matrix unchanged.

References

Kosztyan, Z. T., Kurbucz, M. T., and Katona, A. I. (2022). Network-based dimensionality reduction of high-dimensional, low-sample-size datasets. Knowledge-Based Systems, 109180. tools:::Rd_expr_doi("10.1016/j.knosys.2022.109180").

Kosztyan, Z. T., Katona, A. I., Kurbucz, M. T., and Lantos, Z. (2024). Generalized network-based dimensionality analysis. Expert Systems with Applications, 238, 121779. tools:::Rd_expr_doi("10.1016/j.eswa.2023.121779").

Examples

Run this code
fit <- ndr(swiss, cor_method = "spearman", centrality = "pagerank")
summary(fit)
scores <- predict(fit, swiss[1:3, ])

association <- cor(swiss)
fit_matrix <- ndr(association, covar = TRUE, membership = c(1, 1, 1, 2, 2, 2))
fit_matrix$loadings

if (FALSE) {
fit_boot <- ndr(swiss, cor_method = "distance", test = TRUE,
                bootstrap = TRUE, n_boot = 500, parallel = TRUE, cores = 4)
}

Run the code above in your browser using DataLab