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)An ndrlm object containing response-specific metrics, fitted NDA
objects, optimized hyperparameters, training designs, NSGA-II results and an
NSGA_trace evaluation history when optimization is enabled, and a
response-named fits list. Elements of fits are lm objects
for ordinary least squares and NDRLM engine wrappers for ridge, elastic net,
and LOESS.
Numeric dependent-variable data.
Numeric independent-variable data with the same rows as Y.
Use latent variables for inputs ("in"), outputs
("out"), both, or neither.
Retain NDA-excluded variables as direct predictors or responses.
Tune indicator weights and four NDA thresholds with NSGA-II.
One of adjusted R-squared, R-squared, MAE, MAPE, MASE, MSE, RMSE, AIC, or BIC.
Constrain and normalize indicator weights to be nonnegative relative weights.
Arguments
forwarded to ndr.
Keep one objective per original dependent variable during NSGA-II optimization.
Optional weights for aggregating response-specific objectives when their number matches the fitted responses.
Lower and upper NSGA-II bounds for input-indicator weights.
Bounds for input-side
min_evalue, min_communality, com_communalities, and
min_R.
Lower and upper NSGA-II bounds for output-indicator weights.
Bounds for the four output-side NDA thresholds.
NSGA-II population,
generation, crossover, and mutation settings passed to mco::nsga2.
Optional seed; repeated optimization runs use consecutive seeds.
Regression engine: ordinary least squares ("lm"),
ridge ("ridge"), LOESS ("loess"), or elastic net
("elastic_net").
Backward-friendly alias that overrides regression.
Elastic-net mixing value in [0, 1]. Ridge always uses zero.
Optional penalization value. If omitted, cross-validation selects lambda.
LOESS smoothing span.
Number of independent NSGA-II runs; the best feasible candidate is refitted.
Performance and
latent-score settings forwarded to ndr.
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.
The class and structure of each element of fits depend on the selected
regression engine. With regression = "lm", each fits[[i]] is a
genuine lm object and can be passed directly to summary,
coef, AIC, BIC, predict.lm, and
lm.beta::lm.beta. The lm.beta package is meaningful only for
ordinary least-squares fits; it must not be applied to ridge, elastic-net, or
LOESS fits.
With regression = "ridge", "elastic_net", or "loess",
each fits[[i]] is an NDRLM engine wrapper. It contains the engine name in
method, the underlying fitted object in fit, and common
fitted-value, residual, coefficient, and predictor metadata. Penalized fits
additionally store the selected lambda, effective alpha, and
standardized coefficients calculated on the complete training observations.
The plot method applies the same standardization to ordinary least-squares
fits, including compatible legacy lm objects. For
engine-independent code, use summary, predict, fitted,
residuals, and plot on the enclosing ndrlm object instead
of relying on these internal fields.
The NDRLM methods retain backward compatibility with both legacy objects that
stored ordinary least-squares fits directly and early 0.3.0 objects that
wrapped ordinary least-squares fits. Newly fitted ordinary least-squares models
use direct lm objects, while the newer non-lm engines retain their
wrappers.
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_lm <- ndrlm(Y, X, latents = "none", regression = "lm")
inherits(fit_lm$fits[[1]], "lm")
summary(fit_lm$fits[[1]])
predict(fit_lm, X[1:3, ])
if (requireNamespace("lm.beta", quietly = TRUE)) {
summary(lm.beta::lm.beta(fit_lm$fits[[1]]))
}
if (requireNamespace("glmnet", quietly = TRUE)) {
fit_ridge <- ndrlm(Y, X, latents = "none", regression = "ridge",
lambda = 0.1)
fit_ridge$fits[[1]]$method
predict(fit_ridge, X[1:3, ])
}
if (requireNamespace("glmnet", quietly = TRUE)) {
fit_en <- ndrlm(Y, X, latents = "none", regression = "elastic_net",
alpha = 0.5, lambda = 0.1)
predict(fit_en, X[1:3, ])
}
Run the code above in your browser using DataLab