qdiv.diversity.naive_beta
- qdiv.diversity.naive_beta(tab, *, q=1, dis=True, viewpoint='regional', use_values_in_tab=False)[source]
Compute naive (taxonomic) pairwise beta diversity of order q.
Implements the two‑community Hill‑number beta diversity framework described in Chao et al. (2014), using only species abundances (no phylogenetic or functional information).
For two samples A and B:
α_q = Hill number of the average of A and B γ_q = Hill number of the pooled community β_q = γ_q / α_q
Special case q = 1 uses the Shannon limit:
α₁ = exp( -½ Σ pᵢ ln pᵢ - ½ Σ qᵢ ln qᵢ ) γ₁ = exp( -Σ mᵢ ln mᵢ )
- Parameters:
tab (DataFrame | MicrobiomeData-like | dict) – Abundance table (features x samples) or convertible structure.
q (float, default=1) – Diversity order.
dis (bool, default=True) – If True, convert β to a dissimilarity using beta2dist. If False, return raw β values.
viewpoint ({'local', 'regional'}, default='regional') – Viewpoint for converting β to dissimilarity.
use_values_in_tab (bool, default=False) – If False, convert abundances to relative abundances. If True, assume tab already contains relative abundances.
- Returns:
Pairwise β-diversity (or dissimilarity) matrix.
- Return type:
pandas.DataFrame
Notes
Requires beta2dist() to be defined elsewhere.
Only works for ≥ 2 samples.