Class HarRv
java.lang.Object
com.quantfinlib.volatility.HarRv
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 (Corsi 2009,
J. Financial Econometrics 7, 174-196). Fits by OLS through a
Householder QR of the column-scaled design (the normal equations
square a condition number that RV in 1e-4 units already makes large),
reports Newey-West HAC standard errors, and forecasts one step ahead.
forecast(double[], HarRv.Params) floors at zero; fitLog(double[]) fits the log-HAR,
ln RV_{t+1} = c + β_d ln RV_t + β_w ln RV̄^{(5)} + β_m ln RV̄^{(22)},
which cannot forecast a negative variance and is the better-behaved
specification on real data.
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 ClassesModifier and TypeClassDescriptionstatic final classFitted coefficients with Newey-West standard errors (order: intercept, daily, weekly, monthly), residual variance and the regression size.static final recordFitted coefficients:rv⁺ = c + βd·d + βw·w + βm·m. -
Method Summary
Modifier and TypeMethodDescriptionstatic HarRv.Paramsfit(double[] realizedVariance) Fits by OLS.static HarRv.FitfitLog(double[] realizedVariance) Log-HAR: the same regression onln RVwith regressorsln RV_t,ln(mean of 5)andln(mean of 22).static HarRv.FitfitWithErrors(double[] realizedVariance) OLS fit of the level HAR with Newey-West standard errors (5 lags).static doubleforecast(double[] realizedVariance, HarRv.Params p) One-step-ahead RV forecast from the series' most recent day/week/ month, floored at zero.static doubleforecastLog(double[] realizedVariance, HarRv.Fit fit) One-step forecast of RV from a log-HAR fit:exp(ŷ + ½σ̂²), the lognormal mean given the residual variance.
-
Method Details
-
fit
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
-
fitWithErrors
OLS fit of the level HAR with Newey-West standard errors (5 lags). -
fitLog
Log-HAR: the same regression onln RVwith regressorsln RV_t,ln(mean of 5)andln(mean of 22). Requires strictly positive RV. -
forecastLog
One-step forecast of RV from a log-HAR fit:exp(ŷ + ½σ̂²), the lognormal mean given the residual variance. -
forecast
One-step-ahead RV forecast from the series' most recent day/week/ month, floored at zero.
-