Construct sparse MDS targets from landmark distances
Source:R/landmark_mds_constraints.R
landmark.mds.constraints.RdConverts supplied distances into soft pairwise fitting targets for [metric.mds()]. No distances are recomputed and no graph paths are inferred. With `weighting = "uniform"`, every retained unordered pair has endpoint multiplicities one, giving inverse-squared distance stress on those pairs. With `weighting = "region"`, samples belong to their nearest landmark (ties use landmark row order). The update at a non-landmark endpoint represents the number of samples in the landmark's region at most half the target distance from that landmark. Opposite landmark directions are combined. Optional local pairs replace landmark contributions for that pair with multiplicities one at each endpoint. Actual fitting weights divide these multiplicities by squared target distances. Region weighting can give asymmetric endpoint updates; it is not ordinary symmetric weighted stress.
Usage
landmark.mds.constraints(
distance.matrix,
landmarks,
local.pairs = NULL,
local.distances = NULL,
weighting = c("uniform", "region")
)Arguments
- distance.matrix
Numeric landmark-by-sample distance matrix, finite and nonnegative. Each row has zero at its landmark and strictly positive values elsewhere. Consolidate zero-distance duplicates before use.
- landmarks
Distinct integer sample indices identifying matrix rows, in row order; sample indices correspond to matrix columns.
- local.pairs
Optional two-column integer matrix of sample indices.
- local.distances
Positive finite distances for `local.pairs`, from the same metric as `distance.matrix`. Repeated pairs and overlapping landmark targets must agree to relative tolerance 1e-10.
- weighting
Endpoint weighting scheme: `"uniform"` or `"region"`.