nichesphere.niche_stats.pairwise_ranksums_int_ext

nichesphere.niche_stats.pairwise_ranksums_int_ext#

nichesphere.niche_stats.pairwise_ranksums_int_ext(data_int: list, data_ext: list, communities: list, MTcorrection: str = 'fdr_bh') → DataFrame#

Wilcoxon rank-sum test comparing internal vs external edge weight distributions for each community, with multiple-testing correction.

For each community the test asks whether the internal edge weight distribution differs significantly from the external one — a proxy for whether the niche is more cohesively connected internally than its cross-niche connections would suggest.

Communities with fewer than 2 edges in either distribution are skipped.

Parameters:
  • data_int (list of lists) – Internal signed edge weight distributions, one list per community (same order as communities).

  • data_ext (list of lists) – External signed edge weight distributions, one list per community.

  • communities (list of str) – Community/niche names, same order as data_int / data_ext.

  • MTcorrection (str, default 'fdr_bh') – Multiple-testing correction method passed to statsmodels.multipletests (e.g. 'fdr_bh', 'holm', 'bonferroni').

Returns:

df – One row per tested community with columns niche, statistic, p_value, and p_value_corrected.

Return type:

pd.DataFrame