SPB Git

Repository Public Research preview

har_rv.md 4.4 KB

# Model card — har_rv (HAR-RV, direct projections per horizon, levels)

# 1. Identity

  • model_id: har_rv · family: realized (Tier B) · tier: B · status: implemented · impl: ols (src/wp46/models/baselines.py::HARRV(log=False))
  • Label: HAR-RV (direct, levels) · distributions: empirical
  • Seminal citation: corsi2009simple
  • Other references: andersen2007roughing (HAR-CJ), patton2015good (HAR-RS), bollerslev2016exploiting (HARQ), clements2021practical, branco2024forecasting, lyocsa2021stock, christensen2023machine, brini2026forecasting (HAR as the realized benchmark); direct vs iterated multi-step: reference to be added (see _missing_references.md).

# 2. Definition

With $y_t$ the full-day variance proxy (rv5ss_on, percent², observed at the close of t) and regressors at origin t $$\mathbf x_t = \big[1,\ y_t,\ \tfrac15\textstyle\sum_{i=0}^{4}y_{t-i},\ \tfrac1{22}\sum_{i=0}^{21}y_{t-i}\big]$$ (daily, weekly, monthly averages ending at t; undefined for t < 21), one direct OLS projection per horizon $h \in {1, 5, 22}$ of the average daily variance over the next h days: $$\frac1h\sum_{k=1}^{h} y_{t+k} = \mathbf x_t'\boldsymbol\beta^{(h)} + e^{(h)}_{t+h} .$$ No innovation law (empirical standardised returns for VaR); mu = mean of the last 250 returns.

# 3. Parameter space and admissibility

  • Parameters: b{h}_{c,d,w,m} for h = 1, 5, 22 (12 coefficients). Unconstrained OLS (np.linalg.lstsq); no positivity constraint on coefficients; forecasts floored at 1e-8 percent².
  • converged = admissible = True iff every horizon has ≥ 50 complete rows in the 1,000-day window; otherwise the fit is recorded as failed (ok = False, NaN coefficients).

# 4. Nesting and relations

Restricted ARCH-type regression on realized measures (22 lags with step weights); nests rm_rw ($\beta_d = 1$, others 0). loghar_rv is the log version with smearing. HEAVY and Realized GARCH are the likelihood-based Tier B relatives.

# 5. Estimation

OLS by np.linalg.lstsq on the rows of the 1,000-day window where the regressors and the h-step target are complete (the last h rows have no target). No optimizer, no starting values, no retries, no initial variance. Standard errors are not computed; point estimates only. Re-estimated every 5 days like every model; filter uses the h = 1 coefficients.

# 6. Forecasting

HARRV.forecast computes the direct forecasts $\hat f_h = \mathbf x_t'\hat{\boldsymbol\beta}^{(h)}$ for h = 1, 5, 22, converts them to cumulative variances $C_h = \max(\hat f_h, 10^{-8}),h$ and distributes the increments evenly across per-step variances: $$\hat\sigma^2_{t+1|t} = C_1,\quad \hat\sigma^2_{t+k|t} = \frac{\max(C_5 - C_1,\ 4\cdot10^{-8})}{4}\ (k = 2..5),\quad \hat\sigma^2_{t+k|t} = \frac{\max(C_{22} - C_5,\ 17\cdot10^{-8})}{17}\ (k = 6..22),$$ so that the sums over k ≤ 1, 5, 22 equal the direct forecasts (monotonicity of the cumulative variance enforced by the floors). Method: direct.

# 7. Implementation

  • src/wp46/models/baselines.py::HARRV, _har_X (cumulative sums); dispatched by make_model("har_rv").
  • Cross-check: none against a library (highfrequency::HARmodel not run); OLS is deterministic.
  • Tests: tests/integration/test_rolling_driver.py::test_driver_tier_b_and_failure_flags (har_rv with Tier B input); pilot har_rv__empirical: 207/207 refits ok, 1,032/1,032 forecasts ok on CL. No unit test of _har_X.

# 8. Known limitations / failure modes

Negative or explosive forecasts are possible in levels (floored at 1e-8); OLS in levels is sensitive to outliers in the realized measure (COVID days); the direct h = 22 regression uses only T − 22 rows with overlapping targets; imputed $r_t^2$ on invalid sessions enters both regressors and targets (flagged); crypto Tier B only from 2022 (D-06).

# 9. Computational footprint

Three least-squares fits of 1,000 × 4 per refit: pilot median fit time 0.0008 s (CL) / 0.0009 s (EURUSD) — the cheapest Tier B model.

# 10. Literature expectations

corsi2009simple, kourtis2016international, lyocsa2021stock, branco2024forecasting ("nothing beats linear models"), brini2026forecasting: HAR is the realized-measure benchmark that is hard to beat at h = 1, 5, 22; christensen2023machine find ML gains only with extra predictors. Pre-registered H3: Tier B models beat the best Tier A model at h = 1 with a shrinking advantage at h = 22.

Files main
Menu

Theme