Adaptive Heterogeneous Autoregressive Models of Realized Volatility Based on a Genetic Algorithm

and Applied Analysis 3 In the absence of jumps in the price path during day t, the ratio-statistic Z t is standard normal for Δ → 0. Hence, we can identify the significant jumps by the ratio-statistics in excess of the standard normal critical value Φ α (e.g., Φ 0.95 , Φ 0.99 , Φ 0.999 ) [15] JV t = I (Z t > Φ α ) (RV t − BPV t ) , (3) where I() is the indicator function. Accordingly, the continuous sample path variation of day t is estimated as CV t = I (Z t ≤ Φ α )RV t + I (Z t > Φ α )BPV t . (4) 2.2.TheHARModels. Inspired by the HeterogeneousMarket Hypothesis and the HARCH model of Müller et al. [11, 12], Corsi [13, 14] proposed the HAR-RV model, in which the realized volatility is parameterized as a linear function of the lagged realized volatilities over different horizons. It is defined as RV t = α 0 + α d RV t−1 + α w RV t−5:t−1 + α m RV t−22:t−1 + ε 1,t ,


Introduction
Improving the forecast accuracy of asset return volatility is a key goal for researchers and practitioners, owing to volatility's critical role in asset pricing, portfolio construction, risk management, and trading strategy design.Early researches using data of daily and lower frequencies treat volatility as unobservable and indirectly describe its dynamics by modeling the conditional variance of asset returns.Representative examples include the ARCH model of Engle [1], the GARCH model of Bollerslev [2], and the stochastic volatility model of Taylor [3], which have been largely extended and formed into the (G)ARCH-family models and the SV-family models.However, most of the latent volatility models have been unable to capture simultaneously several important empirical features of financial volatility, as discussed by Carnero et al. [4].
In recent years, the increased availability of high-frequency intraday data has spurred the new "realized volatility" modeling literature.Andersen and Bollerslev [5], Andersen et al. [6,7], and Barndorff-Nielsen and Shephard [8] proposed to use the realized volatility (RV) constructed by aggregating squared intraday returns as the measurement of ex-post daily volatility, which for the first time makes volatility "observable." To separate the continuous sample path variation from the jumps is also possible with high-frequency intraday data.The realized bipower variation [9] constructed from the summation of appropriately scaled cross products of adjacent high-frequency absolute returns is commonly adopted as the measurement of the continuous sample path variation.Tests for statistically significant jumps can be constructed through the statistics proposed by Huang and Tauchen [10].Inspired by the Heterogeneous Market Hypothesis and the HARCH model of Müller et al. [11,12], Corsi [13,14] proposed the heterogeneous autoregressive model of realized volatility (HAR-RV), which incorporates daily, weekly, and monthly realized volatilities in the volatility dynamics and achieves superior forecast performance compared with the volatility models using low-frequency data.Andersen et al. [15] further proposed the HAR-RV-J model and the HAR-RV-CJ model, which separate the contributions to volatility forecasting of the jumps and the continuous sample path variation.The above HAR models are all easily estimated using OLS besides their competitive forecast performance and thus have been largely extended by researchers and adopted in practice.
Besides the above-mentioned traditional time series models, the recent advances in artificial intelligence have provided additional tools for researchers' volatility forecasting practices.Dunis and Huang [16] empirically showed that the recurrent neural network (RNN) models apparently outperform the GARCH(1,1) model in forecasting the GBP/USD and USD/JPY exchange rate volatilities in terms of both forecast accuracy and trading efficiency.Neely and Weller [17] empirically illustrated that the genetic programming (GP) outperforms the GARCH(1,1) model while forecasting the DEM/USD and JPY/USD exchange rate volatilities at longer horizons especially under the MAE loss function.Ma et al. [18] proposed to generate volatility forecasting rules by wavelet transform and genetic algorithm (GA) and achieved forecast accuracy superior to that of the GARCH(1,1) model for S&P 100 index volatility.Chen et al. [19] applied support vector machine (SVM) in volatility forecasting under the GARCH framework and empirically revealed that the SVM-GARCH models' performance in forecasting the oneperiod-ahead volatilities of the GBP/USD exchange rate and the NYSE composite index is superior to that of simple moving average, standard GARCH, nonlinear EGARCH, and traditional ANN-GARCH models.Hung [20] proposed the fuzzy GARCH model with a genetic algorithm estimation method and improved the GARCH model's forecast performance.Tarsauliya et al. [21] proposed evolutionary hybrid artificial neural network models EANN-GARCH, EANN-GJR, and EANN-EGARCH which all achieve better forecast performance in terms of the RMSE compared with conventional ANNs and statistical methods.Hajizadeh et al. [22] proposed hybrid models based on EGARCH and artificial neural networks which provide better S&P 500 index volatility forecasts than the EGARCH model.Sermpinis et al. [23] proposed the higher order neural networks (HONNs) for forecasting FTSE 100 futures' 21-day-ahead realized volatility and demonstrated better performance in terms of both statistical accuracy and trading efficiency when compared with the multilayer perceptron (MLP), the RNN, the GJR (GARCH-family), and the RiskMetrics.However, the rules mined from artificial intelligence tools usually lack clear economic interpretation and are not easily understandable.Accordingly, the current volatility modeling researches utilizing artificial intelligence tools are not well accepted or adopted in practice.
Thus, in this paper, we take a new approach by using a genetic algorithm to optimize the HAR models' time horizon structures.The genetic algorithm optimized time horizon structures reflect the markets' heterogeneous structures and thus have clear economic interpretations.Specifically, the current applications of the HAR models all follow the (1,5,22) time horizon structure originally proposed for developed markets, using daily (1 day), weekly (5 days), and monthly (22 days) to represent the short-term, medium-term, and longterm investors' trading frequencies, respectively.However, investors' cultural backgrounds and investment habits, as well as the alternative investment choices, differ largely across markets, which will probably result in different heterogeneous structures across markets.Furthermore, investors' trading frequencies may be affected by financial and economic policies as well as market conditions, which will probably lead to a market's heterogeneous structure varying over time.Taking the above into consideration, we propose adaptive heterogeneous autoregressive (AHAR) models in this paper, whose time horizon structures are optimized by a genetic algorithm.Thus, the AHAR models can have different time horizon structures when applied to markets with different heterogeneous structures, and their time horizon structures can be adjusted adaptively as the market's heterogeneous structure varies.The out-of-sample forecast performance of the AHAR-RV model, the AHAR-RV-J model, and the AHAR-RV-CJ model is compared with that of the corresponding HAR models through moving windows using five-minute returns of the CSI 300 index as empirical data, based on which we evaluate the necessity and effectiveness of such an adaptive modeling approach.
The remainder of this paper is organized as follows.In Section 2, we describe the HAR models, modify them to AHAR models, and introduce our design of the genetic algorithm.In Section 3, the comparative analysis of the AHAR models' out-of-sample forecast performance in Chinese stock markets is presented.We conclude this paper in Section 4.

Realized Volatility and Its Decomposition.
Let Δ and  represent the sampling interval length and the corresponding number of intraday intervals ( = 1/Δ), respectively.Then, the logarithmic return of the th Δ-length sampling interval during day  is  , =  , −  ,−1 ,  = 1, 2, . . ., , where  , is the logarithmic price at the end of the th Δ-length sampling interval.The daily realized volatility is defined by the summation of the squared intraday returns as RV  ≡ ∑  =1  2 , [5][6][7][8], which converges uniformly in probability to the quadratic variation as Δ → 0.
The ratio-statistic of Huang and Tauchen [10] is used in this paper to identify significant daily jumps where BPV  and QPV  are the realized bipower variation and the realized tripower quarticity [9], respectively, adopting the staggered sampling technique of Andersen et al. [15] to eliminate the impact of market microstructure noise where Γ() is the Gamma function.
In the absence of jumps in the price path during day , the ratio-statistic   is standard normal for Δ → 0. Hence, we can identify the significant jumps by the ratio-statistics in excess of the standard normal critical value Φ  (e.g., Φ 0.95 , Φ 0.99 , Φ 0.999 ) [15] JV where () is the indicator function.Accordingly, the continuous sample path variation of day  is estimated as

The HAR Models. Inspired by the Heterogeneous Market
Hypothesis and the HARCH model of Müller et al. [11,12], Corsi [13,14] proposed the HAR-RV model, in which the realized volatility is parameterized as a linear function of the lagged realized volatilities over different horizons.It is defined as where =1 RV − are the past weekly and monthly realized volatilities.The parameters   ,   , and   evaluate the shortterm, medium-term, and long-term investors' contributions to the overall market volatility, respectively.
Since the descriptive statistics (Table 2) show that the logarithmic realized volatility is much closer to being normally distributed than is the raw realized volatility, thus more amenable to the use of standard time series procedures, the HAR-RV model cast in logarithmic form is used in this research: where (lnRV) −:−1 = (1/) ∑  =1 lnRV − is the normalized multiperiod logarithmic realized volatility.
Andersen et al. [15] further proposed the HAR-RV-J model and the HAR-RV-CJ model which separate the contributions to volatility forecasting of the jumps and the continuous sample path variation.The HAR-RV-J model cast in logarithmic form is The HAR-RV-CJ model cast in logarithmic form is where (lnCV The parameters of ( 6), (7), and (8) can all be easily estimated by applying the standard OLS regressions.
where ( 1 ,  2 ,  3 ) is the adaptive time horizon structure optimized by a genetic algorithm.

The Genetic Algorithm Design.
A genetic algorithm is a stochastic optimization algorithm originally inspired by the process of natural evolution.It is comprised of three major operations: reproduction, crossover, and mutation, which are designed to ensure that the "fittest" members of the population survive and that their information is preserved and combined to generate possibly better offspring.This paper uses the genetic algorithm to optimize the AHAR models' time horizon structures; thus, we design the following solution space and encoding as shown in Table 1.
The fitness function () of our GA is defined as the adjusted  2 which evaluates the model's in-sample fit.Other parameters of the GA are set as follows: the population size  = 40, the crossover rate   = 0.8, the mutation rate   = 0.05, and the maximum number of generations  = 300.
As illustrated by the GA's flow chart in Figure 1, after generating the initial population, each generation of population evolves through reproduction, crossover, and mutation operations sequentially to generate the offspring generation.Each ( 1 ,  2 ,  3 ) structure of the initial population is created by randomly selecting   between its lower bound and upper bound and it is ensured that  1 <  2 <  3 ; for example, if the random selection results in  1 = 2,  2 = 16, and  3 = 5, then we denote the candidate solution as (2,5,16).
As for the crossover operation, each time two candidate solutions of current population are randomly selected and, with probability   = 0.8, they will operate one-point crossover.Specifically, the 2nd binary bit and the 6th binary bit of the 13-bit-length binary string are randomly specified as the single crossover point with equal probability, and all data beyond that point in the two solutions' strings are swapped to generate two new 13-bit-length strings replacing the parents; for example, (, , ) and (, , ) are selected for crossover and the crossover point is the 6th binary bit; then, they will be replaced with (, , ) and (, , ) in the population.
As for the mutation operation, each candidate solution of current population has probability   = 0.05 to mutate, inverting a randomly selected bit of its binary string.The elitist rule replaces the worst solution of current population with the best solution of last generation and thus ensures that the "fittest" member always survives.
We design two termination conditions: (i) the best solution keeps the same for at least 10 generations and (ii) the evolution reaches the maximum number of generations.Evolution terminates as far as one of the conditions is satisfied, and the ( 1 ,  2 ,  3 ) structure with the highest fitness value in current generation is the optimal time horizon structure discovered by the GA.

Empirical Evidence
3.1.Data and Summary Statistics.Five-minute returns of the CSI 300 index are used as empirical data and the data source is the Tinysoft financial data base.The CSI 300 index is a capitalization-weighted stock market index, designed to replicate the performance of 300 stocks well chosen from the Shanghai and Shenzhen stock exchanges, and thus well represents the operation state of the whole Chinese stock markets.The period of study extends from April 11, 2005 (the first Monday after the release of the CSI 300 index), to April 15, 2010 (the last day before the launch of the CSI 300 index futures), covering 1221 business days altogether.The sampling interval length is set to five minutes, as a trade-off between accuracy and market microstructure noise, similar to most previous studies.
Figure 2 displays the time series plots of the CSI 300 index's realized volatility RV  and logarithmic realized volatility lnRV  .Table 2 reports their descriptive statistics as well as the descriptive statistics of the continuous sample path variation CV  and the jumps JV  .The Ljung-Box Q-statistics indicate that the realized volatility and the logarithmic realized volatility both display significant long memory dependence (or long-range persistence).The continuous sample path variation has similar statistics to those of the realized volatility, which are apparently different from those of the jumps.The ADF unit root tests indicate that the above series are all stationary; thus, the HAR and the AHAR modeling analysis can be further conducted.It is also worth noticing that the logarithmic realized volatility is much closer to being normally distributed compared with the raw realized volatility, which justifies considering the HAR models and the AHAR models in logarithmic form.

Out-of-Sample Forecast Performance Comparison.
We adopt the moving window tests to compare the out-ofsample forecast performance of the AHAR models with that of the corresponding HAR models.Specifically, we set the estimation window size to 700 business days, the forecast window size to 100 business days, and the step size to 100 business days, thus dividing the empirical data into five overlapping pairs of estimation windows and forecast windows.
For each pair of estimation window and forecast window, we first run the GA in the estimation window to find the optimal time horizon structures for the AHAR-RV model, the AHAR-RV-J model, and the AHAR-RV-CJ model, respectively.The out-of-sample forecast performance of the resulting optimal AHAR models is then compared with that of the corresponding HAR models in the forecast window.The following four common loss functions are employed for the forecast performance evaluation: where RV  represents the true volatility,  2  represents the forecasted volatility, and  1 and  2 are the starting and ending of the forecast window, respectively.
Figure 3 plots the out-of-sample forecasts of the three HAR models and the three AHAR models in five successive forecast windows together with the true logarithmic realized volatility sequence.Table 3 compares these models' forecast performance in each forecast window, indicating the time horizon structures used.We can see from Table 3 that for each pair of estimation window and forecast window, when applying the GA to optimize the time horizon structures for the AHAR-RV model and the AHAR-RV-J model, we get exactly the same results, which are also pretty close to the time horizon structure optimized for the AHAR-RV-CJ model.This is understandable, since the GA's optimization result reflects the actual trading frequencies of Chinese stock  markets' representative short-term, medium-term, and longterm investors; it should not alter significantly across the AHAR models.There exist slight differences between the time horizon structures optimized for different AHAR models, since these models have different explanatory variables and different information integration capabilities.While running the GA in the first estimation window, the output optimal choice of the 3rd horizon is between 106 and 109.It implies that, during this period of time, representative long-term investors hold securities for up to 5 months in Chinese stock markets.The reason is that the first estimation window covers the period from April 11, 2005, to February 28, 2008, containing the bull market period of Chinese stock markets which is from June 7, 2005, to October 16, 2007 [24].Accordingly, running the GA in the first estimation window mainly captures heterogeneous investors' trading behaviors during the bull market period, when long-term investors are more willing to extend the holding period of the securities to further share the benefits.On the other hand, the first forecast window covers the period from February 29, 2008, to July 23, 2008, while the period between October 17, 2007, and October 28, 2008, is regarded as the bear market period of Chinese stock markets [24].Thus, the first estimation window and forecast window are under totally different market conditions, which reduces the applicability of the GA optimized time horizon structures.As a result, the AHAR models outperform the corresponding HAR models in the first forecast window only in terms of the RMSE and the Theil coefficient.
As for the following four estimation windows, since they all cover enough lengths of both the bull market data and the bear market data, the optimization results of the GA are less affected by specific market conditions.Analyzing the GA optimized time horizon structures discloses that, during these periods of time, the representative long-term investors' average holding period varies between 16 and 18 business days, the representative medium-term investors' average holding period varies between 3 and 4 business days, and the representative short-term investors' average holding period is not longer than 1 business day.It implies that the investors in Chinese stock markets have higher turnover rates than those in developed markets, which makes the (1,5,22) structure an inferior choice.However, the GA optimized time horizon structures are all close to the (1,5,22) structure, which explains why the empirical researches applying the HAR models with the (1,5,22) structure in Chinese stock markets can still generate satisfying fit and forecast performance.Besides, since the optimal ( 1 ,  2 ,  3 ) structures of different estimation windows differ slightly instead of being the same, regardless of the AHAR model specified, it reveals that Chinese stock markets' heterogeneous structure does vary over time and thus confirms the necessity of our adaptive modeling approach.Furthermore, the AHAR-RV-CJ model outperforms the HAR-RV-CJ model in all the four forecast windows regardless of the loss function; the AHAR-RV model and the AHAR-RV-J model outperform the corresponding HAR models in three forecast windows regardless of the loss function and outperform the corresponding HAR models in the third forecast window in terms of the MAE and the MAPE.It reveals that the adaptive modeling approach effectively improves the HAR models' out-of-sample forecast performance and thus provides better volatility modeling and forecasting tools for investors interested in Chinese stock markets.

Conclusions
Building on the heterogeneous autoregressive models inspired by the Heterogeneous Market Hypothesis, we propose adaptive heterogeneous autoregressive models by using genetic algorithm optimized time horizon structures instead of the (1,5,22) structure used in the HAR models.Thus, the AHAR models can be applied to markets with different heterogeneous structures, and their time horizon structures can be adjusted adaptively as the market's heterogeneous structure varies.
Moving window tests with five-minute returns of the CSI 300 index reveal that the AHAR models' optimal time horizon structures differ from the (1,5,22) structure and vary over time when applied to Chinese stock markets.Specifically, Chinese stock markets' representative long-term investors' average holding period varies between 16 and 18 business days, representative medium-term investors' average holding period varies between 3 and 4 business days under general market conditions, while the representative longterm investors hold securities for up to 5 months during the bull market period.Furthermore, the AHAR models generally have better out-of-sample forecast performance than that of the corresponding HAR models using four common loss functions.
Since our approach of combining the HAR models with the genetic algorithm produces volatility forecasting models with better forecast performance and is easily implementable, it has broad appeal for practitioners.Such an adaptive modeling approach can be applied to extensions of the HAR-RV model, the HAR-RV-J model, and the HAR-RV-CJ model, for example, by the inclusion of overnight returns and lagged negative returns as explanatory variables, which may allow the pursuit of further forecast accuracy improvements.This topic is left for future research.

Figure 2 :
Figure 2: Time series plots of the CSI 300 index's realized volatility and logarithmic realized volatility.

Figure 3 :
Figure 3: Out-of-sample forecasts for the CSI 300 index's volatility in five successive forecast windows.lnRV  represents the true logarithmic realized volatility.AHAR-RV, HAR-RV, AHAR-RV-J, HAR-RV-J, AHAR-RV-CJ, and HAR-RV-CJ represent the forecasts of the corresponding models, respectively.

Table 1 :
The GA's solution space and encoding.

Table 2 :
Descriptive statistics.Note: LB represents the Ljung-Box -statistics, JB represents the Jarque-Bera normality test statistics, * * * represents the significance level of 1%, and * * represents the significance level of 5%.

Table 3 :
Moving window out-of-sample forecast performance comparison results.