Skip to content

Commit 450e5b7

Browse files
author
bgeurten
committed
docs(sphinx): expose v0.2.0 submodules in API reference + index quickstarts
docs/api.rst: Three new automodule sections (Case-Crossover Estimators, Model Comparison, Dose-Response and Breakpoint Analysis) with one-paragraph leads explaining what each submodule covers. Existing sections unchanged. docs/index.rst: Features list rewritten to flag core-vs-v0.2.0 capabilities. Three new quickstart code blocks (benjamini_hochberg on a heterogeneous battery; broken_stick_fit + davies_test + hill_fit on synthetic dose-response data; URL-corrected docs badge). docs/conf.py: release bumped from '0.1.0' to '0.2.0'.
1 parent 555e7eb commit 450e5b7

3 files changed

Lines changed: 125 additions & 11 deletions

File tree

docs/api.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,44 @@ Multi-Group Testing
4141
:undoc-members:
4242
:show-inheritance:
4343

44+
Case-Crossover Estimators (v0.2.0)
45+
----------------------------------
46+
47+
Time-stratified case-crossover conditional logit with stratified-
48+
permutation backup and Burke-2015 σ-rescaled effect translator.
49+
50+
.. automodule:: rerandomstats.case_crossover
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
Model Comparison (v0.2.0)
56+
-------------------------
57+
58+
Wald two-sample-β test, nested-model likelihood-ratio test, and the
59+
shared-algorithmic-source p-value correction helpers
60+
(``correct_pvalues`` / ``correct_pvalues_array`` /
61+
``benjamini_hochberg``) routing through ``statsmodels.stats.multitest.multipletests``.
62+
63+
.. automodule:: rerandomstats.model_comparison
64+
:members:
65+
:undoc-members:
66+
:show-inheritance:
67+
68+
Dose-Response and Breakpoint Analysis (v0.2.0)
69+
----------------------------------------------
70+
71+
Broken-stick segmented regression with profile-RSS 95 % CI on the
72+
breakpoint, the Davies (1987 / 2002) and Muggeo (2016) Pseudo-Score
73+
breakpoint-existence tests, the 4-parameter Hill / logistic fit with
74+
Sebaugh–McCray lower-bend point, and a per-subject iterator that
75+
applies any of the four to a panel of subjects.
76+
77+
.. automodule:: rerandomstats.dose_response
78+
:members:
79+
:undoc-members:
80+
:show-inheritance:
81+
4482
Resampling Index Generator
4583
--------------------------
4684

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
project = "reRandomStats"
1313
copyright = "2023-2026, Bart R.H. Geurten"
1414
author = "Bart R.H. Geurten"
15-
release = "0.1.0"
15+
release = "0.2.0"
1616

1717
# -- General configuration ---------------------------------------------------
1818
extensions = [

docs/index.rst

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,69 @@
11
reRandomStats Documentation
22
============================
33

4-
.. image:: https://github.com/zerotonin/rerandomstats/actions/workflows/tests.yml/badge.svg
5-
:target: https://github.com/zerotonin/rerandomstats/actions/workflows/tests.yml
4+
.. image:: https://github.com/zerotonin/reRandomStats/actions/workflows/tests.yml/badge.svg
5+
:target: https://github.com/zerotonin/reRandomStats/actions/workflows/tests.yml
66
:alt: Tests
77

8+
.. image:: https://github.com/zerotonin/reRandomStats/actions/workflows/docs.yml/badge.svg
9+
:target: https://zerotonin.github.io/reRandomStats/
10+
:alt: Docs
11+
812
.. image:: https://img.shields.io/badge/License-MIT-yellow.svg
913
:target: https://opensource.org/licenses/MIT
1014
:alt: License: MIT
1115

12-
A comprehensive Python toolkit for **re-randomisation statistics** in the
13-
tradition of Sir Ronald A. Fisher.
16+
A comprehensive Python toolkit for **re-randomisation statistics** in
17+
the tradition of Sir Ronald A. Fisher, extended in v0.2.0 with
18+
time-stratified case-crossover estimators, model-comparison helpers
19+
that share a single algorithmic source for multiple-comparisons
20+
correction, and a dose-response / breakpoint-analysis toolkit
21+
(broken-stick + Davies + Muggeo Pseudo-Score + 4-parameter Hill).
1422

1523
Features
1624
--------
1725

18-
- Fisher's Resampling Test with flexible test statistics (mean, median, sum)
19-
- Fisher's Exact Test for 2×2 contingency tables
20-
- Multi-group pairwise comparisons with FDR correction
21-
- Binomial proportion tests with Wilson confidence intervals
22-
- Classical hypothesis test dispatcher (Mann-Whitney U, Kruskal-Wallis, etc.)
23-
- CSV data I/O with German-locale support and wide→long conversion
26+
Core (v0.1.0+):
27+
28+
- **Fisher's Resampling Test** — flexible test statistics
29+
(mean / median / sum differences)
30+
- **Fisher's Exact Test** — 2×2 contingency table
31+
- **Multi-Group Pairwise Testing** — with automatic multiple-testing
32+
correction
33+
- **Binomial Proportion Tests** — single- and two-sample variants
34+
with Wilson confidence intervals
35+
- **Classical Hypothesis Tests** — unified dispatcher for
36+
Mann-Whitney U, Kruskal-Wallis, Kolmogorov-Smirnov, Mood's
37+
Median, Wilcoxon Rank-Sum, independent t-test, chi-square
38+
- **Data I/O** — CSV reader with German-locale support and
39+
wide → long table conversion
40+
- **Pretty-Table Output** — manuscript-ready ASCII / Markdown tables
41+
42+
New in v0.2.0 — three submodules:
43+
44+
- **case_crossover** — time-stratified case-crossover conditional
45+
logit (Maclure 1991, Lee et al. 2023) with stratified-permutation
46+
backup, daylight-hours covariate, within-event temporal-contrast
47+
test (hot-day-vs-hot-week), and Burke-2015 σ-rescaled effect
48+
translator
49+
- **model_comparison** — two-sample Wald z-test on
50+
independently-estimated coefficients, nested-model likelihood-
51+
ratio test, single-method correction (`correct_pvalues`), array
52+
helper (`correct_pvalues_array`), and dual-method BH + Bonferroni
53+
report (`benjamini_hochberg`); all four correction helpers route
54+
through one `statsmodels.stats.multitest.multipletests` call
55+
- **dose_response** — broken-stick segmented regression with
56+
profile-RSS 95 % CI on the breakpoint, Davies (1987 / 2002) and
57+
Muggeo (2016) Pseudo-Score tests for breakpoint existence,
58+
4-parameter Hill fit with Sebaugh–McCray (2003) lower-bend point,
59+
and a per-subject iterator that applies any of the four to a panel
60+
of subjects (pickle-safe for ``concurrent.futures.ProcessPoolExecutor``)
2461

2562
Quick Start
2663
-----------
2764

65+
Core resampling test:
66+
2867
.. code-block:: python
2968
3069
from rerandomstats import FisherResamplingTest
@@ -38,6 +77,43 @@ Quick Start
3877
p_value = test.main()
3978
print(f"p = {p_value:.4f}")
4079
80+
Multi-comparisons correction on a heterogeneous battery:
81+
82+
.. code-block:: python
83+
84+
from rerandomstats import benjamini_hochberg
85+
86+
# p-values from arbitrary tests (case-crossover, Wald, Poisson, LRT, …)
87+
result = benjamini_hochberg({
88+
"H1": 0.001, "H2": 0.012, "H3": 0.040, "H4": 0.080,
89+
})
90+
for name, row in result["results"].items():
91+
print(f"{name}: q = {row['bh_adjusted_p']:.4f} "
92+
f"BH-reject = {row['bh_reject']}")
93+
94+
Breakpoint detection on dose-response data:
95+
96+
.. code-block:: python
97+
98+
import numpy as np
99+
from rerandomstats import broken_stick_fit, davies_test, hill_fit
100+
101+
x = np.random.uniform(10, 30, 300)
102+
y = np.where(x <= 22, 38 + 0.05 * x,
103+
38 + 0.05 * 22 + 0.8 * (x - 22))
104+
y += np.random.normal(0, 0.2, 300)
105+
106+
bs = broken_stick_fit(x, y)
107+
print(f"Breakpoint = {bs['breakpoint']:.2f} "
108+
f"[{bs['breakpoint_ci_lo']:.2f}, {bs['breakpoint_ci_hi']:.2f}]")
109+
110+
davies = davies_test(x, y)
111+
print(f"Davies p = {davies['pvalue']:.4f}")
112+
113+
hill = hill_fit(x, y)
114+
print(f"EC50 = {hill['ec50']:.2f}, Hill n = {hill['hill_n']:.2f}, "
115+
f"lower bend = {hill['lower_bend']:.2f}")
116+
41117
.. toctree::
42118
:maxdepth: 2
43119
:caption: Contents

0 commit comments

Comments
 (0)