qdiv.model.beta_nriq

qdiv.model.beta_nriq(obj, distmat, *, q=1.0, iterations=999, randomization='features', use_tqdm=True, random_state=None, **kwargs)[source]

Computes beta-MPD_q for all sample pairs, then contrasts against a null generated by (a) feature label permutations (“features”) or (b) within-sample abundance shuffles (“abundances”).

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:

‘beta_MPDq’ : observed beta-MPD_q ‘null_mean’ : mean of null beta-MPD_q ‘null_std’ : std of null beta-MPD_q ‘p’ : (count(null < obs) + 0.5 * ties) / iterations ‘ses’ : (null_mean - obs) / null_std

Return type:

dict of pandas.DataFrame (S x S)

Notes

  • Returns a dataframe with observed beta_MPDq if iterations=0, otherwise a dictionary is returned

  • A p value close to zero means that the observed MPD between samples is lower than the null expectation

  • A p value close to one means that the observed MPD between samples is higher than the null expectation

  • A positive ses means that the observed MPD between samples is lower than the null expectation

  • A negative ses means that the observed MPD between samples is higher than the null expectation