Returns a full NxN matrix of distances in a PCA-reduced subspace, with an optional whitening step.
No block-based exclusion is performed.
Usage
# S3 method for class 'pcadist'
pairwise_dist(obj, X)
Arguments
- obj
A distance function object of class c("pcadist", "distfun")
.
- X
A numeric matrix.
Value
An N x N numeric matrix of pairwise distances in the reduced PCA space.
Details
1. Performs prcomp(X)
(centered, scaled=TRUE).
2. Determines the number of components via obj$threshfun(...)
.
3. Optionally whitens (divide each principal component by its standard deviation).
4. Computes pairwise distances on the reduced data using obj$dist_method
.
Examples
X <- matrix(rnorm(100), 10, 10)
dist_obj <- pcadist(ncomp=3, dist_method="cosine")
dist_matrix <- pairwise_dist(dist_obj, X)
#> Error in UseMethod("pairwise_dist"): no applicable method for 'pairwise_dist' applied to an object of class "c('pcadist', 'distfun')"