skbio.stats.composition.ANCOMBCResult.trend_test#

ANCOMBCResult.trend_test(alpha='inherit', p_adjust='inherit', trend_contrast=None, trend_node=None, bootstraps=100, seed=None)[source]#

Perform trend test for ordered patterns in group effects.

Uses constrained optimization to test monotone increasing/decreasing patterns in group-level effects.

Parameters:
alphafloat or “inherit”, optional

Significance level. Default is “inherit”, which will use the value supplied upstream.

p_adjuststr, optional

Multiple testing correction method. Default is “inherit”, which will use the p-value correction method supplied upstream.

trend_contrast, trend_nodedict, optional

Trend test contrast matrices and their node indices.

bootstrapsint, optional

Number of bootstrap iterations. Default is 100.

seedint, Generator, or RandomState, optional

A user-provided random seed or generator for bootstrap samples. See details.

Returns:
pd.DataFrame

Trend test result indexed by FeatureID. The index and columns are:

  • FeatureID: Feature identifier, i.e., dependent variable.

  • W: Test statistic for the strongest tested trend pattern.

  • pvalue: Bootstrap-estimated p-value of the trend statistic.

  • qvalue: p-value corrected for multiple testing.

  • Signif: Whether the feature exhibits a significant tested trend.

Notes

The trend test is highly stochastic and requires a large number of bootstraps (e.g., 10,000) to stabilize the estimated p- and q-values. This is because every p-value is estimated through independent bootstrapping. In comparsion, the Dunnett’s test (dunnett_test) is more stable.