ABalytics 3.0.6__tar.gz → 5.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- abalytics-5.0.0/CHANGELOG.md +124 -0
- abalytics-5.0.0/MANIFEST.in +2 -0
- abalytics-5.0.0/PKG-INFO +298 -0
- abalytics-5.0.0/README.md +266 -0
- abalytics-5.0.0/abalytics/__init__.py +12 -0
- abalytics-5.0.0/abalytics/analysis.py +330 -0
- abalytics-5.0.0/abalytics/significance_tests.py +735 -0
- abalytics-5.0.0/abalytics/utils.py +122 -0
- abalytics-5.0.0/abalytics/validation.py +129 -0
- abalytics-5.0.0/abalytics.egg-info/PKG-INFO +298 -0
- abalytics-5.0.0/abalytics.egg-info/SOURCES.txt +25 -0
- abalytics-5.0.0/abalytics.egg-info/requires.txt +12 -0
- abalytics-5.0.0/pyproject.toml +14 -0
- abalytics-5.0.0/setup.py +29 -0
- abalytics-5.0.0/tests/__init__.py +0 -0
- abalytics-5.0.0/tests/conftest.py +119 -0
- abalytics-5.0.0/tests/minimum-requirements.txt +8 -0
- abalytics-5.0.0/tests/test_analysis.py +211 -0
- abalytics-5.0.0/tests/test_audit_regressions.py +238 -0
- abalytics-5.0.0/tests/test_policies.py +412 -0
- abalytics-5.0.0/tests/test_significance_tests.py +342 -0
- abalytics-5.0.0/tests/test_utils.py +98 -0
- abalytics-5.0.0/tests/wheel_smoke.py +28 -0
- abalytics-3.0.6/PKG-INFO +0 -148
- abalytics-3.0.6/README.md +0 -131
- abalytics-3.0.6/abalytics/__init__.py +0 -10
- abalytics-3.0.6/abalytics/analysis.py +0 -273
- abalytics-3.0.6/abalytics/significance_tests.py +0 -641
- abalytics-3.0.6/abalytics/utils.py +0 -117
- abalytics-3.0.6/abalytics.egg-info/PKG-INFO +0 -148
- abalytics-3.0.6/abalytics.egg-info/SOURCES.txt +0 -12
- abalytics-3.0.6/abalytics.egg-info/requires.txt +0 -6
- abalytics-3.0.6/setup.py +0 -24
- {abalytics-3.0.6 → abalytics-5.0.0}/LICENSE +0 -0
- {abalytics-3.0.6 → abalytics-5.0.0}/abalytics.egg-info/dependency_links.txt +0 -0
- {abalytics-3.0.6 → abalytics-5.0.0}/abalytics.egg-info/top_level.txt +0 -0
- {abalytics-3.0.6 → abalytics-5.0.0}/setup.cfg +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 5.0.0 (unreleased)
|
|
4
|
+
|
|
5
|
+
### Breaking behavior and migration
|
|
6
|
+
|
|
7
|
+
- Numeric outcomes default to a prespecified mean comparison: Welch/Games-Howell
|
|
8
|
+
for independent groups and paired t/RM ANOVA for paired groups. Explicit `rank`,
|
|
9
|
+
independent `anova`, paired `sign`, and warning-bearing legacy `auto` modes are
|
|
10
|
+
available. The old claim that all nonnormal data must use ranks was too broad:
|
|
11
|
+
the correct choice depends on the intended estimand and sampling assumptions.
|
|
12
|
+
- Binary inference recognizes only conventional encodings. Custom encodings require
|
|
13
|
+
`positive_value`; binary rates consistently use 0–1 units in structured results.
|
|
14
|
+
- Pairwise p-values are consistently adjusted; all comparisons are retained and
|
|
15
|
+
tables show them by default. Descriptive medians no longer imply a tested ordering.
|
|
16
|
+
- Duplicate pivot keys require explicit aggregation. Invalid arguments raise ValueError.
|
|
17
|
+
- Python 3.11+ and Pydantic 2 are required. Package version is prepared but not published.
|
|
18
|
+
|
|
19
|
+
### Correctness and reliability
|
|
20
|
+
|
|
21
|
+
- Declare Pydantic/NumPy dependencies; use public statsmodels multiplicity imports;
|
|
22
|
+
support old and new Pingouin p-value columns; exclude tests from installed wheels.
|
|
23
|
+
- Fix named/duplicate indexes, column-name collisions and integer group labels.
|
|
24
|
+
- Validate finite inputs, alpha, sample policy, conditions and binary mappings;
|
|
25
|
+
count missing-row exclusions and distinguish insufficient/degenerate analyses.
|
|
26
|
+
- Apply Fisher fallback to sparse pairs as well as omnibus tables; use conditional
|
|
27
|
+
Monte Carlo for larger sparse tables and within-subject permutations for small
|
|
28
|
+
Cochran/Friedman designs. Handle constant binary outcomes and identical pairs.
|
|
29
|
+
- Separate omnibus-only significance from nonsignificance; return raw/adjusted
|
|
30
|
+
p-values, family metadata, effects, confidence intervals for mean/proportion/sign
|
|
31
|
+
methods, and explicit limitations for rank-effect intervals.
|
|
32
|
+
- Preserve caller identifiers; reject ambiguous reshape results; format tiny p-values
|
|
33
|
+
without displaying zero; provide deterministic examples and migration guidance.
|
|
34
|
+
- Restore automated tests to Git visibility, isolate discovery from local scripts,
|
|
35
|
+
and gate publishing on minimum/current dependency tests and clean-wheel smoke checks.
|
|
36
|
+
- Default development and release builds to Python 3.15, test Python 3.11–3.15,
|
|
37
|
+
and explicitly refresh current dependencies while retaining minimum-version tests.
|
|
38
|
+
- Raise setuptools and pytest minimums to exclude known vulnerable releases, and
|
|
39
|
+
update checkout/setup-python GitHub Actions to v7.
|
|
40
|
+
|
|
41
|
+
The historical 4.0.1 notes below describe the previous implementation; its unconditional
|
|
42
|
+
nonnormal-to-rank and median-ordering claims are superseded by the policies above.
|
|
43
|
+
|
|
44
|
+
## 4.0.1
|
|
45
|
+
|
|
46
|
+
### Breaking Changes
|
|
47
|
+
|
|
48
|
+
- **Decision tree restructured**: Independent groups now check normality **before** variance homogeneity (Levene). Non-normal data always routes to Kruskal-Wallis regardless of variance. Previously, non-normal data with unequal variances was incorrectly routed to Welch's ANOVA.
|
|
49
|
+
- **Error handling**: `print()` calls replaced with `warnings.warn()` for non-critical issues and `raise ValueError()` for invalid inputs (missing columns, non-numeric/non-dichotomous data).
|
|
50
|
+
- **Non-parametric result text**: Dunn, Wilcoxon, and Nemenyi posthoc results now report **medians** instead of means, consistent with rank-based test assumptions.
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
- **McNemar return type crash** (`significance_tests.py`): `get_mcnemar_results()` now correctly returns `(float, PosthocResults)` tuple. Previously returned only `PosthocResults`, causing `ValueError: not enough values to unpack` when called from `analyze_dependent_groups()`.
|
|
55
|
+
- **Wilcoxon false positives** (`significance_tests.py`): Wilcoxon signed-rank results are now gated by `p_value < p_value_threshold`. Previously, all results were added to `significant_results` unconditionally.
|
|
56
|
+
- **Decision tree order** (`analysis.py`): Normality is now checked before Levene's test. This fixes the bug where non-normal data with unequal variances was routed to Welch's ANOVA (parametric) instead of Kruskal-Wallis (non-parametric). Also ensures `gaussian_flag` is always set for numeric data.
|
|
57
|
+
|
|
58
|
+
### Statistical Correctness
|
|
59
|
+
|
|
60
|
+
- **Medians for non-parametric tests**: `get_dunn_posthoc_results()`, `get_wilcoxon_results()`, and `get_nemenyi_results()` now sort by and display median values instead of means.
|
|
61
|
+
- **Sphericity correction for RM ANOVA**: Replaced `statsmodels.AnovaRM` with `pingouin.rm_anova()`, which automatically computes Mauchly's sphericity test and applies Greenhouse-Geisser correction when sphericity is violated.
|
|
62
|
+
- **Normality of differences**: Dependent groups now tests normality of **pairwise differences** (via new `are_differences_gaussian()`) instead of raw variables, which is the correct assumption for repeated measures designs.
|
|
63
|
+
- **Fisher's exact fallback**: Chi-square test now falls back to Fisher's exact test for 2x2 contingency tables when any expected frequency is below 5.
|
|
64
|
+
- **Small sample normality guard**: `is_gaussian()` returns `False` for samples with n < 20 (policy: use safer non-parametric path with small samples).
|
|
65
|
+
- **McNemar exact test**: Uses `exact=True` when discordant cell count (b + c) < 25 for more accurate small-sample results.
|
|
66
|
+
- **Cochran's Q omnibus test**: Added `get_cochrans_q_significance()` for >2 dependent dichotomous variables. Cochran's Q is now used as the omnibus test before pairwise McNemar posthoc comparisons.
|
|
67
|
+
- **McNemar Bonferroni correction**: When >2 dependent dichotomous variables are compared pairwise, p-values are now Bonferroni-corrected.
|
|
68
|
+
|
|
69
|
+
### Improvements
|
|
70
|
+
|
|
71
|
+
- `a_priori_test` is now populated for all dependent group paths (McNemar, Cochran's Q, RM ANOVA, Wilcoxon, Friedman).
|
|
72
|
+
- Consistent non-significant result message format: `"not significant (p={pvalue:.3f})"` across both independent and dependent group analyses.
|
|
73
|
+
- Chi-square posthoc positive value detection is now dynamic (handles bool, int, and string binary encodings) instead of hardcoded `1` / `True`.
|
|
74
|
+
- Eliminated `locals()` antipattern and walrus operator overuse in `analysis.py`.
|
|
75
|
+
|
|
76
|
+
### Tests
|
|
77
|
+
|
|
78
|
+
- Added comprehensive test suite with 70 tests across 3 files:
|
|
79
|
+
- `test_analysis.py` (21 tests): Full decision tree coverage for both independent and dependent groups
|
|
80
|
+
- `test_significance_tests.py` (38 tests): Unit tests for all statistical functions
|
|
81
|
+
- `test_utils.py` (8 tests): Formatting and data transformation utilities
|
|
82
|
+
- Shared fixtures in `conftest.py` for reproducible test data
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 3.0.6
|
|
87
|
+
|
|
88
|
+
- Updated dependencies in setup.py
|
|
89
|
+
- Improved Tukey HSD results handling
|
|
90
|
+
- Fixed typo in utils.py documentation
|
|
91
|
+
|
|
92
|
+
## 3.0.5
|
|
93
|
+
|
|
94
|
+
- Changed: means displayed as .3f instead of .2f
|
|
95
|
+
|
|
96
|
+
## 3.0.4
|
|
97
|
+
|
|
98
|
+
- Fixed: restored `convert_long_to_wide`
|
|
99
|
+
|
|
100
|
+
## 3.0.3
|
|
101
|
+
|
|
102
|
+
- Improved: README
|
|
103
|
+
|
|
104
|
+
## 3.0.2
|
|
105
|
+
|
|
106
|
+
- Fixed: missing tabulate requirement
|
|
107
|
+
|
|
108
|
+
## 3.0.1
|
|
109
|
+
|
|
110
|
+
- Added: support for other table formats (incl. HTML)
|
|
111
|
+
- Improved: number formatting in table
|
|
112
|
+
- Fixed: example.py
|
|
113
|
+
|
|
114
|
+
## 3.0.0
|
|
115
|
+
|
|
116
|
+
- Improved: formatting of table (uses tabulate)
|
|
117
|
+
- Improved: returning a priori tests
|
|
118
|
+
- Fixed: Dunn returned results twice
|
|
119
|
+
|
|
120
|
+
## 2.0.0
|
|
121
|
+
|
|
122
|
+
- Added: analysis method is now returned
|
|
123
|
+
- Added: a priori test is returned
|
|
124
|
+
- Fixed: typo (Kruskal-Wallis)
|
abalytics-5.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: abalytics
|
|
3
|
+
Version: 5.0.0
|
|
4
|
+
Summary: Advanced A/B Testing Statistical Analytics
|
|
5
|
+
Author: Janis Berneker
|
|
6
|
+
License: LICENSE
|
|
7
|
+
Project-URL: Repository, https://github.com/BigBerny/abalytics
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: pandas>=2.2.0
|
|
12
|
+
Requires-Dist: scipy>=1.12.0
|
|
13
|
+
Requires-Dist: statsmodels>=0.14.6
|
|
14
|
+
Requires-Dist: scikit-posthocs>=0.12.0
|
|
15
|
+
Requires-Dist: pingouin>=0.5.5
|
|
16
|
+
Requires-Dist: tabulate>=0.9.0
|
|
17
|
+
Requires-Dist: numpy>=1.23.5
|
|
18
|
+
Requires-Dist: pydantic<3,>=2.6
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest>=9.0.3; extra == "test"
|
|
21
|
+
Requires-Dist: pytest-cov>=5; extra == "test"
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: description
|
|
24
|
+
Dynamic: description-content-type
|
|
25
|
+
Dynamic: license
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
Dynamic: project-url
|
|
28
|
+
Dynamic: provides-extra
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
32
|
+
|
|
33
|
+
# ABalytics
|
|
34
|
+
|
|
35
|
+
Statistical comparisons for independent groups and paired/repeated conditions.
|
|
36
|
+
ABalytics reports the selected hypothesis, exclusions, omnibus result, **all pairwise
|
|
37
|
+
comparisons**, adjusted p-values, effect estimates, and confidence intervals where
|
|
38
|
+
supported. It does not infer randomization, independence, or business value from data.
|
|
39
|
+
|
|
40
|
+
Requires Python 3.11 or newer. Development defaults to Python 3.15.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install abalytics
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Independent groups
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import pandas as pd
|
|
50
|
+
from abalytics import analyze_independent_groups
|
|
51
|
+
|
|
52
|
+
# Each row must represent an independent experimental unit.
|
|
53
|
+
df = pd.read_csv("your_data.csv")
|
|
54
|
+
result = analyze_independent_groups(
|
|
55
|
+
df,
|
|
56
|
+
variable_to_analyze="order_value",
|
|
57
|
+
group_column="variant",
|
|
58
|
+
method="mean", # default: Welch ANOVA + Games-Howell
|
|
59
|
+
outcome_type="numeric", # prevents binary inference for a 0/1 numeric metric
|
|
60
|
+
)
|
|
61
|
+
print(result.status, result.omnibus_p_value)
|
|
62
|
+
for comparison in result.comparisons:
|
|
63
|
+
print(comparison.groups, comparison.effect_size, comparison.confidence_interval)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Choose the statistical target **before inspecting significance**:
|
|
67
|
+
|
|
68
|
+
| Numeric method | Independent groups | Paired conditions |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| `mean` (default) | Welch ANOVA → Games-Howell | Two: paired t-test. Three+: repeated-measures ANOVA → Bonferroni paired t-tests |
|
|
71
|
+
| `anova` | Equal-variance ANOVA → Tukey HSD | Not applicable; use `mean` |
|
|
72
|
+
| `rank` | Kruskal-Wallis → Dunn-Holm | Two: Wilcoxon. Three+: Friedman → Holm-adjusted within-subject rank permutations |
|
|
73
|
+
| `sign` | Not applicable | Exact sign test for two conditions; zero differences excluded |
|
|
74
|
+
| `auto` | Legacy normality/variance-based selection | Legacy normality-of-differences selection |
|
|
75
|
+
|
|
76
|
+
`auto` emits a warning because it can change the question from a mean comparison to
|
|
77
|
+
an examination of ranks. Diagnostic tests use a fixed 0.05 threshold, separate from
|
|
78
|
+
the requested significance threshold. Not rejecting normality or equal variances is
|
|
79
|
+
not proof of either assumption. Fewer than 20 observations yields a failed normality
|
|
80
|
+
diagnostic; this is a policy, not proof of nonnormality.
|
|
81
|
+
|
|
82
|
+
Welch does not require equal variances. It still requires a defensible sampling
|
|
83
|
+
approximation for group means; very heavy tails, influential outliers, and tiny
|
|
84
|
+
samples require separate assessment. `anova` explicitly assumes equal variances.
|
|
85
|
+
Rank tests are not generic substitutes for tests of means or medians.
|
|
86
|
+
|
|
87
|
+
## Binary outcomes and the positive event
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
result = analyze_independent_groups(
|
|
91
|
+
df,
|
|
92
|
+
"conversion_status",
|
|
93
|
+
"variant",
|
|
94
|
+
outcome_type="binary",
|
|
95
|
+
positive_value="converted",
|
|
96
|
+
)
|
|
97
|
+
print(result.positive_event)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`outcome_type="auto"` recognizes booleans, numeric 0/1, and case-insensitive string
|
|
101
|
+
pairs `true/false`, `yes/no`, `y/n`, and `success/failure`. Constants in these encodings
|
|
102
|
+
remain binary. Other encodings require `positive_value`. A numeric variable having
|
|
103
|
+
exactly two observed values is **not** sufficient evidence of a binary outcome.
|
|
104
|
+
All paired conditions must share the same encoding; unknown categories are rejected.
|
|
105
|
+
|
|
106
|
+
Independent binary outcomes use chi-square (Yates correction for 2×2 tables) when
|
|
107
|
+
expected counts are adequate, Fisher's exact test for sparse 2×2 tables, and conditional
|
|
108
|
+
Monte Carlo for sparse larger tables. Each pair is checked independently for sparse
|
|
109
|
+
counts and receives Bonferroni adjustment. Two-group omnibus and pairwise tests use
|
|
110
|
+
the same statistical method. Binary means/effects are always on the **0–1 probability
|
|
111
|
+
scale**, while text formats rates as percentages. Higher rates are not automatically
|
|
112
|
+
better: a positive event may be an error or failure if that is what you specify.
|
|
113
|
+
|
|
114
|
+
## Paired and repeated measurements
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from abalytics import analyze_dependent_groups
|
|
118
|
+
|
|
119
|
+
paired = pd.read_csv("paired_measurements.csv")
|
|
120
|
+
result = analyze_dependent_groups(
|
|
121
|
+
paired,
|
|
122
|
+
["pre_score", "post_score"],
|
|
123
|
+
method="mean",
|
|
124
|
+
outcome_type="numeric",
|
|
125
|
+
)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Each row is one subject with correctly aligned conditions. The DataFrame index is
|
|
129
|
+
ignored for subject identity: named, duplicated, or nonconsecutive indexes do not
|
|
130
|
+
change pairing. Rows missing any selected condition are removed together and counted
|
|
131
|
+
in `excluded_rows`. You must assess whether complete-case analysis is appropriate.
|
|
132
|
+
|
|
133
|
+
For three or more numeric conditions, repeated-measures ANOVA uses the
|
|
134
|
+
Greenhouse-Geisser p-value when Mauchly's sphericity test rejects at 0.05. Pairwise
|
|
135
|
+
mean comparisons use paired t-tests and Bonferroni adjustment. Normality of pairwise
|
|
136
|
+
differences is only a diagnostic; it does not establish multivariate normality.
|
|
137
|
+
|
|
138
|
+
Wilcoxon tests a hypothesis about the symmetry of **paired differences** around zero;
|
|
139
|
+
it does not establish a difference between the marginal medians. If a signed-rank
|
|
140
|
+
hypothesis is inappropriate and the question concerns the sign of a difference,
|
|
141
|
+
consider the explicit `sign` method instead.
|
|
142
|
+
|
|
143
|
+
Friedman uses within-subject permutation inference for six or fewer conditions or
|
|
144
|
+
ten or fewer subjects; otherwise it uses the chi-square approximation. Its pairwise
|
|
145
|
+
comparisons permute two condition labels within each subject, using mean within-row
|
|
146
|
+
rank differences and Holm adjustment. This handles tied ranks. Exchangeability of
|
|
147
|
+
condition labels under the null must be justified by the design. The Nemenyi helper
|
|
148
|
+
remains available for established analyses, but is not the default posthoc method.
|
|
149
|
+
|
|
150
|
+
Paired binary data use McNemar for two conditions, and Cochran's Q followed by
|
|
151
|
+
Bonferroni McNemar comparisons for more conditions. McNemar is exact when there are
|
|
152
|
+
fewer than 25 discordant pairs. Cochran's Q uses within-subject permutations when
|
|
153
|
+
fewer than 25 subjects have varying responses. No discordance gives p=1.
|
|
154
|
+
|
|
155
|
+
All resampling uses `n_resamples=9999` and `random_state=0` by default. Results are
|
|
156
|
+
reproducible within a dependency environment, and the p-value resolution is
|
|
157
|
+
`1 / (n_resamples + 1)`. Resampling p-values have Monte Carlo uncertainty: increase
|
|
158
|
+
the count for decisions near a threshold. A seed is not a substitute for precision.
|
|
159
|
+
|
|
160
|
+
## Results and interpretation
|
|
161
|
+
|
|
162
|
+
- `status`: `significant`, `not_significant`, `omnibus_only`, `insufficient_data`, or
|
|
163
|
+
`degenerate`. Invalid inputs raise `ValueError` instead of reporting nonsignificance.
|
|
164
|
+
- `omnibus_p_value`, `omnibus_significant`, `test_name`: structured overall result.
|
|
165
|
+
`a_priori_test` remains a human-readable compatibility field, not evidence that
|
|
166
|
+
the method was actually selected before seeing the data.
|
|
167
|
+
- `comparisons`: every pair, including nonsignificant pairs. Each has `raw_p_value`
|
|
168
|
+
where available, `adjusted_p_value` (also exposed as `p_value`), `correction_method`,
|
|
169
|
+
`family_size`, and `significant` (the adjusted pairwise decision).
|
|
170
|
+
- `significant_results`: adjusted significant pairs **only when the omnibus test also
|
|
171
|
+
rejects**. An overall rejection without an identified pair has `omnibus_only` status.
|
|
172
|
+
Pairwise decisions in `comparisons` are not overwritten by this presentation gate.
|
|
173
|
+
- `input_sample_size`, `sample_size`, `excluded_rows`: input and analyzed row counts.
|
|
174
|
+
Independent sample size is total observations; paired sample size counts subjects.
|
|
175
|
+
- `target`, `positive_event`, `assumptions`, `notes`: the question, event definition,
|
|
176
|
+
design requirements, diagnostics and any resampling/exclusion details.
|
|
177
|
+
|
|
178
|
+
Effect direction follows `groups[0]` versus `groups[1]`, never a ranking of winners:
|
|
179
|
+
mean and probability differences are first minus second. Dunn includes probability
|
|
180
|
+
of superiority (ties count half); Wilcoxon includes matched-pairs rank-biserial
|
|
181
|
+
correlation; Friedman posthoc reports mean within-subject rank differences. Group
|
|
182
|
+
medians remain descriptive and are never printed as an inferential inequality.
|
|
183
|
+
|
|
184
|
+
Mean intervals use Tukey/Games-Howell simultaneous intervals or Bonferroni paired-t
|
|
185
|
+
intervals. Binary difference intervals combine exact Clopper-Pearson marginal bounds
|
|
186
|
+
with a Bonferroni union bound; they are conservative and valid for paired as well as
|
|
187
|
+
independent samples under the independent-subject assumption. They need not invert
|
|
188
|
+
the reported binary hypothesis test. The sign test reports an exact interval for the
|
|
189
|
+
conditional positive-difference probability. `confidence_level` is `1 - alpha`, and
|
|
190
|
+
`ci_scope` identifies familywise versus pointwise coverage.
|
|
191
|
+
|
|
192
|
+
Rank-effect confidence intervals are **not estimated**; `confidence_interval` is null
|
|
193
|
+
and `ci_method` explains that limitation. For methods without a separate unadjusted
|
|
194
|
+
p-value supplied by the implementation (such as Nemenyi), `raw_p_value` is null.
|
|
195
|
+
Do not reinterpret a descriptive effect as a different tested estimand.
|
|
196
|
+
|
|
197
|
+
The default `min_sample_size=25` is a data policy, not a power calculation or a guarantee
|
|
198
|
+
of adequate cell counts. It can be lowered to at least two. The Kruskal-Wallis path
|
|
199
|
+
requires at least five observations per group. Infinite values, invalid alpha values,
|
|
200
|
+
missing columns and malformed designs are rejected. Constant numeric groups with
|
|
201
|
+
unestimable variance return `degenerate`; identical paired observations return p=1.
|
|
202
|
+
|
|
203
|
+
## Transforming long data
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
from abalytics.utils import convert_long_to_wide
|
|
207
|
+
|
|
208
|
+
wide = convert_long_to_wide(
|
|
209
|
+
long_data, index_col="subject_id", columns_col="condition"
|
|
210
|
+
)
|
|
211
|
+
# Only if averaging duplicate subject/condition rows is justified:
|
|
212
|
+
wide = convert_long_to_wide(
|
|
213
|
+
long_data, "subject_id", "condition", aggregation="mean"
|
|
214
|
+
)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Duplicate subject/condition keys are rejected by default. Missing keys and flattened
|
|
218
|
+
column-name collisions are rejected. Use `flatten_columns=False` for multilevel
|
|
219
|
+
columns. Aggregation is explicit because repeated sessions are not automatically
|
|
220
|
+
independent observations or interchangeable repeated measurements.
|
|
221
|
+
|
|
222
|
+
## Formatting
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
from abalytics.utils import format_results_as_table
|
|
226
|
+
|
|
227
|
+
print(format_results_as_table(
|
|
228
|
+
[result], identifiers_list=[{"Experiment": "Checkout"}], show_details=True
|
|
229
|
+
))
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
All comparisons are shown by default. Set `show_only_significant_results=True` to
|
|
233
|
+
filter to omnibus-gated significant pairs. Formatting does not modify identifiers.
|
|
234
|
+
Small p-values are displayed as `<0.001`, not `0.000`. The unrounded values remain
|
|
235
|
+
available in the structured results. `output_format` accepts tabulate formats.
|
|
236
|
+
|
|
237
|
+
## Scope of inference
|
|
238
|
+
|
|
239
|
+
These functions analyze a fixed-horizon experiment. Their multiplicity corrections
|
|
240
|
+
cover pairs **inside one call**, not multiple metrics, segments, experiments, or
|
|
241
|
+
repeated monitoring of accumulating data. Prespecify the relevant testing family and
|
|
242
|
+
stopping rule. Sequential tests and cross-metric correction must be handled separately.
|
|
243
|
+
|
|
244
|
+
Randomization, clustering, repeated sessions per user, causal interpretation, missingness,
|
|
245
|
+
and practical importance cannot be inferred from dtypes. Aggregate at the randomized
|
|
246
|
+
unit only when justified, or use a model that explicitly handles the dependency.
|
|
247
|
+
Statistical significance does not establish business benefit or an important effect.
|
|
248
|
+
|
|
249
|
+
## Migration from 4.x
|
|
250
|
+
|
|
251
|
+
Version 5 changes numeric defaults to `method="mean"`. Use `method="rank"` for a
|
|
252
|
+
prespecified rank hypothesis, `method="anova"` for independent equal-variance ANOVA,
|
|
253
|
+
or explicitly request warning-bearing `method="auto"` for legacy routing. Safety,
|
|
254
|
+
encoding and reporting fixes still apply in legacy mode.
|
|
255
|
+
|
|
256
|
+
Binary values no longer use the majority category as success; ambiguous labels require
|
|
257
|
+
`positive_value`. Binary `GroupResult.mean` now consistently uses 0–1 units. Posthoc
|
|
258
|
+
`p_value` consistently means adjusted p-value. Tables show all comparisons by default,
|
|
259
|
+
and result text uses neutral comparisons instead of winner claims. Duplicate pivot
|
|
260
|
+
keys require an explicit aggregation rule. Python 3.11+ and Pydantic 2 are required.
|
|
261
|
+
|
|
262
|
+
## Development
|
|
263
|
+
|
|
264
|
+
With [uv](https://docs.astral.sh/uv/), create an environment using the Python version
|
|
265
|
+
in `.python-version` and install the latest compatible dependencies:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
uv venv --seed
|
|
269
|
+
source .venv/bin/activate
|
|
270
|
+
python -m pip install --upgrade --upgrade-strategy eager -e '.[test]' build twine
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Alternatively, create the environment with `python3.15 -m venv .venv`, activate it,
|
|
274
|
+
and run the same install command. On Windows, activate with `.venv\Scripts\activate`.
|
|
275
|
+
Repeat the install command to refresh an existing environment's dependencies.
|
|
276
|
+
|
|
277
|
+
Run the tests and build checks in the activated environment:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
python -m pytest
|
|
281
|
+
python -m build
|
|
282
|
+
python -m twine check dist/*
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Runtime dependencies use version ranges so installers can select current releases
|
|
286
|
+
without requiring every consumer to use the newest version. Pydantic stays within v2.
|
|
287
|
+
`tests/minimum-requirements.txt` pins the oldest supported runtime dependencies for
|
|
288
|
+
compatibility testing only; it is not the default development environment.
|
|
289
|
+
CI tests that minimum configuration on Python 3.11 and current compatible dependencies
|
|
290
|
+
on Python 3.11–3.15, builds distributions, and imports/runs the wheel in a fresh
|
|
291
|
+
environment outside the checkout. Release publishing uses Python 3.15 and waits for
|
|
292
|
+
those tests.
|
|
293
|
+
Local experiment scripts and data are excluded from automated test discovery.
|
|
294
|
+
|
|
295
|
+
Statistical references: [SciPy Wilcoxon](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wilcoxon.html),
|
|
296
|
+
[NIST Kruskal-Wallis](https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/kruskwal.htm),
|
|
297
|
+
[Pingouin repeated-measures ANOVA](https://pingouin-stats.org/generated/pingouin.rm_anova.html),
|
|
298
|
+
and [Delacre et al. on Welch and preliminary-test selection](https://doi.org/10.5334/irsp.82).
|