SPB Git

spb/wp40_uqo

Public MIT
8.7 KB · 58 lines markdown
1# Method registry (Tier A) — conventions, references, tolerances23Status legend: ✅ validated against the named reference on the committed fixtures (tests/reference) · 🧪 implemented,4reference comparison pending · 🧭 experimental · ✖ not implemented. "Tolerance" is the pass criterion of the test.56| Key | Definition | Inputs | Reference software & options | Tolerance | CPU | Metal | Status |7|---|---|---|---|---|---|---|---|8| `returns.log` / `returns.arith` | r_t = log(p_t/p_{t−1}) / p_t/p_{t−1}−1, within session; overnight = prev close → open; close-to-close daily | BarSeries (regular session) | numpy | exact (1e−15) | ✅ | n/a | ✅ |9| `calendar.xnys` | NYSE trading days 2000–2026 (rules + special closures), early closes 13:00, DST America/New_York | dates | exchange_calendars 4.13 XNYS | exact set equality (sessions, holidays, early closes 2000–2026) | ✅ | n/a | ✅ |10| `bars.validate` | OHLC consistency, positivity, grid alignment, session membership, coverage vs 391/211, price jumps > 25 % | BarSeries | FinData `/market/sessions` semantics | counts | ✅ | n/a | ✅ (synthetic) |11| `bars.aggregate` | bins anchored at the session open (09:30 regular / 04:00 extended), the 16:00 closing print is its own bin, no empty bins, OHLC/sum | BarSeries | FinData derived 5m | exact OHLCV: extended policy 280/280 bars (AAPL 2024-11-25…29); regular policy differs only in the closing bin (FinData adds 16:01–16:04) | ✅ | n/a | ✅ (live 2026-11-02) |12| `realized.rv` | Σ r² | returns CSR | highfrequency `rCov` 1e−10, numpy 1e−12 | 1e−10 | ✅ | ✅ 1e−6 | ✅ |13| `realized.bpv` | μ₁⁻²·[M/(M−1)]·Σ|r_j||r_{j−1}| (factor on by default; highfrequency `rBPCov(makeReturns=FALSE)` applies none → compared with factor off) | returns CSR | highfrequency 1e−10, numpy 1e−12 | 1e−10 | ✅ | ✅ 1e−6 | ✅ |14| `realized.rsv` | Σ r² 1{r<0}, Σ r² 1{r>0} | returns CSR | highfrequency `rSVar` 1e−10 | 1e−10 | ✅ | ✅ 1e−6 | ✅ |15| `realized.rq` | (M/3) Σ r⁴ (BPQ 2016; M = number of returns) — highfrequency `rQuar` uses (M+1)/3 (number of prices): compared after conversion | returns CSR | highfrequency `rQuar` 1e−10 (converted), numpy 1e−12 | 1e−10 | ✅ | ✅ | ✅ |16| `realized.jump` | max(RV − BPV, 0) (proxy, no test statistic) | — | ABD 2007 | — | ✅ | — | ✅ |17| `realized.tripv` | μ_{4/3}⁻³·M/(M−2)·Σ Π|r|^{4/3} | returns CSR | highfrequency `rTPQuar` (differs: quarticity) — definition from BNS 2004 | 1e−12 (self) | ✅ | — | 🧪 |18| `realized.rcov` | Σ r_j r_j' on synchronized returns; corr from diag | T×N returns | highfrequency `rCov` | Phase 4 | ✅ | Phase 3 | 🧪 |19| `ols` / `wls` / `ridge` | Householder QR (col-pivoting), SVD fallback, ridge by augmentation; R², adj. R², leverage | X (n×k), y | statsmodels 0.15 OLS/WLS | 1e−10 rel (coef), 1e−9 (SE) | ✅ | sufficient stats Phase 3 | ✅ |20| `cov.classical` | s² (X'X)⁻¹, s² = RSS/(n−k) | — | statsmodels nonrobust | 1e−9 | ✅ | — | ✅ |21| `cov.hc0..hc3` | White sandwich; HC1 n/(n−k); HC2 1/(1−h); HC3 1/(1−h)² | — | statsmodels HC0–HC3 | 1e−9 | ✅ | — | ✅ |22| `cov.hac_bartlett` | Newey–West with Bartlett weights, L given or ⌊4(n/100)^{2/9}⌋, no small-sample correction | — | statsmodels HAC (maxlags=L, use_correction=False) | 1e−9 | ✅ | — | ✅ |23| `cov.cluster` | one-way CGM with G/(G−1)·(n−1)/(n−k) | cluster ids | statsmodels cluster (default correction) | 1e−9 | ✅ | — | ✅ |24| `inference.t` | two-sided p from t(df_resid) (regularised incomplete beta); df ≤ 0 → normal | — | scipy.stats.t | 1e−12 | ✅ | — | ✅ |25| `ols.rolling` | window-by-window QR; step parameter | X, y | statsmodels RollingOLS | self-consistency test; Phase 4 vs statsmodels | ✅ | Phase 3 | 🧪 |26| `har.rv.h{1,5,22}` | y_{t+h} = (1/h)Σ_{j=1..h} RV_{t+j} on [1, RV_t, mean RV_{t−4..t}, mean RV_{t−21..t}]; causal; HAC lags = max(h−1, ⌊4(n/100)^{2/9}⌋) | daily RV | highfrequency `HARmodel` (h=1 coef 1e−8, h=5 average target 1e−6), statsmodels HAC 1e−9 | 1e−8 | ✅ | ✅ batched sufficient stats 1e−4 (Metal) | ✅ |27| `har.logrv` | same on log RV; forecast exp(ŷ) without smearing (factor reported) | daily RV | statsmodels 1e−9 | 1e−9 | ✅ | — | ✅ |28| `har.rv.harq` | + β_Q (√RQ_t − √mean RQ)·RV_t exactly as highfrequency `HARmodel(type="HARQ")` (demeaning optional) | daily RV, RQ | highfrequency 1e−6, statsmodels 1e−9 | 1e−6 | ✅ | — | ✅ |29| `har.rolling` | rolling/expanding refits, origin-ahead forecasts, MSE/QLIKE (Patton 2011) | daily RV | causality test (future perturbation leaves forecasts unchanged) | exact | ✅ | — | ✅ |30| `garch.garch.gaussian` | σ²_t = ω + α ε²_{t−1} + β σ²_{t−1}; σ²_0 = sample variance of ε; constraints ω>0, α,β≥0, α+β<1 | returns | arch 8.0 (loglik 5e−4, params 5 %), rugarch 1.5.6 `ugarchfit(sGARCH)` (loglik 2e−4, params 5 %) | as stated | ✅ | ✅ batched NLL 2e−5 | ✅ |31| `garch.gjr.*` | + γ 1{ε<0} ε²; α+γ ≥ 0; α+β+γ/2 < 1 | returns | arch GJR (o=1) | same | ✅ | — | ✅ |32| `garch.egarch.*` | ln σ²_t = ω + α(|z|−E|z|) + γ z + β ln σ²_{t−1}; |β|<1; h>1 forecasts by simulation (20 000 paths, seeded). **rugarch maps alpha1 ↔ RAID γ (sign) and gamma1 ↔ RAID α (magnitude)** | returns | arch EGARCH, rugarch eGARCH (loglik 2e−4, mapped params 5 %) | same | ✅ | ✅ | ✅ |33| `garch.*.student_t` | standardized t, ν ∈ (2.05, 500) (arch bounds); E|z| via lgamma | returns | arch dist="t" | same; ν skipped when > 100 (unidentified) | ✅ | — | ✅ |34| `garch.cov` | QMLE sandwich H⁻¹ OPG H⁻¹ (Bollerslev–Wooldridge 1992), Hessian, OPG — numerical derivatives | — | arch robust/classic | Phase 4 (SE comparison) | ✅ | — | 🧪 |35| `bootstrap.stationary` / `circular` / `iid` | Politis–Romano 1994 (geometric blocks, mean length b or n^{1/3}) / circular blocks / iid (comparison only); replica r ← Rng(seed, r); percentile CI, SE, bias; `bootstrap_rows` for regressions; `bootstrap_rv` | series | theory: AR(1) long-run SE (block SE within 35 %, > 1.6× iid SE); MC coverage 0.89 (R = 100) | as stated | ✅ | ⏳ (GPU replicas, E5) | ✅ |36| `simulation.*` | Monte Carlo: GARCH(1,1) n=2000 R=120 — coverage 0.90–0.95, |bias| ≤ 0.003, no failures; HAR h=5 HAC coverage 0.895–0.945 (R=200, T=1200, pseudo-true from T=200 000); RV RMSE within 10 % of √(2/M)·IV; NLL finite-difference gradients stable across h | — | `tests/simulation` | — | ✅ | — | ✅ |3738## Tier B (selected, validated 2026-11-02)39| Key | Definition | Inputs | Reference & tolerance | CPU | Metal | Status |40|---|---|---|---|---|---|---|41| `var.p` | VAR(p) with intercept by multivariate LS (QR); Σ_u with ddof = 1+Np; Gaussian log-likelihood; companion-root stability; AIC/BIC/HQ order selection on the common sample | T×N panel | statsmodels 0.15 `VAR.fit(p, trend="c")`: params 1e−9, Σ_u 1e−9, llf 1e−9, `select_order` BIC | ✅ | — | ✅ |42| `var.fevd` | orthogonalised (Cholesky) FEVD, horizon H | VarFit | statsmodels `fevd(H)` 1e−9 | ✅ | — | ✅ |43| `var.gfevd` | generalized FEVD (Koop–Pesaran–Potter 1996; Pesaran–Shin 1998), rows normalised to one (Diebold–Yilmaz 2012) | VarFit | hand-computed Python from statsmodels Φ_h, Σ_u: 1e−9 | ✅ | — | ✅ |44| `connectedness.dy` | total = 100·Σ_{i≠j}θ̃_{ij}/N, from/to/net; rolling windows (parallel over windows) | gfevd | same reference 1e−7 | ✅ | ⏳ (batched covariance inputs, E4) | ✅ |45| `cov.ledoit_wolf` | Σ* = (1−δ)S + δμI with the analytical δ* (Ledoit–Wolf 2004) | n×p | sklearn `ledoit_wolf` formula (hand-computed): 1e−9 | ✅ | — | ✅ |4647Not implemented (Tier B/C, by decision — research value for this paper insufficient or data inadmissible): Realized GARCH,48HEAVY, GARCH-MIDAS, FIGARCH, DCC, BVAR/VECM, local projections, Kalman, change-point, pre-averaging, realized kernels,49MSRV, BNS test, Hawkes, order-flow. Listed in RESEARCH_STATUS as ✖/⏳ with the reason.5051Conventions that differ from references and are **documented, not hidden**:521. GARCH initial variance: RAID uses the sample variance of ε; `arch` uses a backcast (exponentially weighted) and53   `rugarch` the sample variance by default — hence the 5e−4 log-likelihood tolerance. A `backcast` option is planned so54   that the comparison can be made exact (Phase 4).552. BPV finite-sample factor M/(M−1): on by default (as in `highfrequency` when scaling by `makeReturns`); can be off.563. HAC default lag ⌊4(n/100)^{2/9}⌋ is a rule of thumb (Newey–West 1994 style); the paper always states L explicitly.574. Student-t ν bounds (2.05, 500) follow `arch`; ν at the upper bound triggers a warning (Gaussian data).58
Files · main
Menu

Theme