Extracted main text — title through conclusion, appendix excluded. This is what our citation measures are computed over, published so the extraction can be checked by eye.
33,193 characters · 6 sections · 28 citation commands
A machine learning search for optimal GARCH parameters
The ability of Machine Learning (ML) algorithms (in particular Deep Learning (DL)) to optimise processes lends itself extremely well to an application in financial data. This optimisation ability is only possible in the presence of vast amounts of data. Due to the recording of high frequency trading since the late 1980s, trading of financial securities, in particular, can be seen to lend itself well to ML algorithms. Nevertheless, this application is not solely restricted to the trading of securities as seen by the vast quantity of literature on the application of Artificial Neural Networks (ANNs) in finance, apart, deep_learning_finance, economic_forecast_nn, quant_learning, economic_variables, impact. Particularly notably, a study undertaken by Fadlalla et al. in analysis highlights the potential impact ANNs could have upon finance from the bond rating industry to quantifying the risk of bankruptcy. The conclusion that Fadlalla et al. reach, is that the most effective use of Artificial Intelligence (AI) in finance is in a joint approach using traditional statistical analysis alongside a ML algorithm. The reason for this conclusion and not simply a blanket use of ML algorithms is the intractability of AI outputs. ANNs can be viewed as a black box in how they reach their output. The ability of an individual to justify their decision is what allows for accountability in finance. Since the 2008 financial crash, accountability has become extremely important to reduce the prevalence of turbulent times within economic cycles. Two examples in which an AI algorithm is left unchecked, are given in ted1, ted2. In these studies, it is seen that although the AI does complete the task, it does so in a completely different way we, as humans, would expect. It is important that users of AI understand how and why the algorithm has reached the conclusion it has. If this is not possible, there is a considerable risk for different types of bias in the method. Nevertheless, ANNs in particular are extremely effective at optimising outputs and enable the user to gain better results than would be possible via numerical analysis, white1.
Financial data presents with a large degree of stochasticity. This is seen in the way individual decisions shape the time evolution of many financial systems, agent. The solution to many of these problems requires the use of stochastic models, increasing the time and complexity of calculations, stochastics. This very difficult mathematical description makes real time solutions quite challenging. Therefore, in order to make this very successful approach more applicable in the environment of high frequency trading and forecasting, we need to be able to optimise the solutions extremely efficiently. A marrying of stochastic systems and AI can bring about such optimisations and solutions much quicker than traditional techniques whilst not sacrificing accuracy.
In financial time series there are several observed facts for how the volatility of the process behaves. One such observation is the conditional nature of the heteroskedasticity of volatility. The Autoregressive Conditional Heteroskedasticity (ARCH) model, was proposed by Engle, arch_original to account for this phenomenon in modelling of financial time series. Consequently, Bollerslev, garch_bollerslev_1, generalised this model to extend the use to longer time histories by the presence of two stochastic processes, price and volatility. As such, the GARCH model presents a good example of an efficient stochastic description of financial data evolution. Since the inception of the Generalised Autoregressive Conditional heteroskedasticity (GARCH) models, there has been exceptional effort in the improvement of GARCH frameworks to model volatility. These improvements are driven by empirical observations of volatility and the inability of GARCH to describe several essential features of price dynamics, engle_garch, garch_alternatives, go_garch, tully, nelson_garch, figarch1, garch_optionpricing, ng_garch, nelson_garch, continuous_garch.
Sine the proposal of the variations of the GARCH model in response to the numerous empirical observations of price dynamics, these models have been employed to describe a plethora of different empirical datasets. One very pertinent example of GARCH models being applied to empirical data are studies with GARCH being applied alongside AI. The reason for this joint methodology is in the GARCH model's ability to capture the esoteric behaviours of volatility. In anngarch1, Wang presents a novel hybrid AI-GARCH approach to predict option price movements of certain securities, without prior definition of a functional form of the relationship between the input variables and the option price. Moreover, Monfared et al. in hybrid_garch_2, detail how using an ANN increases the forecast accuracy of volatility levels in different economic cycles. Here Monfared et al. use another GARCH framework and ten different time scales of the NASDAQ index's volatility, to model the future volatility of this index. However, they have to optimise their GARCH model via Maximum Likelihood Estimations before this can take place, creating a very laborious process. Another study that utilises an ANN with a GARCH framework is by Kristjanpoller et al. in ann_gold_correlations, here a GARCH model is fed into an ANN alongside variables that directly affect the price of gold. These inputs allow for an increased accuracy of the prediction of the future level of volatility within the price of gold as much as $25\%$ of the mean percentage error value. These studies highlight the power that ANNs have within finance and also of the efficient application of GARCH alongside AI. However, these studies only concern themselves with the forecasting of financial volatility or prices. In order to use a GARCH model as efficiently as possible, the model needs to be correctly optimised to the dataset in use. In all of the studies mentioned here, this has had to be done via statistical methods. Nevertheless, if we were to use artificial intelligence to optimise the GARCH framework we employ to the dataset we wish to model, we would gain a much more accurate forecast within a reduced time span. Therefore, we present methods to fit optimised GARCH models.
We are inspired by a very prominent study in parameter fitting, undertaken by Culkin et al. in bs. The study details an application of an ANN to the Black-Scholes option pricing formula following an approach described in lo_black. The aim of the research is to effectively price an European call-option using the Black-Scholes equation given the inputs of this model. These include: underlying asset price, maturity dates, volatility and exercise price. Therefore, Black-Scholes formula can generate vast quantities of data, needed to train an ANN, whilst also having a defined output, the price of the call-option. This study is notable because it allows for real-time pricing of options given their input properties, allowing quicker predictions of the price of the call-option. It is seen from the work in lo_black, the multi-layer perceptron employed achieves a very high accuracy to the analytical model's prediction. The methodology employed here has inspired us to use AI algorithms in a Generalised Autoregressive Conditional Heteroskedasticity (GARCH) model framework. Our approach will be the following; we will be using the statistical attributes (statistical moments and autocovariance of the process) of a time series as the inputs to the network, to predict the outputs, the parameters of the GARCH model. This work is necessary because of the real-time ability of ANNs to give results. The current method of fitting parameters to a GARCH model is through Maximum Likelihood Estimations and as such require intense calculations that consume large amounts of time. However, with an ANN we would be able to simply feed a number of inputs and gain the model parameters (outputs) required. Our method will be useful for the high frequency volatility measures that furthered the developments of GARCH models, realised_2, realised_3. Work under taken in luke_1 shows that given GARCH parameter values it is easy to work out the statistical moments for the GARCH model. However, the reverse problem, finding parameter values when statistical moments are known, reduces to a set of non-linear equation that in certain circumstances become extremely time consuming to solve. It is the aim of this paper to investigate how to use an ANN to estimate GARCH parameters instead of solving non-linear equations or using Maximum Likelihood Estimation (MLE) methods.
The paper is organised as follows: in section (ref), we introduce the model that we will use to train the Artificial Neural Network upon and discuss why the ANN is needed to fit the parameters of the model. In section (ref), we introduce the mathematics behind the ANN and present the specific networks we intend to use. Section (ref) discusses the results of the investigation for the GARCH-normal(1,1) model and finally, section (ref) concludes.
Generalised Autoregressive Conditional Heteroskedasticity (GARCH) models were first proposed by Bollerslev in garch_bollerslev_1 as a generalisation to Engle's earlier ARCH models, arch_original. GARCH models use the previous variance values along with a stochastic variable, $x_t$ to forecast the future variance. The impact of these variables are determined by the parameters of the GARCH models. For a GARCH(1,1) model we have:
Where $x_t = \sigma_t Z_t$, of which $Z_t$ is an independent identically distributed random variable, with a mean of zero and variance equal to one. If we assume, the variable $Z_t$ is a conditional gaussian variable, we denote the model a GARCH-normal(1,1) model. Bollerslev in garch_bollerslev_1, presents the analytical equations for the statistical moments for such a model. This is given by:
where $\mu(\alpha_1,\beta_1,m)=\sum_{j=0}^{m}{{m}\choose{j}}a_i\alpha_1^j\beta_1^{m-j}$ and $a_j=\prod_{i=1}^{j}(2i-1)$.
To allow a GARCH-normal(1,1) model to describe empirical stock market data, we can, for example, fix the values of the statistical moments close to the values of empirical data. Then, we can use traditional statistics such as the Maximum Likelihood Estimators to optimise the model for the given set of moments. However, these methods become extremely difficult to implement when the equations that require solution have more than two free variables. Therefore, these methods only work for low orders of the GARCH(p,q) model, however, such methods also become very laborious and time consuming when we wish to fit parameter values in a high frequency setting. To increase the speed of parameter fitting, we can implement AI methods, more specifically, an Artificial Neural Network (ANN). For a GARCH-normal(1,1) we have the following equations for the second order moment, $E(x^2)$, the fourth order standardised moment, $\Gamma_4$ and the sixth order standardised moment, $\Gamma_6$:
Additional to the use of higher order moments, we wish to investigate the fitting of the GARCH model parameters using the autocovariance of the time series. The reasoning for this inclusion, is due to the ability of a autocovariance calculation to include effects from a time period, rather than a specific instance in time, as is the case with moments. In garch_bollerslev_1, Bollerslev derives an equation to determine the autocovariance with lag $n$, $\gamma_n$ of the square of returns, $cov(x^2_t, x^2_{t+n})$. The solution of this equation (see for detail appendix (ref)) is given below.
We therefore, investigate another sequence of inputs; the second order moment, the fourth order standardised moment and then the autocovariance of the squared process. For completeness, we investigate a range of lags, $n=2, 6, 10$.
Equations ((ref))-((ref)) allow us to create several different datasets for the training of a machine learning algorithm. We use equations ((ref)-(ref)) to create a training set ($\alpha_1$; $\Gamma_4$, $\Gamma_6$, $E(x^2)$). We create another datasets to incorporate the autocovariance of the process with certain time lags, $n=2,6$ and $10$, using equations ((ref)), ((ref)) and ((ref)), generating sets ($\alpha_1$; $\Gamma_4$, $\hat \gamma_n$, $E(x^2)$). Using these datasets we trained an ANN to predict $\alpha_1$ from the inputs of the fourth order standardised moment, $\Gamma_4$, the sixth order standardised moment, $\Gamma_6$, the second order moment, $E(x^2)$ or $\Gamma_4$, the normalised autocovariance with lag $n$, $\hat \gamma_n$, $E(x^2)$. We will then use the analytical expressions of equation ((ref)) to predict the corresponding values of $\alpha_0$ and $\beta_1$. For every dataset created, we split the GARCH data into three individual sets, training data, which has $40\%$ of the overall data (50,000 data points), testing which holds $40\%$ of the data too and validating which holds $20\%$ of the data (25,000 data points) for each network trained on each model.
Here, we employ a feedforward Artificial Neural Network (ANN) that uses a back-propagation algorithm for the minimisation of error. To do this we use the `Adam' optimiser, adam, with a loss function of the mean squared error between the network's forecasts and the data set. All models are used within the PyTorch module of Python.
Our work follows the mathematical notation available in python_ml_book. Here, we denote the values of each node, or the so called `Activation Unit' by $a_i^{(j)}$, where $i$ denotes the unit number (node number) and $j$ denotes the layer we are on. Very generically, we use $h$ for the learning layers (also termed hidden layers) and $out$ for the output layers. The net input to a given layer, for instance, $h$, is represented by, $z_i^{(h)}$:
Where $W_{k,i}$ denotes the weight of all previous nodes connected to the present node we are analysing. In the above equation the layer number is $i$ and $a_i^{(h-1)}$ denotes the activation unit from the previous layer. For the input layer, $a^{(in)}_i$, this will be either a statistical moment or the autocovariance with specific lag $n$ of the process. These weights define the strength of connection between nodes of previous layers. Biases are used in ANNs and are denoted by $a_{k=0}^{(h-1)}$. The fundamental role of the bias is to add another parameter to tune the output of the network to minimise the loss function. The biases have a weight of one and these do not change in the network. To gain an output for this node, we pass our net input into an activation function, $\phi(.)$, as seen below. This then goes into successive connections and eventually reaches the output layer.
The activation function can have different functional forms. However, it has to be differentiable to allow optimisation of the weights and biases of our network. From the analysis undertaken in activation_functions and activation_function_comparison by Sibi et al. and Choudhary et al., respectively. It is shown that as long as an activation function is correctly and thoroughly trained upon a data set then there is no real advantage of one over the other, hence we use the ReLU activation function. Our data is scaled to the interval $[0-1]$, the need for scaling the data in this way is to stop the network giving unnecessary biases to larger data values. In order to scale our inputs we have used the `MinMaxScale' function found in the `sklearn' module of Python. In figure (ref), we have detailed the schematic diagram for the networks we intend to use.
The values that can be tuned are termed `hyperparameters'. For the hyperparameters of our network we have chosen, to use a four layer perceptron, other networks were trialled with differing layer numbers and hyperparameters but four layers with the following parameters was shown to be the most optimal. We therefore employ our perceptron with (128, 2048, 2048, 128) nodes in each layer, respectively. Moreover, we have chosen 5000 epochs, the number of times we pass the data through the network to update the weights, and a learning rate of 0.01, the maximum magnitude the weights can be changed within one epoch. Due to the large dimensionality of the network we invoke an early stopping criteria of the network. If the network does not improve the prediction of the validation set on additional epochs, we stop the training process at the best epoch we can find. This is to stop the network overfitting the data. In essence, it prevents the network from just learning the data, which gives a good training error but is very poor at generalising the behaviour to unseen data sets. The loss function we shall employ, will be the mean squared difference (MSD) of the actual output to the predicted output of the ANN. The loss function (which we wish to minimise), for which we can track the progress of the optimisation process is detailed below:
Where $y_i$ is the actual value from our training or testing data and $\hat y_i$ is the predicted value from the ANN. The outputs of our network will be the parameters of each GARCH model. For the GARCH(1,1) model, we will have one output: $\alpha_1$, the other two parameters of the GARCH(1,1) model will be calculated via the analytical expressions of the higher order moments.
For certain orders of statistical moments to exist, we are required to set limits for the parameters, $\alpha_1$ and $\beta_1$, in the GARCH model. For $\alpha_1$ we have detailed the limits of the parameter for the different moments below. However, to ensure finiteness of the second order moments, we require the limits of $\beta_1$ be $[0, 1]$. We do not necessarily have to restrict the value of $\alpha_0$, however, to enable the ANN to train as accurately as possible on the datasets, we restrict the value of $\alpha_0$ to the interval, $[1e-03, 1e-06]$. To ensure finiteness for the $m$th order moments, we have to restrict the data to the following condition, garch_bollerslev_1:
For example, we have to restrict the value of $\alpha_1$ such that $0 \leq \alpha_1 \leq \frac{1}{15}^{\frac{1}{3}}$ to enable a finite value of $\Gamma_6$, garch_bollerslev_1. Furthermore, we investigate different moment sequences namely $\sigma^2$, $\Gamma_4$ and either, $\Gamma_8$ or $\Gamma_{10}$. Therefore, we have a different limit of $\alpha_1$ to enable finiteness of the highest moment, therefore, in these examples we have $\alpha_1$ as $0 \leq \alpha_1 \leq \frac{1}{105}^{\frac{1}{4}}$ and $0 \leq \alpha_1 \leq \frac{1}{945}^{\frac{1}{5}}$, for the eighth and tenth order standardised moments, respectively.
In figures (ref) and (ref), we see the training and validation error for the dataset ($E(x^2)$, $\Gamma_4$, $\Gamma_6$) we use and the testing results for the GARCH(1,1) parameter, $\alpha_1$. Figure (ref) shows the training and validation error as a function of epoch number. The validation and training errors are independent of one another and as we would expect the more epochs we have the more accurate the network becomes. In this particular network, we have quite a noisy validation error, it is however, stable (does not wildly vary from one epoch to the next) and shows a very low error for the validation dataset, meaning we have good generalisation within the network.
In figure (ref), we see the accuracy of the network to predict the $\alpha_1$ parameter of a GARCH(1,1). As we have had to restrict the possible values of the parameter we get an edge in parameter space around this particular boundary value. As such, if we wish to predict all three parameters of the GARCH(1,1) model it will give these edges on the corresponding limits of the parameter, reducing the prediction accuracy of the network as a whole. To increase the accuracy, we predict just one parameter with the ANN and then use:
To calculate the corresponding value of $\beta_1$, where $\Gamma_{4, emp}$, is the empirical value of the fourth order standardised moment, $\Gamma_4$ and then to calculate the value of $\alpha_0$ we use the following expression, luke_1:
Where, $\sigma^2_{emp}$ is the empirical value of the second order moment.
In figures, (ref) and (ref), we see the $\alpha_1$ test dataset values against the predicted values of $\alpha_1$ for the networks that use $\Gamma_8$ and $\Gamma_{10}$ instead of $\Gamma_6$, respectively. When we have higher orders than the sixth standardised moment as the inputs to the network, we witness a reduction in the predictability of the GARCH parameter, $\alpha_1$. For the eighth and tenth order standardised moments, we have a reduction in the range of $\alpha_1$ values that allow these moments to exist. As a result, we witness the edge effects at a much lower value of $\alpha_1$. In the case of the tenth order standardised moment, this reduction in parameter space manifests itself as an increase in the accuracy of the network to predict $\alpha_1$. Nevertheless, in comparison to the network that uses $\Gamma_6$, figure (ref), in general there is a slight reduction in the predictive ability of the ANN to fit GARCH parameter values.
In figures (ref) and (ref), we see the training and validating errors when we take covariance with a lag of $n=2$ as an input of training the model and the out-of-sample predictions for $\alpha_1$, respectively. We detail the same plots for $n=6$ in figures (ref) and (ref), respectively. Whilst for $n=10$ we see the same results in figures (ref) and (ref), respectively. For all cases, we get a very noisy training and validating error, but due to the early stopping criteria we are able to stop the training procedure on the epoch that equates to the lowest error, this allows for good generalisation for the out-of-sample dataset. We see that there is an edge present on the upper boundary of $\alpha_1$ for a lag of $n=2$. However, for lags of $n=6$ and $n=10$, we see no edge present. Therefore, we have to conclude that these edges are an artefact of using ANNs for small lags in covariance. This observation reinforces our justification of using the ANN to predict just one parameter and then using simple relations of $\Gamma_4$, equation ((ref)) to calculate the value of $\beta_1$ and $\alpha_0$ with $\sigma^2$, equation ((ref)). From the lags investigated, we see that $n=6$ gives the best out-of-sample prediction, equating to a more accurate network for unseen data. When we compare these networks to the networks that use standardised moments instead of normalised autocovariance, we see the ANN with a lag of $n=6$, outperforms all networks we have analysed. Highlighting the most accurate network we can use is when the network has the inputs; the second order moment, the fourth order standardised moment and the normalised autocovariance with lag, $n=6$.
To conclude, we have introduced a novel non-parametric method of fitting GARCH model parameters via the higher order moments and the autocovariance of the process. We have shown with the example of the GARCH-normal(1,1) model that we gain high accuracy when we forecast just one parameter, $\alpha_1$, via this nonparametric approach, whilst using algebraic expressions for the remaining parameters of the GARCH-normal(1,1) model.
The ability to use a fully trained neural network to predict the parameter values of a GARCH model increases the real-time capability of such models. Moreover, when neural networks were trained on higher order standardised moments, for instance, $\Gamma_8$ and $\Gamma_{10}$, we see a reduction in the accuracy of the fitting ability compared to the lower order standardised moment, $\Gamma_6$. When we take the normalised autocovariance, $\hat \gamma_n$, $E(x^2)$ and $\Gamma_4$ as inputs to the ANN, we see that the length of lag we take for the autocovariance over severely impacts the accuracy that we are able to predict out-of-sample data. Therefore, it is clear to see that if we wish to use autocovariance to fit parameters of a GARCH-normal model, the longer lag we can take the better, at least up to the lag of $n=6$ as this has a better out-of-sample prediction than the other lags investigated.
We have also shown that the ANN employed within the paper have the ability to generalise data extremely well. However, it has been shown that the validation and training errors are extremely noisy with respect to the increasing epoch number. Therefore, it is imperative to employ the early stopping criteria to optimise the network we train in order to not overfit the data we train tupon.
The authors would like to acknowledge the support and guidance of Professor Alistair Milne and the invaluable technical guidance of Evgeny Saveliev.