HabitatFeatureComparison

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class HabitatFeatureComparison(panel: HabitatFeaturePanel, summary: DataFrame, pairwise: DataFrame, n_subjects: int, paired: bool, effect: str)[source]

Bases: object

Descriptive and (when n>=2) inferential habitat-vs-habitat contrast.

panel

The long panel the comparison was computed from.

Type:

habit.habitat_features.compare.HabitatFeaturePanel

summary

Per habitat x feature: n, mean, median, q25, q75.

Type:

pandas.core.frame.DataFrame

pairwise

Per feature x habitat pair: n_paired, mean_diff, cliffs_delta, p_value, q_value. Inferential columns are NaN when the panel has one subject or too few complete pairs.

Type:

pandas.core.frame.DataFrame

n_subjects

Distinct subjects in panel.

Type:

int

paired

Whether pairwise tests used a paired design.

Type:

bool

effect

Effect-size name (cliffs_delta or cohens_d).

Type:

str

property is_cohort: bool

True when at least two subjects contribute.

top_features(k: int = 8, *, pair: Tuple[int, int] | None = None) → Tuple[str, ...][source]

Rank features by absolute effect size (largest first).

Parameters:
  • k – Maximum number of names to return.

  • pair – Optional (habitat_a, habitat_b) to restrict ranking. When omitted, each feature uses its largest absolute effect across pairs.

Returns:

Feature names, length min(k, n_features).

__init__(panel: HabitatFeaturePanel, summary: DataFrame, pairwise: DataFrame, n_subjects: int, paired: bool, effect: str) → None