View source: R/150_DecompositionConfig.R
| setup_PCoA | R Documentation |
Principal coordinates analysis, also called classical or Torgerson
multidimensional scaling: an eigendecomposition of the doubly centered
squared dissimilarities between cases, with stats::cmdscale(). With
dist_method = "euclidean" the components equal PCA scores of the centered,
unscaled data, up to sign; other dissimilarities are what PCoA is for.
setup_PCoA(k = 2L, dist_method = "euclidean", features = NULL)
k |
Integer [1, Inf): Number of components. (passed to |
dist_method |
Character {"euclidean", "manhattan", "chord", "bray",
"canberra", "jaccard", "kulczynski", "hellinger"}: Dissimilarity between
cases, computed with |
features |
Optional Character vector: Names of at least 2 distinct
feature columns to decompose. |
PCoA applies to new data with Gower's (1968) out-of-sample formula, from the dissimilarities between each new case and the training cases, so it can be used as the decomposition step in train. Applying a fit to its own training data reproduces the fitted components. Because those dissimilarities are needed, the fit keeps the training feature matrix, and its size grows with the number of training cases.
Dissimilarities other than "euclidean", "chord" and "hellinger" generally give some negative eigenvalues; only dimensions with positive eigenvalues are returned, and asking for more is an error that states how many there are. reconstruct does not apply.
PCoAConfig object.
EDG
pcoa_config <- setup_PCoA(k = 2L, dist_method = "bray")
pcoa_config
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.