Permutation Tests¶
The permutation module provides permutation-based statistical tests.
PERMANOVA¶
- nuee.permutation.permanova(distance_matrix: ndarray | DataFrame | Series, factors: ndarray | DataFrame | Series, permutations: int = 999, random_state: int | Generator | None = None, distance_method: str = 'bray', **kwargs) DataFrame[source]¶
Distance-based PERMANOVA (sequential sums of squares).
- Parameters:
distance_matrix – Square or condensed distance matrix.
factors – DataFrame, Series, or array of predictor variables. Each column is treated as a separate term evaluated sequentially.
permutations – Number of permutations for significance testing. Set to
0orNoneto skip permutation p-values.random_state – Seed or
Generatorfor reproducible permutations.
- Returns:
Dictionary containing a result table (
table), the total sum of squares, and the permutation F-statistics.- Return type:
General Permutation Test¶
- nuee.permutation.permtest(statistic_func: Callable, data: ndarray, permutations: int = 999, **kwargs) dict[source]¶
General permutation test.
- Parameters:
statistic_func – Function to calculate test statistic
data – Data array
permutations – Number of permutations
**kwargs – Additional parameters
- Returns:
Dictionary with test results
- nuee.permutation.permutest(ordination_result: ConstrainedOrdinationResult, permutations: int = 999, *, random_state: int | Generator | None = None) Dict[str, float | int | ndarray | DataFrame][source]¶
Permutation test for constrained ordination (RDA/CCA).
- Parameters:
ordination_result – Constrained ordination result (e.g., from
nuee.rda()).permutations – Number of permutations used to build the null distribution.
random_state – Optional random seed or Generator for reproducible results.
- Returns:
Dictionary containing the ANOVA-style table and permutation details.
- Return type:
ANOVA for Constrained Ordination¶
- nuee.permutation.anova_cca(ordination_result: ConstrainedOrdinationResult, permutations: int = 999, *, random_state: int | Generator | None = None) Dict[str, float | int | ndarray | DataFrame][source]¶
Permutation ANOVA for constrained ordination results.
- Parameters:
ordination_result – Result object returned by
nuee.rda()ornuee.cca().permutations – Number of permutations used to approximate the null distribution.
random_state – Optional seed/Generator for reproducible permutations.
- Returns:
Dictionary containing the ANOVA table and permutation metadata.
- Return type: