Class HarRv

java.lang.Object
com.quantfinlib.volatility.HarRv

public final class HarRv extends Object
HAR-RV (Corsi's Heterogeneous AutoRegressive realized-volatility model) — the forecasting benchmark GARCH papers have to beat, and it is three regressors and an intercept:
  RV_{t+1} = c + β_d·RV_t + β_w·RV̄_t^{(5)} + β_m·RV̄_t^{(22)} + ε
daily, weekly-average and monthly-average realized variance — the "heterogeneous" traders operating at three horizons. Fits by plain OLS on the normal equations (no optimizer), forecasts one step ahead, and floors the forecast at zero (a negative variance forecast is an extrapolation artifact, not a market view).

Feed it realized DAILY variance — squared returns summed intraday, or JumpRobustVolatility's bipower variance when jumps should not contaminate the forecast (the standard pairing). Static, deterministic, research lane.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    Fitted coefficients: rv⁺ = c + βd·d + βw·w + βm·m.
  • Method Summary

    Modifier and Type
    Method
    Description
    fit(double[] realizedVariance)
    Fits by OLS.
    static double
    forecast(double[] realizedVariance, HarRv.Params p)
    One-step-ahead RV forecast from the series' most recent day/week/ month, floored at zero.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • fit

      public static HarRv.Params fit(double[] realizedVariance)
      Fits by OLS. Needs enough history for the monthly window plus a meaningful regression sample.
      Parameters:
      realizedVariance - daily RV series, ≥ 60 finite non-negative observations
    • forecast

      public static double forecast(double[] realizedVariance, HarRv.Params p)
      One-step-ahead RV forecast from the series' most recent day/week/ month, floored at zero.