skbio.stats.composition.pairwise_vlr#
- skbio.stats.composition.pairwise_vlr(mat, ids=None, ddof=1, robust=False, validate=True)[source]#
Perform pairwise variance log ratio transformation.
- Parameters:
- matarray_like of shape (n_compositions, n_components)
A matrix of proportions.
- idsarray_like of str of shape (n_components,)
Component names.
- ddofint
Degrees of freedom.
- robustbool
Whether to mask zeros at the cost of performance.
- validatebool
Whether to validate the distance matrix after construction.
- Returns:
- skbio.DistanceMatrix if validate=True
Distance matrix of variance log ratio values.
- skbio.DissimilarityMatrix if validate=False
Dissimilarity matrix of variance log ratio values.
Notes
Pairwise variance log ratio transformation was described in [1] and [2].
References
[1]V. Lovell D, Pawlowsky-Glahn V, Egozcue JJ, Marguerat S, Bähler J (2015) Proportionality: A Valid Alternative to Correlation for Relative Data. PLoS Comput Biol 11(3): e1004075. https://doi.org/10.1371/journal.pcbi.1004075
[2]Erb, I., Notredame, C. How should we measure proportionality on relative gene expression data?. Theory Biosci. 135, 21-36 (2016). https://doi.org/10.1007/s12064-015-0220-8
Examples
>>> import numpy as np >>> from skbio.stats.composition import pairwise_vlr >>> mat = np.array([np.exp([1, 2, 2]), ... np.exp([2, 3, 6]), ... np.exp([2, 3, 12])]).T >>> dism = pairwise_vlr(mat) >>> dism.redundant_form() array([[ 0., 3., 27.], [ 3., 0., 12.], [ 27., 12., 0.]])