I think every economist has a soft spot for time series econometrics and if you ever wanted to model volatility while modelling volatility, then I guess you are not alone.
This repo provides a set of functions to estimate HAR models by Opschoor & Lucas (2023) for realised volatility under the GAS framework using ML. Model allows GAS dynamics for any of the parameters of the data generating process and thus shall be quite appealing for modelling higher moments of realised volatility (i.e. skewness and utilise it to further enhance volatility modelling, etc).
To simplify, Opschoor & Lucas (2023) specification relies on the F distribution as its data generating process and leverages the GAS framework to obtain dynamic, conditional realised volatility (similar to the traditional HAR), its volatility (scale) and skewness parameters. Model can be outlined with
F probability density function and dynamic parameters for
where
with
and its second and third moments:
Short description of the R files:
1. 0_REAL_VOL_IBM.R produces IBM.csv from the raw IBM intraday prices. Please note that the raw data is not provided.
2. 1_HAR_GAS_FUN.R contains HAR GAS model(s) main functions.
3. 2_HAR_GAS_EST.R estimates HAR GAS model(s) parameter estimations using the standard BFGS optimisation routine.
4. 3_HAR_GAS_ILL.R replicates the figures above (comb_gif_r1.gif and comb_gif_r2.gif).
Finally, 1_GAS_FUN.R scales the score function with
Opschoor, A., & Lucas, A. (2023). Time-varying variance and skewness in realized volatility measures. International Journal of Forecasting, 39(2), 827-840.

