Stress-minimizing multidimensional scaling with vegan::monoMDS(): finds k
coordinates per case whose distances match the dissimilarities between cases
as closely as possible, measured by Kruskal's stress-1. For classical
(Torgerson) scaling, which solves an eigenproblem instead, see setup_PCoA.
setup_MDS(
k = 2L,
dist_method = "euclidean",
model = "global",
nstart = 20L,
max_iter = 200L,
features = NULL
)MDSConfig object.
Integer [1, Inf): Number of components. (passed to monoMDS k)
Character {"euclidean", "manhattan", "chord", "bray",
"canberra", "jaccard", "kulczynski", "hellinger"}: Dissimilarity between
cases, computed with vegan::vegdist(). "bray", "canberra", "jaccard",
"kulczynski" and "hellinger" require non-negative data.
Character {"global", "local", "linear"}: "global" is nonmetric
MDS (one monotone regression); "local" fits one monotone regression per case;
"linear" is metric MDS. (passed to monoMDS model)
Integer [1, Inf): Number of starting configurations. 1 starts from the classical scaling solution only.
Integer [1, Inf): Maximum number of iterations per start.
(passed to monoMDS maxit)
Optional Character vector: Names of at least 2 distinct
feature columns to decompose. NULL decomposes all numeric features.
EDG
Each start runs vegan::monoMDS() from its own initial configuration, and
the one with the lowest stress is kept. The first start is the classical
scaling solution, stats::cmdscale(); if that has fewer than k dimensions
with positive eigenvalues, the missing ones are random. Every other start is
uniform on [-1, 1]. The random values come from R's random number
generator, so the execution config's seed reproduces the fit. The final configuration is centered, scaled and rotated to its principal
axes, so its components are uncorrelated, but the first j components of a
k-dimensional solution are not the j-dimensional solution.
MDS cannot be applied to new data, so it cannot be used as the decomposition step in train, and reconstruct does not apply.
mds_config <- setup_MDS(k = 2L, dist_method = "manhattan")
mds_config
Run the code above in your browser using DataLab