| Title: | Generalized Network-Based Dimensionality Reduction and Analysis |
|---|---|
| Description: | Constructs interpretable latent variables from communities in squared-association networks. Supports full, partial, and semipartial associations, feature selection, sparse networks, inference, prediction, visualization, and supervised regression. The generalized method is described in Kosztyan et al. (2024) <doi:10.1016/j.eswa.2023.121779>. |
| Authors: | Zsolt T. Kosztyan [aut, cre], Marcell T. Kurbucz [aut], Attila I. Katona [aut], Zahid Khan [aut] |
| Maintainer: | Zsolt T. Kosztyan <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.3.0 |
| Built: | 2026-10-07 11:51:21 UTC |
| Source: | https://github.com/kzst/nda |
The package of Generalized Network-based Dimensionality Reduction and Analysis (GNDA).
Zsolt T. Kosztyan*, Marcell T. Kurbucz, Attila I. Katona, Zahid Khan
e-mail*: [email protected]
Kosztyan, Z. T., Kurbucz, M. T., & Katona, A. I. (2022). Network-based dimensionality reduction of high-dimensional, low-sample-size datasets. Knowledge-Based Systems, 109180.
Kosztyan, Z. T., Katona, A. I., Kurbucz, M. T., & Lantos, Z. (2024). Generalized network-based dimensionality analysis. Expert Systems with Applications, 238, 121779. <URL: https://doi.org/10.1016/j.eswa.2023.121779>.
ndr, ndrlm, plot, biplot, summary, dCor.
Creates a printable two-dimensional biplot or a sequence of three-factor projections.
## S3 method for class 'nda' biplot(x, main = NULL, dims = c(1, 2), view_3D = FALSE, triples = NULL, interactive = FALSE, angle = 45, point_cex = 0.7, label_cex = 0.9, ...)## S3 method for class 'nda' biplot(x, main = NULL, dims = c(1, 2), view_3D = FALSE, triples = NULL, interactive = FALSE, angle = 45, point_cex = 0.7, label_cex = 0.9, ...)
x |
An |
main |
Optional title. |
dims |
Two factors for the two-dimensional view. |
view_3D |
Display three-factor projections. |
triples |
Optional list of factor triples. By default all triples are used. |
interactive |
Use plotly for rotatable 3D views. |
angle |
Static axonometric projection angle in degrees. |
point_cex, label_cex
|
Observation and loading-label size. |
... |
Additional two-dimensional base-graphics arguments. |
An nda_biplot object; printing it renders the selected view or views.
fit <- ndr(swiss) b <- biplot(fit, dims = c(1, 2)) bfit <- ndr(swiss) b <- biplot(fit, dims = c(1, 2)) b
Sample datasets for Generalized Network-based Dimensionality Reduction and Analysis (GNDA)
Covid'19 of countries (2020), where the data frame has 138 observations of 18 variables.
data("COVID19_2020")data("COVID19_2020")
A data frame with 138 observations 18 variables.
Kurbucz, M. T. (2020). A joint dataset of official COVID-19 reports and the governance, trade and competitiveness indicators of World Bank group platforms. Data in brief, 31, 105881.
data(COVID19_2020)data(COVID19_2020)
Sample datasets for Generalized Network-based Dimensionality Reduction and Analysis (GNDA)
Crimes in USA cities in 1990. Independent variables (X)
data("CrimesUSA1990.X")data("CrimesUSA1990.X")
A data frame with 1994 observations 123 variables.
UCI - Machine Learning Repository: https://archive.ics.uci.edu/ml/datasets/communities+and+crime
data(CrimesUSA1990.X)data(CrimesUSA1990.X)
Sample datasets for Generalized Network-based Dimensionality Reduction and Analysis (GNDA)
Crimes in USA cities in 1990. Dependent variable (Y)
data("CrimesUSA1990.Y")data("CrimesUSA1990.Y")
A data frame with 1994 observations 1 variables.
UCI - Machine Learning Repository: https://archive.ics.uci.edu/ml/datasets/communities+and+crime
data(CrimesUSA1990.Y)data(CrimesUSA1990.Y)
Sample datasets for Generalized Network-based Dimensionality Reduction and Analysis (GNDA)
CWTS Leiden's 2020 dataset, where the data frame has 1176 observations of 42 variables.
data("CWTS_2020")data("CWTS_2020")
A data frame with 1176 observations of 42 variables.
CWTS Leiden Ranking 2020: https://www.leidenranking.com/ranking/2020/list
data(CWTS_2020)data(CWTS_2020)
Generates a noisy block matrix without constructing intermediate block-diagonal matrices.
data_gen(n, m, nfactors = 2, lambda = 1, sparse = FALSE, density = 1, seed = NULL)data_gen(n, m, nfactors = 2, lambda = 1, sparse = FALSE, density = 1, seed = NULL)
n |
Positive number of rows. |
m |
Positive number of columns. |
nfactors |
Positive number of blocks. |
lambda |
Finite exponential smoothing parameter. |
sparse |
Return a sparse Matrix object. |
density |
Proportion in (0, 1] of block entries retained as nonzero. |
seed |
Optional random seed. |
A data frame, or a sparse matrix when sparse = TRUE.
dense <- data_gen(30, 10, nfactors = 2, seed = 1) sparse <- data_gen(100, 40, nfactors = 4, sparse = TRUE, density = 0.5)dense <- data_gen(30, 10, nfactors = 2, seed = 1) sparse <- data_gen(100, 40, nfactors = 4, sparse = TRUE, density = 0.5)
Calculates distance correlation for two vectors or for every unique pair of matrix columns.
dCor(x, y = NULL, test = FALSE, adjust = "BH", alpha = NULL, parallel = FALSE, cores = 1L, R = 499L)dCor(x, y = NULL, test = FALSE, adjust = "BH", alpha = NULL, parallel = FALSE, cores = 1L, R = 499L)
x |
Numeric vector, matrix, or data frame. |
y |
Optional numeric vector paired with |
test |
Run permutation tests and return adjusted p-values. |
adjust |
Method passed to |
alpha |
Optional adjusted-p threshold used to zero nonsignificant coefficients. |
parallel |
Calculate unique matrix pairs in parallel on supported systems. |
cores |
Requested core count. |
R |
Permutation count passed to |
A coefficient or symmetric matrix when test = FALSE; otherwise a list with r and p.
x <- matrix(rnorm(80), 20, 4) dCor(x) ## Not run: dCor(x, test = TRUE, R = 999)x <- matrix(rnorm(80), 20, 4) dCor(x) ## Not run: dCor(x, test = TRUE, R = 999)
Calculates distance covariance for two vectors or for every unique pair of matrix columns.
dCov(x, y = NULL, test = FALSE, adjust = "BH", alpha = NULL, parallel = FALSE, cores = 1L, R = 499L)dCov(x, y = NULL, test = FALSE, adjust = "BH", alpha = NULL, parallel = FALSE, cores = 1L, R = 499L)
x |
Numeric vector, matrix, or data frame. |
y |
Optional numeric vector paired with |
test |
Run permutation tests and return adjusted p-values. |
adjust |
Method passed to |
alpha |
Optional adjusted-p threshold used to zero nonsignificant off-diagonal values. |
parallel |
Calculate unique matrix pairs in parallel on supported systems. |
cores |
Requested core count. |
R |
Permutation count passed to |
A covariance value or symmetric matrix when test = FALSE; otherwise a list with r and p.
x <- matrix(rnorm(80), 20, 4); dCov(x)x <- matrix(rnorm(80), 20, 4); dCov(x)
Extracts fitted values from every response model.
## S3 method for class 'ndrlm' fitted(object, ...)## S3 method for class 'ndrlm' fitted(object, ...)
object |
An |
... |
Reserved for method compatibility. |
A data frame with one column per fitted response.
X <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) fit <- ndrlm(Y, X, optimize = FALSE) fitted(fit)X <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) fit <- ndrlm(Y, X, optimize = FALSE) fitted(fit)
Selects indicators from NDA, PCA, factor-analysis, and other objects that expose loadings, rotations, or variable coordinates.
fs.dimred(fn, DF, min_comm = 0.25, com_comm = 0.25, ...)fs.dimred(fn, DF, min_comm = 0.25, com_comm = 0.25, ...)
fn |
Fitted dimensionality-reduction object. Supported structures include |
DF |
Original numeric data or a symmetric correlation matrix. |
min_comm |
Minimum indicator communality. |
com_comm |
Minimum separation between the two largest squared loadings. |
... |
Reserved for future model-specific extraction. |
A list containing dropped_low, dropped_com, retained_DF (also available as remain_DF), communalities, loadings, and the input model.
pca <- prcomp(swiss, scale. = TRUE) selected <- fs.dimred(pca, swiss) colnames(selected$retained_DF)pca <- prcomp(swiss, scale. = TRUE) selected <- fs.dimred(pca, swiss) colnames(selected$retained_DF)
Iteratively removes the indicator with the lowest measure of sampling adequacy until the requested overall KMO is reached.
fs.KMO(data, min_MSA = 0.5, cor.mtx = FALSE, max_iter = ncol(data) - 1L, ...)fs.KMO(data, min_MSA = 0.5, cor.mtx = FALSE, max_iter = ncol(data) - 1L, ...)
data |
Numeric row-level data or a correlation matrix. |
min_MSA |
Target overall Kaiser-Meyer-Olkin value in [0, 1]. |
cor.mtx |
Treat |
max_iter |
Maximum number of removals. |
... |
Reserved for backward compatibility. |
Filtered data or correlation matrix. The final KMO result and removed variable names are stored in "KMO" and "removed" attributes.
filtered <- fs.KMO(swiss, min_MSA = 0.6)filtered <- fs.KMO(swiss, min_MSA = 0.6)
Sample datasets for Generalized Network-based Dimensionality Reduction and Analysis (GNDA)
Governmental and economic data of countries (2020), where the data frame has 138 observations of 2161 variables.
data("GOVDB2020")data("GOVDB2020")
A data frame with 138 observations of 2161 variables.
Kurbucz, M. T. (2020). A joint dataset of official COVID-19 reports and the governance, trade and competitiveness indicators of World Bank group platforms. Data in brief, 31, 105881.
data(GOVDB2020)data(GOVDB2020)
Sample datasets for Generalized Network-based Dimensionality Reduction and Analysis (GNDA)
NUTS2 regional development data (2020), where the data frame has 414 observations of 101 variables.
data("I40_2020")data("I40_2020")
A data frame with 414 observations of 101 variables.
Honti, G., Czvetko, T., and Abonyi, J. (2020). Data describing the regional Industry 4.0 readiness index. Data in Brief, 33, 106464.
data(I40_2020)data(I40_2020)
Builds a squared-association network, detects indicator communities, and estimates one centrality-weighted latent variable per retained community.
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)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)
r |
Numeric row-level data, or a square association matrix when |
covar |
Use |
cor_method |
Association method. Numeric values 1–6 retain compatibility; textual values are |
cor_type |
Association type: |
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 |
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 |
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 |
test |
Calculate association p-values. |
p_adjust |
Method passed to |
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. |
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.
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.
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. 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. doi:10.1016/j.eswa.2023.121779.
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 ## Not run: fit_boot <- ndr(swiss, cor_method = "distance", test = TRUE, bootstrap = TRUE, n_boot = 500, parallel = TRUE, cores = 4) ## End(Not run)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 ## Not run: fit_boot <- ndr(swiss, cor_method = "distance", test = TRUE, bootstrap = TRUE, n_boot = 500, parallel = TRUE, cores = 4) ## End(Not run)
Fits supervised models to original or NDA-reduced input and output variables, with optional NSGA-II tuning.
ndrlm(Y, X, latents = "in", dircon = FALSE, optimize = TRUE, target = "adj.r.square", rel_weight = FALSE, cor_method = 1, cor_type = 1, min_comm = 2, Gamma = 1, null_model_type = 4, mod_mode = 1, use_rotation = FALSE, rotation = "oblimin", pareto = FALSE, fit_weights = NULL, lower.bounds.x = rep(-100, ncol(X)), upper.bounds.x = rep(100, ncol(X)), lower.bounds.latentx = c(0, 0, 0, 0), upper.bounds.latentx = c(0.6, 0.6, 0.6, 0.3), lower.bounds.y = rep(-100, ncol(Y)), upper.bounds.y = rep(100, ncol(Y)), lower.bounds.latenty = c(0, 0, 0, 0), upper.bounds.latenty = c(0.6, 0.6, 0.6, 0.3), popsize = 20, generations = 30, cprob = 0.7, cdist = 5, mprob = 0.2, mdist = 10, seed = NULL, regression = c("lm", "ridge", "loess", "elastic_net"), model = NULL, alpha = 0.5, lambda = NULL, loess_span = 0.75, restarts = 1L, parallel = FALSE, cores = 1L, sparsecalc = FALSE, centrality = "eigenvector", standardized = TRUE, membership.X = NULL, membership.Y = NULL)ndrlm(Y, X, latents = "in", dircon = FALSE, optimize = TRUE, target = "adj.r.square", rel_weight = FALSE, cor_method = 1, cor_type = 1, min_comm = 2, Gamma = 1, null_model_type = 4, mod_mode = 1, use_rotation = FALSE, rotation = "oblimin", pareto = FALSE, fit_weights = NULL, lower.bounds.x = rep(-100, ncol(X)), upper.bounds.x = rep(100, ncol(X)), lower.bounds.latentx = c(0, 0, 0, 0), upper.bounds.latentx = c(0.6, 0.6, 0.6, 0.3), lower.bounds.y = rep(-100, ncol(Y)), upper.bounds.y = rep(100, ncol(Y)), lower.bounds.latenty = c(0, 0, 0, 0), upper.bounds.latenty = c(0.6, 0.6, 0.6, 0.3), popsize = 20, generations = 30, cprob = 0.7, cdist = 5, mprob = 0.2, mdist = 10, seed = NULL, regression = c("lm", "ridge", "loess", "elastic_net"), model = NULL, alpha = 0.5, lambda = NULL, loess_span = 0.75, restarts = 1L, parallel = FALSE, cores = 1L, sparsecalc = FALSE, centrality = "eigenvector", standardized = TRUE, membership.X = NULL, membership.Y = NULL)
Y |
Numeric dependent-variable data. |
X |
Numeric independent-variable data with the same rows as |
latents |
Use latent variables for inputs ( |
dircon |
Retain NDA-excluded variables as direct predictors or responses. |
optimize |
Tune indicator weights and four NDA thresholds with NSGA-II. |
target |
One of adjusted R-squared, R-squared, MAE, MAPE, MASE, MSE, RMSE, AIC, or BIC. |
rel_weight |
Constrain and normalize indicator weights to be nonnegative relative weights. |
cor_method, cor_type, min_comm, Gamma, null_model_type, mod_mode, use_rotation, rotation
|
Arguments forwarded to |
pareto |
Keep one objective per original dependent variable during NSGA-II optimization. |
fit_weights |
Optional weights for aggregating response-specific objectives when their number matches the fitted responses. |
lower.bounds.x, upper.bounds.x
|
Lower and upper NSGA-II bounds for input-indicator weights. |
lower.bounds.latentx, upper.bounds.latentx
|
Bounds for input-side |
lower.bounds.y, upper.bounds.y
|
Lower and upper NSGA-II bounds for output-indicator weights. |
lower.bounds.latenty, upper.bounds.latenty
|
Bounds for the four output-side NDA thresholds. |
popsize, generations, cprob, cdist, mprob, mdist
|
NSGA-II population, generation, crossover, and mutation settings passed to |
seed |
Optional seed; repeated optimization runs use consecutive seeds. |
regression |
Regression engine: ordinary least squares, ridge, LOESS, or elastic net. |
model |
Backward-friendly alias that overrides |
alpha |
Elastic-net mixing value in [0, 1]. Ridge always uses zero. |
lambda |
Optional penalization value. If omitted, cross-validation selects lambda. |
loess_span |
LOESS smoothing span. |
restarts |
Number of independent NSGA-II runs; the best feasible candidate is refitted. |
parallel, cores, sparsecalc, centrality, standardized
|
Performance and latent-score settings forwarded to |
membership.X, membership.Y
|
Optional fixed NDA community memberships for the input and output sides. |
NDRLM is predictive and exploratory; its paths do not by themselves establish causal effects. Ridge and elastic net use glmnet. LOESS is intended for small predictor sets and does not provide linear-path significance tests. AIC and BIC for non-likelihood engines are residual-based approximations.
An ndrlm object containing fitted regression models, response-specific metrics, fitted NDA objects, optimized hyperparameters, training designs, and NSGA-II results.
Kosztyan, Z. T., Kurbucz, M. T., Katona, A. I., and Khan, Z. Network-based dimensionality reduction and structural modeling.
X <- as.data.frame(freeny.x) Y <- data.frame(income = freeny.y) fit <- ndrlm(Y, X, optimize = FALSE, regression = "lm") summary(fit) predict(fit, X[1:3, ]) ## Not run: fit_en <- ndrlm(Y, X, regression = "elastic_net", alpha = 0.5, popsize = 20, generations = 50, restarts = 3) ## End(Not run)X <- as.data.frame(freeny.x) Y <- data.frame(income = freeny.y) fit <- ndrlm(Y, X, optimize = FALSE, regression = "lm") summary(fit) predict(fit, X[1:3, ]) ## Not run: fit_en <- ndrlm(Y, X, regression = "elastic_net", alpha = 0.5, popsize = 20, generations = 50, restarts = 3) ## End(Not run)
Rescales a numeric matrix or data frame globally, by row, or by column.
normalize(x, type = c("all", "row", "col"), range = c(0, 1), na.rm = TRUE)normalize(x, type = c("all", "row", "col"), range = c(0, 1), na.rm = TRUE)
x |
Numeric matrix or data frame. |
type |
Normalize all values together, each row, or each column. |
range |
Two increasing finite output limits. |
na.rm |
Remove missing values when finding limits. |
A constant slice is mapped to the midpoint of range.
A normalized object with the same matrix or data-frame form as x.
m <- matrix(rnorm(20), 5, 4) normalize(m) normalize(m, type = "row", range = c(-1, 1))m <- matrix(rnorm(20), 5, 4) normalize(m) normalize(m, type = "row", range = c(-1, 1))
Forms a partial distance-correlation matrix by inverting the distance-covariance matrix.
pdCor(x, test = FALSE, adjust = "BH", alpha = NULL, parallel = FALSE, cores = 1L)pdCor(x, test = FALSE, adjust = "BH", alpha = NULL, parallel = FALSE, cores = 1L)
x |
Numeric matrix or data frame. |
test |
Return approximate coefficient p-values. |
adjust |
Method passed to |
alpha |
Optional adjusted-p filtering threshold. |
parallel |
Calculate distance-covariance pairs in parallel where supported. |
cores |
Requested core count. |
When the distance-covariance matrix is singular, a Moore-Penrose generalized inverse is used. The optional p-values use a t approximation and should be interpreted as screening diagnostics.
A matrix, or a list with matrices r and p when test = TRUE.
x <- matrix(rnorm(100), 20, 5); pdCor(x)x <- matrix(rnorm(100), 20, 5); pdCor(x)
Creates a printable static igraph or interactive visNetwork network object. Assignment does not draw; printing the result draws it.
## S3 method for class 'nda' plot(x, cuts = 0.3, interactive = TRUE, edgescale = 1, labeldist = -1.5, show_weights = FALSE, shapes = "circle", edge.color.links = TRUE, edge.colors = c("darkred", "grey", "darkblue"), edge.label.size = 10, edge.label.color = "#333333", vertex.label.size = 12, vertex.label.color = "black", layout = "nicely", igraph_args = list(), visnetwork_args = list(), ...)## S3 method for class 'nda' plot(x, cuts = 0.3, interactive = TRUE, edgescale = 1, labeldist = -1.5, show_weights = FALSE, shapes = "circle", edge.color.links = TRUE, edge.colors = c("darkred", "grey", "darkblue"), edge.label.size = 10, edge.label.color = "#333333", vertex.label.size = 12, vertex.label.color = "black", layout = "nicely", igraph_args = list(), visnetwork_args = list(), ...)
x |
An |
cuts |
Minimum squared correlation, or a two-value retained range. For association-matrix models a scalar is interpreted relative to the nonzero minimum and maximum. |
interactive |
Create a visNetwork widget instead of a static graph. |
edgescale |
Edge-width multiplier. |
labeldist |
Static vertex-label distance. |
show_weights |
Label edges with unsquared correlations for row-level models and supplied similarities for association-matrix models. |
shapes |
One or more vertex shapes, recycled over indicators. |
edge.color.links |
Color links by signed association or by the association-matrix minimum, median, and maximum. |
edge.colors |
Three-color low/middle/high scale. |
edge.label.size, edge.label.color
|
Edge-label appearance. |
vertex.label.size, vertex.label.color
|
Vertex-label appearance. |
layout |
An igraph layout suffix such as |
igraph_args |
Named static plot arguments. |
visnetwork_args |
Named lists called |
... |
Additional static |
An object of class nda_plot; print it to render.
fit <- ndr(swiss) p <- plot(fit, interactive = FALSE, show_weights = TRUE) pfit <- ndr(swiss) p <- plot(fit, interactive = FALSE, show_weights = TRUE) p
Creates a layered, printable network of indicators, latent variables, and fitted regression links.
## S3 method for class 'ndrlm' plot(x, sig = 0.05, interactive = FALSE, show_edge_labels = TRUE, edge.label.size = 9, vertex.label.size = 11, edgescale = 2, igraph_args = list(), visnetwork_args = list(), ...)## S3 method for class 'ndrlm' plot(x, sig = 0.05, interactive = FALSE, show_edge_labels = TRUE, edge.label.size = 9, vertex.label.size = 11, edgescale = 2, igraph_args = list(), visnetwork_args = list(), ...)
x |
An |
sig |
Significance threshold for ordinary least-squares paths. Penalized and LOESS paths do not have p-values and are not filtered by |
interactive |
Create a visNetwork widget. |
show_edge_labels |
Show loading and path estimates. |
edge.label.size, vertex.label.size
|
Label sizes. |
edgescale |
Absolute-weight edge-width multiplier. |
igraph_args |
Named static plotting arguments. |
visnetwork_args |
Named |
... |
Additional static |
An ndrlm_plot object; printing it renders the graph.
X <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) p <- plot(ndrlm(Y, X, optimize = FALSE)) pX <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) p <- plot(ndrlm(Y, X, optimize = FALSE)) p
Applies training feature standardization, indicator weights, retained centralities, latent-score scaling, and rotation to new rows.
## S3 method for class 'nda' predict(object, newdata, ...)## S3 method for class 'nda' predict(object, newdata, ...)
object |
An |
newdata |
Numeric data containing every original training indicator. |
... |
Reserved for method compatibility. |
A matrix with one predicted score column per latent variable. If newdata is NULL, training scores are returned.
fit <- ndr(swiss); predict(fit, swiss[1:4, ])fit <- ndr(swiss); predict(fit, swiss[1:4, ])
Transforms new independent variables with the fitted NDA model and predicts every fitted response.
## S3 method for class 'ndrlm' predict(object, newdata = NULL, se.fit = FALSE, interval = c("none", "confidence", "prediction"), level = 0.95, ...)## S3 method for class 'ndrlm' predict(object, newdata = NULL, se.fit = FALSE, interval = c("none", "confidence", "prediction"), level = 0.95, ...)
object |
An |
newdata |
New original independent variables. If omitted, fitted values are returned. |
se.fit |
Request standard errors for ordinary least-squares fits. |
interval |
No interval, a confidence interval, or a prediction interval. Intervals are available for ordinary least squares only. |
level |
Confidence level. |
... |
Additional arguments passed to |
A response-named data frame for ordinary predictions, or a response-named list when standard errors or intervals are requested.
X <- as.data.frame(freeny.x); Y <- data.frame(income = freeny.y) fit <- ndrlm(Y, X, optimize = FALSE) predict(fit, X[1:3, ])X <- as.data.frame(freeny.x); Y <- data.frame(income = freeny.y) fit <- ndrlm(Y, X, optimize = FALSE) predict(fit, X[1:3, ])
Prints the NDA call, settings, modularity, community sizes, loadings, communalities, and dropped indicators.
## S3 method for class 'nda' print(x, digits = getOption("digits"), ...)## S3 method for class 'nda' print(x, digits = getOption("digits"), ...)
x |
An |
digits |
Printing precision. |
... |
Additional arguments passed to the summary printer. |
x, invisibly.
fit <- ndr(swiss); print(fit)fit <- ndr(swiss); print(fit)
Prints the reduction mode, regression engine, target metrics, and response-specific fits.
## S3 method for class 'ndrlm' print(x, digits = getOption("digits"), ...)## S3 method for class 'ndrlm' print(x, digits = getOption("digits"), ...)
x |
An |
digits |
Printing precision. |
... |
Additional arguments passed to the summary printer. |
x, invisibly.
X <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) print(ndrlm(Y, X, optimize = FALSE))X <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) print(ndrlm(Y, X, optimize = FALSE))
Extracts observed-minus-fitted residuals from every response model.
## S3 method for class 'ndrlm' residuals(object, ...)## S3 method for class 'ndrlm' residuals(object, ...)
object |
An |
... |
Reserved for method compatibility. |
A data frame with one residual column per fitted response.
X <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) fit <- ndrlm(Y, X, optimize = FALSE) residuals(fit)X <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) fit <- ndrlm(Y, X, optimize = FALSE) residuals(fit)
Forms an asymmetric semipartial distance-correlation matrix from distance covariances.
spdCor(x, test = FALSE, adjust = "BH", alpha = NULL, parallel = FALSE, cores = 1L)spdCor(x, test = FALSE, adjust = "BH", alpha = NULL, parallel = FALSE, cores = 1L)
x |
Numeric matrix or data frame. |
test |
Return approximate coefficient p-values. |
adjust |
Method passed to |
alpha |
Optional adjusted-p filtering threshold. |
parallel |
Calculate distance-covariance pairs in parallel where supported. |
cores |
Requested core count. |
When the distance-covariance matrix is singular, a Moore-Penrose generalized inverse is used. The optional p-values use a t approximation and should be interpreted as screening diagnostics.
A matrix, or a list with matrices r and p when test = TRUE.
x <- matrix(rnorm(100), 20, 5); spdCor(x)x <- matrix(rnorm(100), 20, 5); spdCor(x)
Returns a printable summary without producing output during assignment.
## S3 method for class 'nda' summary(object, digits = getOption("digits"), ...)## S3 method for class 'nda' summary(object, digits = getOption("digits"), ...)
object |
An |
digits |
Preferred printing precision. |
... |
Additional summary arguments. |
An object of class summary.nda containing settings, modularity, community sizes, loadings, communalities, uniquenesses, and inference statistics.
fit <- ndr(swiss); s <- summary(fit); sfit <- ndr(swiss); s <- summary(fit); s
Returns a printable regression and reduction summary without printing during assignment.
## S3 method for class 'ndrlm' summary(object, digits = getOption("digits"), ...)## S3 method for class 'ndrlm' summary(object, digits = getOption("digits"), ...)
object |
An |
digits |
Printing precision. |
... |
Additional summary arguments. |
A summary.ndrlm object containing settings, variables, response metrics, fitted NDA objects, and regression fits.
X <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) s <- summary(ndrlm(Y, X, optimize = FALSE)) sX <- as.data.frame(freeny.x) Y <- data.frame(y = freeny.y) s <- summary(ndrlm(Y, X, optimize = FALSE)) s