SPB Git

spb/wp40_uqo

Public MIT
8.7 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 1e−10, numpy 1e−12 1e−10 ✅ ✅ 1e−6 ✅
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
realized.rsv Σ r² 1{r<0}, Σ r² 1{r>0} returns CSR highfrequency rSVar 1e−10 1e−10 ✅ ✅ 1e−6 ✅
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 ✅ ✅ ✅
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.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) ✅
har.logrv same on log RV; forecast exp(ŷ) without smearing (factor reported) daily RV statsmodels 1e−9 1e−9 ✅ — ✅
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 ✅ — ✅
har.rolling rolling/expanding refits, origin-ahead forecasts, MSE/QLIKE (Patton 2011) daily RV causality test (future perturbation leaves forecasts unchanged) exact ✅ — ✅
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 ✅
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). rugarch maps alpha1 ↔ RAID γ (sign) and gamma1 ↔ RAID α (magnitude)
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 / 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) ✅
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 — ✅

# Tier B (selected, validated 2026-11-02)

Key Definition Inputs Reference & tolerance CPU Metal Status
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 ✅ — ✅
var.fevd orthogonalised (Cholesky) FEVD, horizon H VarFit statsmodels fevd(H) 1e−9 ✅ — ✅
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 ✅ — ✅
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) ✅
cov.ledoit_wolf Σ* = (1−δ)S + δμI with the analytical δ* (Ledoit–Wolf 2004) n×p sklearn ledoit_wolf formula (hand-computed): 1e−9 ✅ — ✅

Not implemented (Tier B/C, by decision — research value for this paper insufficient or data inadmissible): Realized GARCH, HEAVY, GARCH-MIDAS, FIGARCH, DCC, BVAR/VECM, local projections, Kalman, change-point, pre-averaging, realized kernels, MSRV, BNS test, Hawkes, order-flow. Listed in RESEARCH_STATUS as ✖/⏳ with the reason.

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 · 1dca98c3de92f594407f852f003c4b15bf6ed04d
Menu

Theme