skbio.stats.ordination.
pcoa
(distance_matrix, method='eigh', number_of_dimensions=0, inplace=False)[source]¶Perform Principal Coordinate Analysis.
State: Experimental as of 0.4.0.
Principal Coordinate Analysis (PCoA) is a method similar to Principal Components Analysis (PCA) with the difference that PCoA operates on distance matrices, typically with noneuclidian and thus ecologically meaningful distances like UniFrac in microbiome research.
In ecology, the euclidean distance preserved by Principal Component Analysis (PCA) is often not a good choice because it deals poorly with double zeros (Species have unimodal distributions along environmental gradients, so if a species is absent from two sites at the same site, it can’t be known if an environmental variable is too high in one of them and too low in the other, or too low in both, etc. On the other hand, if an species is present in two sites, that means that the sites are similar.).
Note that the returned eigenvectors are not normalized to unit length.
Parameters:  distance_matrix : DistanceMatrix
method : str, optional
number_of_dimensions : int, optional
inplace : bool, optional


Returns:  OrdinationResults

See also
Notes
Note
If the distance is not euclidean (for example if it is a semimetric and the triangle inequality doesn’t hold), negative eigenvalues can appear. There are different ways to deal with that problem (see Legendre & Legendre 1998, S 9.2.3), but none are currently implemented here. However, a warning is raised whenever negative eigenvalues appear, allowing the user to decide if they can be safely ignored.