SPB Git

spb/wp40_uqo

Public MIT
5.5 KB · 53 lines latex
1\section{Statistical correctness}2\label{sec:correct}34Every Tier~A method satisfies five requirements: an independent FP64 CPU reference, an analytical or simulation truth where one exists, agreement with established software under identical conventions, GPU/CPU agreement within a documented tolerance, and adversarial tests. Table~\ref{tab:validation} summarises the reference comparisons on committed synthetic fixtures (no vendor data); every row is a test in the repository that runs on every build.56\begin{table}[t]7\centering\scriptsize8\begin{threeparttable}9\caption{Reference validation on synthetic fixtures (all tests pass).}10\label{tab:validation}11\begin{tabular}{p{3.6cm}p{3.6cm}p{5.2cm}p{3cm}}12\toprule13Method & Reference (version) & Quantity compared & Tolerance \\14\midrule15XNYS calendar & \texttt{exchange\_calendars} 4.13.2 & sessions, holidays, early closes 2000--2026 (6\,790 sessions) & exact sets \\16Session aggregation 1m$\to$5m & FinData derived 5m (live) & OHLCV of 280 regular 5-minute bars (AAPL, Nov.~2024) & exact \\17RV, BPV, RSV$^\pm$, RQ & \texttt{highfrequency} 1.0.3 / NumPy & per-session values (10 sessions) & $10^{-10}$ / $10^{-12}$ rel. \\18OLS, HC0--HC3, HAC, cluster & \texttt{statsmodels} 0.15.0 & coefficients, SE, $p$-values, $R^2$, SSR & $10^{-10}$ / $10^{-9}$ \\19$t$ $p$-values & \texttt{scipy} 1.18.1 & $2\,t.\mathrm{sf}$ & $10^{-12}$ \\20HAR-RV $h=1,5,22$, log-HAR, HARQ (HAC) & \texttt{statsmodels} 0.15.0; \texttt{highfrequency} \texttt{HARmodel} & coefficients, HAC SE & $10^{-9}$; $10^{-8}$ ($h=1$), $10^{-6}$ (HARQ, $h=5$) \\21GARCH, GJR, EGARCH, GARCH-$t$ & \texttt{arch} 8.0.0; \texttt{rugarch} 1.5.6 & log-likelihood; parameters; $h\le5$ forecasts & $5\times10^{-4}$ / $2\times10^{-4}$; 5\,\% + 0.01; 5\,\% \\22VAR(2), FEVD, GFEVD, DY, Ledoit--Wolf & \texttt{statsmodels} 0.15.0 (GFEVD by hand) & coefficients, $\Sigma_u$, llf, FEVD, GFEVD, totals, shrinkage & $10^{-9}$ ($10^{-7}$ totals) \\23\midrule24Metal vs CPU FP64 & \raid{} CPU backend & RV, BPV, RSV$^\pm$ ($n$ = 390--39\,000, chunked) & $10^{-6}$ rel. ($\Sigma x^4$: $10^{-5}$) \\25 & & rolling sums; $X'X$, $X'y$, $y'y$ and the solve & $10^{-5}$; $10^{-6}$ (solve $10^{-5}$) \\26 & & batched GARCH NLL (GJR, Student-$t$); argmin over a grid & $2\times10^{-5}$ ($5\times10^{-5}$); identical \\27\bottomrule28\end{tabular}29\begin{tablenotes}\footnotesize30\item Conventions converted before comparison: \texttt{rQuar} uses $(M+1)/3$; \texttt{rBPCov(makeReturns=FALSE)} applies no $M/(M-1)$; HARQ uses $(\sqrt{\RQ_t}-\sqrt{\overline{\RQ}})\RV_t$; \texttt{rugarch} EGARCH \texttt{alpha1}/\texttt{gamma1} are swapped relative to \eqref{eq:egarch}; \texttt{arch} initialises $\sigma_0^2$ by backcasting. Student-$t$ $\nu$ is compared only when identified ($\nu < 100$).31\end{tablenotes}32\end{threeparttable}33\end{table}3435\begin{figure}[t]36\centering\includegraphics[width=\textwidth]{figures/fig_e5.pdf}37\caption{E5 --- Monte Carlo inference ($R = 1\,000$). Panel A: empirical coverage of nominal 95\,\% intervals for the GARCH(1,1) QMLE parameters at $n = 500$ and $n = 2\,000$ and for the four HAR coefficients with HAC inference at $h = 1$ and $h = 5$ ($T = 1\,500$); the dashed line is the nominal level. Panel B: bias (markers) and RMSE (bars) of the GARCH(1,1) estimates.}38\label{fig:e5}39\end{figure}4041\paragraph{Monte Carlo.} Figure~\ref{fig:e5} and Table~\ref{tab:e5} (experiment E5, $R = 1\,000$ replications) reports bias, RMSE and the empirical coverage of 95\,\% intervals. For GARCH(1,1) with $(\omega,\alpha,\beta) = (0.02, 0.08, 0.90)$ and $n = 2\,000$, biases are at most $0.005$ in absolute value, coverage of the QMLE intervals is 0.93--0.97, and all 1\,000 fits converge; at $n = 500$ the familiar finite-sample downward bias of $\beta$ ($-0.026$) and under-coverage of $\alpha$ (0.90) appear. For HAR with overlapping $h = 5$ targets and HAC inference, coverage of the pseudo-true projection coefficients is 0.90--0.94 ($T = 1\,200$), the usual mild under-coverage of HAC. Realized variance converges at the $\sqrt{2/M}$ rate: the Monte Carlo RMSE is within 10\,\% of $\sqrt{2/M}\,\mathrm{IV}$ for $M \in \{39, 390, 3\,900\}$. The stationary-bootstrap interval for the mean of an AR(1) covers in 89\,\% of replications ($R = 100$, $n = 800$, $b = 10$).4243\begin{table}[t]44\centering\small45\caption{E5 --- Monte Carlo bias, RMSE and 95\,\% coverage ($R = 1\,000$; HAR coverage listed for the four coefficients).}46\label{tab:e5}47\resizebox{\textwidth}{!}{\input{tables/tab_e5}}48\end{table}4950\paragraph{Reproducibility.} With the same seed, the 2\,000 bootstrap statistics are bitwise identical when computed with 1, 4 or 18 threads; the CPU realized measures are bitwise identical with 1 or 18 threads; two Metal runs give bitwise identical RV, BPV and RQ; and the maximum relative difference between Metal and CPU FP64 realized variance on 50 segments of Student-$t(5)$ returns is $3.7\times10^{-8}$, consistent with the input-rounding bound of Section~\ref{sec:metal}.5152\paragraph{Adversarial cases.} The test suite covers zero and missing volume, holidays, DST transitions (both rules), the 16:00 print, early closes, duplicated and unsorted bars, rank-deficient and ill-conditioned designs (warned, minimum-norm solution), singular $X'X$ from sufficient statistics (pseudo-inverse, warned), invalid GARCH parameters ($+\infty$ likelihood on both backends), non-convergence (never reported as success), insufficient samples (typed exceptions), nonexistent Metal devices and forced fallback. Numerical gradients of the GARCH likelihood agree across step sizes $10^{-4}$, $10^{-5}$ and $10^{-6}$ to $10^{-3}$ relative.53
Files · edf90b664f59d98f1489651599148df98a2fb1d1
Menu

Theme