qdiv.model.nriq
- qdiv.model.nriq(obj, distmat, *, q=1.0, iterations=999, randomization='features', use_tqdm=True, random_state=None, **kwargs)[source]
Net Relatedness Index (NRI) with q-weighting of relative abundances. Accepts either a MicrobiomeData object or a dict with at least a ‘tab’ DataFrame.
- Parameters:
obj (MicrobiomeData, dict, or compatible object) – Input data. Must provide at least an abundance table (‘tab’).
distmat (pd.DataFrame) – Square distance matrix indexed/columned by feature ids.
q (float, default=1.0) – Order of diversity weighting applied to relative abundances.
iterations (int, default=999) – Number of random permutations of distmat.
randomization ({'features', 'abundances'}, default='features') – Randomization strategy. Shuffle features in the phylogenetic tree or relative abundance values in each sample.
use_tqdm (bool, default=True) – Use tqdm for progress bars.
random_state (int or np.random.Generator, optional) – Random seed or generator for reproducibility.
- Returns:
Indexed by sample names with columns: - ‘MPDq’ - ‘null_mean’ - ‘null_std’ - ‘p’ (Pr[ null < observed ] + 0.5*ties) / iterations - ‘ses’ (null_mean - observed) / null_std
- Return type:
pandas.DataFrame
Notes
A p value close to zero means that the observed MPD is lower than the null expectation
A p value close to one means that the observed MPD is higher than the null expectation
A positive ses means that the observed MPD is lower than the null expectation
A negative ses means that the observed MPD is higher than the null expectation
References
Webb et al. (2002) American Naturalist.