nested-recd 0.1.0__tar.gz → 0.2.3__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.
- nested_recd-0.2.3/PKG-INFO +228 -0
- nested_recd-0.2.3/README.md +193 -0
- {nested_recd-0.1.0 → nested_recd-0.2.3}/pyproject.toml +3 -3
- {nested_recd-0.1.0 → nested_recd-0.2.3}/src/nested_recd/__init__.py +33 -4
- nested_recd-0.2.3/src/nested_recd/ordinal_levels.py +1088 -0
- nested_recd-0.2.3/src/nested_recd.egg-info/PKG-INFO +228 -0
- {nested_recd-0.1.0 → nested_recd-0.2.3}/src/nested_recd.egg-info/SOURCES.txt +1 -0
- nested_recd-0.2.3/tests/test_joint_counting.py +144 -0
- nested_recd-0.2.3/tests/test_smoke.py +215 -0
- nested_recd-0.1.0/PKG-INFO +0 -156
- nested_recd-0.1.0/README.md +0 -121
- nested_recd-0.1.0/src/nested_recd/ordinal_levels.py +0 -562
- nested_recd-0.1.0/src/nested_recd.egg-info/PKG-INFO +0 -156
- nested_recd-0.1.0/tests/test_smoke.py +0 -87
- {nested_recd-0.1.0 → nested_recd-0.2.3}/LICENSE +0 -0
- {nested_recd-0.1.0 → nested_recd-0.2.3}/setup.cfg +0 -0
- {nested_recd-0.1.0 → nested_recd-0.2.3}/src/nested_recd/py.typed +0 -0
- {nested_recd-0.1.0 → nested_recd-0.2.3}/src/nested_recd/surrogates.py +0 -0
- {nested_recd-0.1.0 → nested_recd-0.2.3}/src/nested_recd.egg-info/dependency_links.txt +0 -0
- {nested_recd-0.1.0 → nested_recd-0.2.3}/src/nested_recd.egg-info/requires.txt +0 -0
- {nested_recd-0.1.0 → nested_recd-0.2.3}/src/nested_recd.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nested-recd
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: Nested ordinal RECD: Φ1–Φ3, continuous excess³ (exportable Level-3 proxy), Res_pair (strong residual), and λ-weighted Discrete Extramental Clock
|
|
5
|
+
Author-email: Johel Padilla-Villanueva <joel.padilla2@upr.edu>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/johelpadilla/nested-recd
|
|
8
|
+
Project-URL: Repository, https://github.com/johelpadilla/nested-recd
|
|
9
|
+
Project-URL: Issues, https://github.com/johelpadilla/nested-recd/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/johelpadilla/nested-recd#readme
|
|
11
|
+
Project-URL: DOI, https://doi.org/10.5281/zenodo.22970079
|
|
12
|
+
Keywords: RECD,ordinal patterns,nested time,Systemic Tau,complexity,early-warning,network physiology,Bandt-Pompe
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: numpy>=1.22
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
32
|
+
Requires-Dist: build; extra == "dev"
|
|
33
|
+
Requires-Dist: twine; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# nested-recd
|
|
37
|
+
|
|
38
|
+
> **Correction (0.2.3).** Versions ≤ 0.2.2 computed `H_joint` and the pairwise
|
|
39
|
+
> entropies inside `Syn` with `np.unique` on a list of tuples and no `axis=0`.
|
|
40
|
+
> NumPy flattens that input, so `Syn`, `excess3` and binary `phi3` were not the
|
|
41
|
+
> published definition when `N ≥ 3`. `Surp` and `Res_pair` were not affected.
|
|
42
|
+
> For `N = 2`, `Syn` is 0 either way. 0.2.3 counts joint rows.
|
|
43
|
+
> `legacy_pooled_counting=True` reproduces the old numbers and warns.
|
|
44
|
+
> See `CHANGELOG.md`. This version:
|
|
45
|
+
> [10.5281/zenodo.22970079](https://doi.org/10.5281/zenodo.22970079).
|
|
46
|
+
> The 0.2.2 deposit remains
|
|
47
|
+
> [10.5281/zenodo.21937204](https://doi.org/10.5281/zenodo.21937204).
|
|
48
|
+
|
|
49
|
+
[](https://pypi.org/project/nested-recd/)
|
|
50
|
+
[](https://pypi.org/project/nested-recd/)
|
|
51
|
+
[](LICENSE)
|
|
52
|
+
|
|
53
|
+
**Nested ordinal RECD** — pure-NumPy implementation of nested ordinal conjunction levels (Φ₁, Φ₂, Φ₃), the continuous **excess³** Level-3 *proxy* (T-IV; not the strong residual), optional **Res_pair** \(=\mathrm{KL}(P\|P^{(2)})\), Gibbs-α weights, and λ-weighted Discrete Extramental Clock (RECD) accumulation.
|
|
54
|
+
|
|
55
|
+
This is the **canonical nested-clock software** for the Systemic Tau / RECD stack (foundations paper, excess³ methods preprint, cardiac CCTP/SDDB pilot, Academy Learning Tau).
|
|
56
|
+
|
|
57
|
+
**Léxico (no negociable):** *strong Level-3* := `Res_pair`. *excess3* := exportable proxy. Report `w` with any Res_pair figure. Abundance (excess3) ≠ aggregation share \(f_3\).
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install nested-recd
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
From source (development):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install -e ".[dev]"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## excess³ contract (methods)
|
|
72
|
+
|
|
73
|
+
Canonical specification: Padilla-Villanueva (2026), *excess³: A Pre-Specified Continuous Proxy…*
|
|
74
|
+
DOI: [10.5281/zenodo.21385937](https://doi.org/10.5281/zenodo.21385937) · repo: [github.com/johelpadilla/excess3](https://github.com/johelpadilla/excess3)
|
|
75
|
+
|
|
76
|
+
| Rule | Software |
|
|
77
|
+
|------|----------|
|
|
78
|
+
| `excess3 = 0.6·Syn + 0.4·Surp` | `ALPHA_SYN`, `ALPHA_SURP` (fixed a priori) |
|
|
79
|
+
| Continuous primary | `out["excess3"]` / `compute_phi3_excess` |
|
|
80
|
+
| Φ₃ secondary | binary ticks of excess3 vs `theta3` |
|
|
81
|
+
| Null on full contrast | `surrogate_pvalue_delta_excess3` (phase-shuffle / permute on `\|Δ\|`) |
|
|
82
|
+
| Proxy ≠ full PID | documented; no complete Williams–Beer atom claimed |
|
|
83
|
+
| Parallel nesting | Φ₁, Φ₂, excess³ computed without hard Boolean ascent |
|
|
84
|
+
|
|
85
|
+
Defaults: `m=3`, delay `1`, window `13`, `theta3=0.10` (software); cardio-like reference `DEFAULT_THETA3_CARDIO=0.08`.
|
|
86
|
+
|
|
87
|
+
## Quick start
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
import numpy as np
|
|
91
|
+
from nested_recd import compute_recd_from_conjunctions, ALPHA_SYN, ALPHA_SURP
|
|
92
|
+
|
|
93
|
+
rng = np.random.default_rng(0)
|
|
94
|
+
X = rng.normal(size=(800, 3)).cumsum(axis=0)
|
|
95
|
+
|
|
96
|
+
out = compute_recd_from_conjunctions(X, m=3, d=4, theta3=0.10)
|
|
97
|
+
|
|
98
|
+
print("mean excess³ (primary):", float(np.nanmean(out["excess3"])))
|
|
99
|
+
print("Φ3 active fraction:", float(np.nanmean(out["phi3"] > 0)))
|
|
100
|
+
print("weights:", out["params"]["alpha_syn"], out["params"]["alpha_surp"])
|
|
101
|
+
print("final T_recd:", float(out["T_recd"][-1]))
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Strong residual Res_pair (optional)
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
out = compute_recd_from_conjunctions(X, compute_res=True)
|
|
108
|
+
# or, on a symbol window:
|
|
109
|
+
from nested_recd import compute_res_pair_window
|
|
110
|
+
# Always report window length with Res_pair (Nota 4: w=13 can bias chaos).
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Continuous excess³ only
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from nested_recd import generate_multivariate_symbols, compute_phi3_excess
|
|
117
|
+
|
|
118
|
+
S = generate_multivariate_symbols(X, m=3)
|
|
119
|
+
phi3, excess3 = compute_phi3_excess(S, window=13, theta=0.10, stride=1)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Surrogate p-value on |Δ excess3|
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from nested_recd import surrogate_pvalue_delta_excess3
|
|
126
|
+
|
|
127
|
+
res = surrogate_pvalue_delta_excess3(X, split=400, n_surr=99, method="phase", seed=0)
|
|
128
|
+
print(res["delta_obs"], res["p_value"])
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Optional τ_s for λ regime weights
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
out = compute_recd_from_conjunctions(X, tau_s=tau_s)
|
|
135
|
+
# or
|
|
136
|
+
out = compute_recd_from_conjunctions(X, lam_override=0.5)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Note:** `delta_recd` / `T_recd` use **binary Φ₃** in the α-weighted clock (legacy Discrete Extramental Clock). For **exportable / scalable** Level-3 reporting, use continuous **excess³** and nulls on `|Δ excess3|`. For **strong** Level-3 claims, report **`res_pair`** (enable `compute_res=True`) **and the window `w`**. Do not identify the two.
|
|
140
|
+
|
|
141
|
+
## What it computes
|
|
142
|
+
|
|
143
|
+
| Symbol | Meaning |
|
|
144
|
+
|--------|---------|
|
|
145
|
+
| **Φ₁** | Co-occurrence of identical ordinal symbols across variable pairs |
|
|
146
|
+
| **Φ₂** | Persistence of pairwise ordinal relations over lag `d` |
|
|
147
|
+
| **excess³** | Continuous hybrid: `0.6·Syn + 0.4·Surp` (**exportable Level-3 proxy**; T-IV) |
|
|
148
|
+
| **Φ₃** | Binary ticks of excess³ above `theta3` (**secondary**) |
|
|
149
|
+
| **Res_pair** | Strong Level-3 residual `KL(P ‖ P^(2))` (optional; always report `w`) |
|
|
150
|
+
| **λ** | Chaos / reorganization intensity (from `τ_s` or `lam_override`) |
|
|
151
|
+
| **α(λ)** | Design-engine weights (template or Gibbs-α); **not** a joint observable |
|
|
152
|
+
| **ΔRECD** | `α₁Φ₁ + α₂Φ₂ + α₃Φ₃` (legacy clock; binary Φ₃) |
|
|
153
|
+
| **T_recd** | Cumulative sum of ΔRECD |
|
|
154
|
+
|
|
155
|
+
Ordinal symbols use Bandt–Pompe patterns (`m=3` by default).
|
|
156
|
+
|
|
157
|
+
## Surrogates
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
from nested_recd import phase_shuffle_independent, random_permutation_independent
|
|
161
|
+
|
|
162
|
+
X_null = phase_shuffle_independent(X, seed=42)
|
|
163
|
+
X_perm = random_permutation_independent(X, seed=42)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## API surface
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from nested_recd import (
|
|
170
|
+
ALPHA_SYN, ALPHA_SURP,
|
|
171
|
+
DEFAULT_THETA3, DEFAULT_THETA3_CARDIO,
|
|
172
|
+
compute_recd_from_conjunctions,
|
|
173
|
+
compute_phi1, compute_phi2, compute_phi3,
|
|
174
|
+
compute_phi3_excess, compute_excess3_window,
|
|
175
|
+
mean_excess_pre_post, surrogate_pvalue_delta_excess3,
|
|
176
|
+
compute_lambda, alpha_weights, alpha_weights_gibbs, regime_lambda_proxy,
|
|
177
|
+
compute_res_pair, compute_res_pair_window,
|
|
178
|
+
compute_weighted_contributions, high_level3_rate,
|
|
179
|
+
generate_multivariate_symbols,
|
|
180
|
+
phase_shuffle_independent, generate_surrogate_ensemble,
|
|
181
|
+
)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Relation to other projects
|
|
185
|
+
|
|
186
|
+
| Project | Role |
|
|
187
|
+
|---------|------|
|
|
188
|
+
| [`systemictau`](https://pypi.org/project/systemictau/) | Full Systemic Tau library (τ_s, gate RECD, studio) — optional `[nested]` extra |
|
|
189
|
+
| [`systemictau-web`](https://github.com/johelpadilla/systemictau-web) | Streamlit app; depends on this package |
|
|
190
|
+
| [`excess3`](https://github.com/johelpadilla/excess3) | Methods + intro ES + primer (specification) |
|
|
191
|
+
| [`cctp-sddb-systemic-tau`](https://github.com/johelpadilla/cctp-sddb-systemic-tau) | Cardiac VF pilot |
|
|
192
|
+
| This package | Lightweight, installable nested-time / excess³ core |
|
|
193
|
+
|
|
194
|
+
## Citation
|
|
195
|
+
|
|
196
|
+
If you use excess³ / Level-3 from this package, cite the **methods** preprint (canonical specification):
|
|
197
|
+
|
|
198
|
+
> Padilla-Villanueva, J. (2026). *excess³: A Pre-Specified Continuous Proxy for Order-3 Synergistic Surplus* (methods). Zenodo. https://doi.org/10.5281/zenodo.21385937
|
|
199
|
+
|
|
200
|
+
This software (0.2.3):
|
|
201
|
+
|
|
202
|
+
> Padilla-Villanueva, J. (2026). *nested-recd 0.2.3: Nested ordinal RECD, excess³ proxy, and Res_pair*. Zenodo. https://doi.org/10.5281/zenodo.22970079
|
|
203
|
+
|
|
204
|
+
The previous release (0.2.2), which pooled symbols inside Syn, remains citable as https://doi.org/10.5281/zenodo.21937204.
|
|
205
|
+
|
|
206
|
+
Software / related stack:
|
|
207
|
+
|
|
208
|
+
> Padilla-Villanueva, J. (2026). Systemic Tau software archive. Zenodo. https://doi.org/10.5281/zenodo.20576241
|
|
209
|
+
|
|
210
|
+
CCTP/SDDB pilot:
|
|
211
|
+
|
|
212
|
+
> Padilla-Villanueva, J. (2026). *CCTP/SDDB: Systemic Tau and ordinal RECD before spontaneous ventricular fibrillation* (v1.0.1). Zenodo. https://doi.org/10.5281/zenodo.21270699
|
|
213
|
+
|
|
214
|
+
```bibtex
|
|
215
|
+
@software{padilla_nested_recd_2026,
|
|
216
|
+
author = {Padilla-Villanueva, Johel},
|
|
217
|
+
title = {nested-recd: Nested ordinal RECD levels and continuous excess³},
|
|
218
|
+
year = {2026},
|
|
219
|
+
url = {https://github.com/johelpadilla/nested-recd},
|
|
220
|
+
version = {0.2.3},
|
|
221
|
+
doi = {10.5281/zenodo.22970079}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
MIT © 2026 Johel Padilla-Villanueva
|
|
228
|
+
ORCID: [0000-0002-5797-6931](https://orcid.org/0000-0002-5797-6931)
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# nested-recd
|
|
2
|
+
|
|
3
|
+
> **Correction (0.2.3).** Versions ≤ 0.2.2 computed `H_joint` and the pairwise
|
|
4
|
+
> entropies inside `Syn` with `np.unique` on a list of tuples and no `axis=0`.
|
|
5
|
+
> NumPy flattens that input, so `Syn`, `excess3` and binary `phi3` were not the
|
|
6
|
+
> published definition when `N ≥ 3`. `Surp` and `Res_pair` were not affected.
|
|
7
|
+
> For `N = 2`, `Syn` is 0 either way. 0.2.3 counts joint rows.
|
|
8
|
+
> `legacy_pooled_counting=True` reproduces the old numbers and warns.
|
|
9
|
+
> See `CHANGELOG.md`. This version:
|
|
10
|
+
> [10.5281/zenodo.22970079](https://doi.org/10.5281/zenodo.22970079).
|
|
11
|
+
> The 0.2.2 deposit remains
|
|
12
|
+
> [10.5281/zenodo.21937204](https://doi.org/10.5281/zenodo.21937204).
|
|
13
|
+
|
|
14
|
+
[](https://pypi.org/project/nested-recd/)
|
|
15
|
+
[](https://pypi.org/project/nested-recd/)
|
|
16
|
+
[](LICENSE)
|
|
17
|
+
|
|
18
|
+
**Nested ordinal RECD** — pure-NumPy implementation of nested ordinal conjunction levels (Φ₁, Φ₂, Φ₃), the continuous **excess³** Level-3 *proxy* (T-IV; not the strong residual), optional **Res_pair** \(=\mathrm{KL}(P\|P^{(2)})\), Gibbs-α weights, and λ-weighted Discrete Extramental Clock (RECD) accumulation.
|
|
19
|
+
|
|
20
|
+
This is the **canonical nested-clock software** for the Systemic Tau / RECD stack (foundations paper, excess³ methods preprint, cardiac CCTP/SDDB pilot, Academy Learning Tau).
|
|
21
|
+
|
|
22
|
+
**Léxico (no negociable):** *strong Level-3* := `Res_pair`. *excess3* := exportable proxy. Report `w` with any Res_pair figure. Abundance (excess3) ≠ aggregation share \(f_3\).
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install nested-recd
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
From source (development):
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install -e ".[dev]"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## excess³ contract (methods)
|
|
37
|
+
|
|
38
|
+
Canonical specification: Padilla-Villanueva (2026), *excess³: A Pre-Specified Continuous Proxy…*
|
|
39
|
+
DOI: [10.5281/zenodo.21385937](https://doi.org/10.5281/zenodo.21385937) · repo: [github.com/johelpadilla/excess3](https://github.com/johelpadilla/excess3)
|
|
40
|
+
|
|
41
|
+
| Rule | Software |
|
|
42
|
+
|------|----------|
|
|
43
|
+
| `excess3 = 0.6·Syn + 0.4·Surp` | `ALPHA_SYN`, `ALPHA_SURP` (fixed a priori) |
|
|
44
|
+
| Continuous primary | `out["excess3"]` / `compute_phi3_excess` |
|
|
45
|
+
| Φ₃ secondary | binary ticks of excess3 vs `theta3` |
|
|
46
|
+
| Null on full contrast | `surrogate_pvalue_delta_excess3` (phase-shuffle / permute on `\|Δ\|`) |
|
|
47
|
+
| Proxy ≠ full PID | documented; no complete Williams–Beer atom claimed |
|
|
48
|
+
| Parallel nesting | Φ₁, Φ₂, excess³ computed without hard Boolean ascent |
|
|
49
|
+
|
|
50
|
+
Defaults: `m=3`, delay `1`, window `13`, `theta3=0.10` (software); cardio-like reference `DEFAULT_THETA3_CARDIO=0.08`.
|
|
51
|
+
|
|
52
|
+
## Quick start
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import numpy as np
|
|
56
|
+
from nested_recd import compute_recd_from_conjunctions, ALPHA_SYN, ALPHA_SURP
|
|
57
|
+
|
|
58
|
+
rng = np.random.default_rng(0)
|
|
59
|
+
X = rng.normal(size=(800, 3)).cumsum(axis=0)
|
|
60
|
+
|
|
61
|
+
out = compute_recd_from_conjunctions(X, m=3, d=4, theta3=0.10)
|
|
62
|
+
|
|
63
|
+
print("mean excess³ (primary):", float(np.nanmean(out["excess3"])))
|
|
64
|
+
print("Φ3 active fraction:", float(np.nanmean(out["phi3"] > 0)))
|
|
65
|
+
print("weights:", out["params"]["alpha_syn"], out["params"]["alpha_surp"])
|
|
66
|
+
print("final T_recd:", float(out["T_recd"][-1]))
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Strong residual Res_pair (optional)
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
out = compute_recd_from_conjunctions(X, compute_res=True)
|
|
73
|
+
# or, on a symbol window:
|
|
74
|
+
from nested_recd import compute_res_pair_window
|
|
75
|
+
# Always report window length with Res_pair (Nota 4: w=13 can bias chaos).
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Continuous excess³ only
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from nested_recd import generate_multivariate_symbols, compute_phi3_excess
|
|
82
|
+
|
|
83
|
+
S = generate_multivariate_symbols(X, m=3)
|
|
84
|
+
phi3, excess3 = compute_phi3_excess(S, window=13, theta=0.10, stride=1)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Surrogate p-value on |Δ excess3|
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from nested_recd import surrogate_pvalue_delta_excess3
|
|
91
|
+
|
|
92
|
+
res = surrogate_pvalue_delta_excess3(X, split=400, n_surr=99, method="phase", seed=0)
|
|
93
|
+
print(res["delta_obs"], res["p_value"])
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Optional τ_s for λ regime weights
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
out = compute_recd_from_conjunctions(X, tau_s=tau_s)
|
|
100
|
+
# or
|
|
101
|
+
out = compute_recd_from_conjunctions(X, lam_override=0.5)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Note:** `delta_recd` / `T_recd` use **binary Φ₃** in the α-weighted clock (legacy Discrete Extramental Clock). For **exportable / scalable** Level-3 reporting, use continuous **excess³** and nulls on `|Δ excess3|`. For **strong** Level-3 claims, report **`res_pair`** (enable `compute_res=True`) **and the window `w`**. Do not identify the two.
|
|
105
|
+
|
|
106
|
+
## What it computes
|
|
107
|
+
|
|
108
|
+
| Symbol | Meaning |
|
|
109
|
+
|--------|---------|
|
|
110
|
+
| **Φ₁** | Co-occurrence of identical ordinal symbols across variable pairs |
|
|
111
|
+
| **Φ₂** | Persistence of pairwise ordinal relations over lag `d` |
|
|
112
|
+
| **excess³** | Continuous hybrid: `0.6·Syn + 0.4·Surp` (**exportable Level-3 proxy**; T-IV) |
|
|
113
|
+
| **Φ₃** | Binary ticks of excess³ above `theta3` (**secondary**) |
|
|
114
|
+
| **Res_pair** | Strong Level-3 residual `KL(P ‖ P^(2))` (optional; always report `w`) |
|
|
115
|
+
| **λ** | Chaos / reorganization intensity (from `τ_s` or `lam_override`) |
|
|
116
|
+
| **α(λ)** | Design-engine weights (template or Gibbs-α); **not** a joint observable |
|
|
117
|
+
| **ΔRECD** | `α₁Φ₁ + α₂Φ₂ + α₃Φ₃` (legacy clock; binary Φ₃) |
|
|
118
|
+
| **T_recd** | Cumulative sum of ΔRECD |
|
|
119
|
+
|
|
120
|
+
Ordinal symbols use Bandt–Pompe patterns (`m=3` by default).
|
|
121
|
+
|
|
122
|
+
## Surrogates
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from nested_recd import phase_shuffle_independent, random_permutation_independent
|
|
126
|
+
|
|
127
|
+
X_null = phase_shuffle_independent(X, seed=42)
|
|
128
|
+
X_perm = random_permutation_independent(X, seed=42)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## API surface
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from nested_recd import (
|
|
135
|
+
ALPHA_SYN, ALPHA_SURP,
|
|
136
|
+
DEFAULT_THETA3, DEFAULT_THETA3_CARDIO,
|
|
137
|
+
compute_recd_from_conjunctions,
|
|
138
|
+
compute_phi1, compute_phi2, compute_phi3,
|
|
139
|
+
compute_phi3_excess, compute_excess3_window,
|
|
140
|
+
mean_excess_pre_post, surrogate_pvalue_delta_excess3,
|
|
141
|
+
compute_lambda, alpha_weights, alpha_weights_gibbs, regime_lambda_proxy,
|
|
142
|
+
compute_res_pair, compute_res_pair_window,
|
|
143
|
+
compute_weighted_contributions, high_level3_rate,
|
|
144
|
+
generate_multivariate_symbols,
|
|
145
|
+
phase_shuffle_independent, generate_surrogate_ensemble,
|
|
146
|
+
)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Relation to other projects
|
|
150
|
+
|
|
151
|
+
| Project | Role |
|
|
152
|
+
|---------|------|
|
|
153
|
+
| [`systemictau`](https://pypi.org/project/systemictau/) | Full Systemic Tau library (τ_s, gate RECD, studio) — optional `[nested]` extra |
|
|
154
|
+
| [`systemictau-web`](https://github.com/johelpadilla/systemictau-web) | Streamlit app; depends on this package |
|
|
155
|
+
| [`excess3`](https://github.com/johelpadilla/excess3) | Methods + intro ES + primer (specification) |
|
|
156
|
+
| [`cctp-sddb-systemic-tau`](https://github.com/johelpadilla/cctp-sddb-systemic-tau) | Cardiac VF pilot |
|
|
157
|
+
| This package | Lightweight, installable nested-time / excess³ core |
|
|
158
|
+
|
|
159
|
+
## Citation
|
|
160
|
+
|
|
161
|
+
If you use excess³ / Level-3 from this package, cite the **methods** preprint (canonical specification):
|
|
162
|
+
|
|
163
|
+
> Padilla-Villanueva, J. (2026). *excess³: A Pre-Specified Continuous Proxy for Order-3 Synergistic Surplus* (methods). Zenodo. https://doi.org/10.5281/zenodo.21385937
|
|
164
|
+
|
|
165
|
+
This software (0.2.3):
|
|
166
|
+
|
|
167
|
+
> Padilla-Villanueva, J. (2026). *nested-recd 0.2.3: Nested ordinal RECD, excess³ proxy, and Res_pair*. Zenodo. https://doi.org/10.5281/zenodo.22970079
|
|
168
|
+
|
|
169
|
+
The previous release (0.2.2), which pooled symbols inside Syn, remains citable as https://doi.org/10.5281/zenodo.21937204.
|
|
170
|
+
|
|
171
|
+
Software / related stack:
|
|
172
|
+
|
|
173
|
+
> Padilla-Villanueva, J. (2026). Systemic Tau software archive. Zenodo. https://doi.org/10.5281/zenodo.20576241
|
|
174
|
+
|
|
175
|
+
CCTP/SDDB pilot:
|
|
176
|
+
|
|
177
|
+
> Padilla-Villanueva, J. (2026). *CCTP/SDDB: Systemic Tau and ordinal RECD before spontaneous ventricular fibrillation* (v1.0.1). Zenodo. https://doi.org/10.5281/zenodo.21270699
|
|
178
|
+
|
|
179
|
+
```bibtex
|
|
180
|
+
@software{padilla_nested_recd_2026,
|
|
181
|
+
author = {Padilla-Villanueva, Johel},
|
|
182
|
+
title = {nested-recd: Nested ordinal RECD levels and continuous excess³},
|
|
183
|
+
year = {2026},
|
|
184
|
+
url = {https://github.com/johelpadilla/nested-recd},
|
|
185
|
+
version = {0.2.3},
|
|
186
|
+
doi = {10.5281/zenodo.22970079}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT © 2026 Johel Padilla-Villanueva
|
|
193
|
+
ORCID: [0000-0002-5797-6931](https://orcid.org/0000-0002-5797-6931)
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nested-recd"
|
|
7
|
-
version = "0.
|
|
8
|
-
description = "Nested ordinal RECD: Φ1–Φ3
|
|
7
|
+
version = "0.2.3"
|
|
8
|
+
description = "Nested ordinal RECD: Φ1–Φ3, continuous excess³ (exportable Level-3 proxy), Res_pair (strong residual), and λ-weighted Discrete Extramental Clock"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
11
11
|
license = "MIT"
|
|
@@ -49,7 +49,7 @@ Homepage = "https://github.com/johelpadilla/nested-recd"
|
|
|
49
49
|
Repository = "https://github.com/johelpadilla/nested-recd"
|
|
50
50
|
Issues = "https://github.com/johelpadilla/nested-recd/issues"
|
|
51
51
|
Documentation = "https://github.com/johelpadilla/nested-recd#readme"
|
|
52
|
-
DOI = "https://doi.org/10.5281/zenodo.
|
|
52
|
+
DOI = "https://doi.org/10.5281/zenodo.22970079"
|
|
53
53
|
|
|
54
54
|
[tool.setuptools.packages.find]
|
|
55
55
|
where = ["src"]
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
nested-recd
|
|
3
3
|
===========
|
|
4
4
|
|
|
5
|
-
Nested ordinal RECD: Φ₁ / Φ₂ / Φ₃ conjunction levels
|
|
6
|
-
|
|
5
|
+
Nested ordinal RECD: Φ₁ / Φ₂ / Φ₃ conjunction levels, continuous excess³
|
|
6
|
+
(exportable Level-3 proxy; not the strong residual), optional Res_pair,
|
|
7
|
+
and λ-weighted Discrete Extramental Clock.
|
|
7
8
|
|
|
8
9
|
Quick start
|
|
9
10
|
-----------
|
|
@@ -11,7 +12,7 @@ Quick start
|
|
|
11
12
|
>>> from nested_recd import compute_recd_from_conjunctions
|
|
12
13
|
>>> X = np.random.randn(500, 3).cumsum(axis=0)
|
|
13
14
|
>>> out = compute_recd_from_conjunctions(X)
|
|
14
|
-
>>> out["
|
|
15
|
+
>>> float(np.nanmean(out["excess3"])) # continuous Level-3 *proxy* (T-IV)
|
|
15
16
|
"""
|
|
16
17
|
|
|
17
18
|
from nested_recd.ordinal_levels import (
|
|
@@ -19,15 +20,29 @@ from nested_recd.ordinal_levels import (
|
|
|
19
20
|
DEFAULT_DELAY,
|
|
20
21
|
DEFAULT_D_PERSIST,
|
|
21
22
|
DEFAULT_WINDOW_TAU,
|
|
23
|
+
DEFAULT_WINDOW,
|
|
22
24
|
DEFAULT_THETA_CHAOS,
|
|
23
25
|
DEFAULT_THETA3,
|
|
26
|
+
DEFAULT_THETA3_CARDIO,
|
|
24
27
|
DELTA_FEIGENBAUM,
|
|
28
|
+
ALPHA_SYN,
|
|
29
|
+
ALPHA_SURP,
|
|
25
30
|
generate_multivariate_symbols,
|
|
26
31
|
compute_phi1,
|
|
27
32
|
compute_phi2,
|
|
28
33
|
compute_phi3,
|
|
34
|
+
compute_phi3_excess,
|
|
35
|
+
compute_excess3_window,
|
|
36
|
+
compute_res_pair_window,
|
|
37
|
+
compute_res_pair,
|
|
38
|
+
pairwise_maxent_ipf,
|
|
39
|
+
kl_divergence,
|
|
40
|
+
mean_excess_pre_post,
|
|
41
|
+
surrogate_pvalue_delta_excess3,
|
|
29
42
|
compute_lambda,
|
|
30
43
|
alpha_weights,
|
|
44
|
+
alpha_weights_gibbs,
|
|
45
|
+
alpha_compare_template_gibbs,
|
|
31
46
|
regime_lambda_proxy,
|
|
32
47
|
compute_recd_from_conjunctions,
|
|
33
48
|
simple_level_classification,
|
|
@@ -43,7 +58,7 @@ from nested_recd.surrogates import (
|
|
|
43
58
|
compute_null_distribution,
|
|
44
59
|
)
|
|
45
60
|
|
|
46
|
-
__version__ = "0.
|
|
61
|
+
__version__ = "0.2.3"
|
|
47
62
|
|
|
48
63
|
__all__ = [
|
|
49
64
|
"__version__",
|
|
@@ -51,15 +66,29 @@ __all__ = [
|
|
|
51
66
|
"DEFAULT_DELAY",
|
|
52
67
|
"DEFAULT_D_PERSIST",
|
|
53
68
|
"DEFAULT_WINDOW_TAU",
|
|
69
|
+
"DEFAULT_WINDOW",
|
|
54
70
|
"DEFAULT_THETA_CHAOS",
|
|
55
71
|
"DEFAULT_THETA3",
|
|
72
|
+
"DEFAULT_THETA3_CARDIO",
|
|
56
73
|
"DELTA_FEIGENBAUM",
|
|
74
|
+
"ALPHA_SYN",
|
|
75
|
+
"ALPHA_SURP",
|
|
57
76
|
"generate_multivariate_symbols",
|
|
58
77
|
"compute_phi1",
|
|
59
78
|
"compute_phi2",
|
|
60
79
|
"compute_phi3",
|
|
80
|
+
"compute_phi3_excess",
|
|
81
|
+
"compute_excess3_window",
|
|
82
|
+
"compute_res_pair_window",
|
|
83
|
+
"compute_res_pair",
|
|
84
|
+
"pairwise_maxent_ipf",
|
|
85
|
+
"kl_divergence",
|
|
86
|
+
"mean_excess_pre_post",
|
|
87
|
+
"surrogate_pvalue_delta_excess3",
|
|
61
88
|
"compute_lambda",
|
|
62
89
|
"alpha_weights",
|
|
90
|
+
"alpha_weights_gibbs",
|
|
91
|
+
"alpha_compare_template_gibbs",
|
|
63
92
|
"regime_lambda_proxy",
|
|
64
93
|
"compute_recd_from_conjunctions",
|
|
65
94
|
"simple_level_classification",
|