SPB Git

spb/wp40_uqo

Public MIT
5.9 KB

# Method registry (Tier A) — conventions, references, tolerances

Status legend: ✅ validated against the named reference on the committed fixtures (tests/reference) · 🧪 implemented, reference comparison pending · 🧭 experimental · ✖ not implemented. "Tolerance" is the pass criterion of the test.

Key Definition Inputs Reference software & options Tolerance CPU Metal Status
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 ✅
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 ✅
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)
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)
realized.rv Σ r² returns CSR highfrequency rCov (univariate) / numpy 1e−12 rel (numpy) ✅ Phase 3 ✅
realized.bpv μ₁⁻²·M/(M−1)·Σ r_j r_{j−1} (finite-sample factor optional) returns CSR highfrequency rBPCov (makeReturns=FALSE, scaled)
realized.rsv Σ r² 1{r<0}, Σ r² 1{r>0} returns CSR highfrequency rSVar 1e−12 rel ✅ Phase 3 ✅
realized.rq (M/3) Σ r⁴ returns CSR highfrequency rQuar 1e−12 rel ✅ Phase 3 ✅
realized.jump max(RV − BPV, 0) (proxy, no test statistic) — ABD 2007 — ✅ — ✅
realized.tripv μ_{4/3}⁻³·M/(M−2)·Σ Π r ^{4/3} returns CSR highfrequency rTPQuar (differs: quarticity) — definition from BNS 2004 1e−12 (self) ✅
realized.rcov Σ r_j r_j' on synchronized returns; corr from diag T×N returns highfrequency rCov Phase 4 ✅ Phase 3 🧪
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 ✅
cov.classical s² (X'X)⁻¹, s² = RSS/(n−k) — statsmodels nonrobust 1e−9 ✅ — ✅
cov.hc0..hc3 White sandwich; HC1 n/(n−k); HC2 1/(1−h); HC3 1/(1−h)² — statsmodels HC0–HC3 1e−9 ✅ — ✅
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 ✅ — ✅
cov.cluster one-way CGM with G/(G−1)·(n−1)/(n−k) cluster ids statsmodels cluster (default correction) 1e−9 ✅ — ✅
inference.t two-sided p from t(df_resid) (regularised incomplete beta); df ≤ 0 → normal — scipy.stats.t 1e−12 ✅ — ✅
ols.rolling window-by-window QR; step parameter X, y statsmodels RollingOLS self-consistency test; Phase 4 vs statsmodels ✅ Phase 3 🧪
har.* HAR-RV, log-HAR, HAR-X, HARQ (BPQ 2016): RV_{t+h} regressed on RV_t, mean(RV_{t−4..t}), mean(RV_{t−21..t}) [, √RQ_t·RV_t]; causal lags; h ∈ {1,5,22} with overlapping targets → HAC(h−1 lags minimum) daily RV panel highfrequency HARmodel, statsmodels Phase 4 Phase 4 Phase 4 ✖ (Phase 4)
garch.garch.gaussian σ²_t = ω + α ε²_{t−1} + β σ²_{t−1}; σ²_0 = sample variance of ε; constraints ω>0, α,β≥0, α+β<1 returns arch 8.0 arch_model(vol="GARCH", rescale=False) (backcast initialisation ≠ ours), rugarch (Phase 4) loglik 5e−4 rel; params 5 % rel + 0.01 abs; forecasts 5 % ✅ likelihood batch Phase 3 ✅
garch.gjr.* + γ 1{ε<0} ε²; α+γ ≥ 0; α+β+γ/2 < 1 returns arch GJR (o=1) same ✅ — ✅
garch.egarch.* ln σ²_t = ω + α( z −E z ) + γ z + β ln σ²_{t−1}; β <1; h>1 forecasts by simulation (20 000 paths, seeded)
garch.*.student_t standardized t, ν ∈ (2.05, 500) (arch bounds); E z via lgamma returns arch dist="t" same; ν skipped when > 100 (unidentified) ✅
garch.cov QMLE sandwich H⁻¹ OPG H⁻¹ (Bollerslev–Wooldridge 1992), Hessian, OPG — numerical derivatives — arch robust/classic Phase 4 (SE comparison) ✅ — 🧪
bootstrap.stationary / circular Politis–Romano 1994 / circular block; replica generation + statistic series arch.bootstrap Phase 4 Phase 4 Phase 3/4 ✖

Conventions that differ from references and are documented, not hidden:

  1. GARCH initial variance: RAID uses the sample variance of ε; arch uses a backcast (exponentially weighted) and rugarch the sample variance by default — hence the 5e−4 log-likelihood tolerance. A backcast option is planned so that the comparison can be made exact (Phase 4).
  2. BPV finite-sample factor M/(M−1): on by default (as in highfrequency when scaling by makeReturns); can be off.
  3. HAC default lag ⌊4(n/100)^{2/9}⌋ is a rule of thumb (Newey–West 1994 style); the paper always states L explicitly.
  4. Student-t ν bounds (2.05, 500) follow arch; ν at the upper bound triggers a warning (Gaussian data).
Files · 516afa5dba80de9542c7fd89bf2a5e143516ff00
Menu

Theme