Adv Syst Sci Appl 2018; 02; 53-58 Published online at http://ijassa.ipu.ru/index.php/ijassa/article/view/582 Use of neural network models in market risk management Mariya Radosteva1, Vladimir Soloviev1*, Vera Ivanyuk1,2, Anatoliy Tsvirkun2 1) Financial University under the Government of the Russian Federation, Moscow, Russia E-mail: vsoloviev@fa.ru 2) Institute of Control Sciences RAS, Moscow, Russia E-mail: tsvirkun@ipu.ru Abstract: This topic is of high relevance due to the fact that many market risk assessment mathematical models currently available contain many limitations for their effective use. However, these limitations are often not feasible, which leads to a decrease in forecast accuracy. To avoid this, more accurate models are necessary. Neural network-based models can show a more accurate result due to their basic property – nonlinearity. The goal of this paper is to build a model that can enable us to assess a market risk for a company. Keywords: risk, forecasting, neural networks 1. INTRODUCTION Fig. 1. The primary goal of this paper is to determine a lower bound of the yield to be forecast by the neural network model with a certain level of significance. Current actual yields will be fed to the neural network output, and some factors will be fed to the neural network input. Starbucks stock prices for the period from 2011 to 2016 were taken as the factors fed to the neural network input. * Corresponding author: vsoloviev@fa.ru 54 M. RADOSTEVA, V.SOLOVIEV, V.IVANYUK, A.TSVIRKUN Copyright Β©2018 ASSA. Adv. in Systems Science and Appl. (2018) Fig. 2 However, there is no point in using this data as is, so the values of stock yield were fed to the neural network input. It was decided to take weekly yields with a lag of one day as the yield basic indices. In other words, the yield values were calculated as follows: π‘Ÿπ‘‘ = 𝑃𝑑 βˆ’ π‘ƒπ‘‘βˆ’5 π‘ƒπ‘‘βˆ’5 , where the t is a time interval assumed as a day (the t assumes the values of 6,7,8,... from the beginning of the counting period taking into account that the initial value is indexed by the one); The 𝑃𝑑 is the closing price on the t day without taking into account dividends (this choice is due to the fact that we cannot forecast dividends upon stocks and we do not need this because we assess the market risk of a company); The π‘Ÿπ‘‘ is the earned weekly yield which has been used for modeling. Fig. 3 To improve the model quality volatility was also used as input and output data, so the next step was to calculate daily yields and weekly volatilities (standard deviations) on their basis with a lag of one day similarly with the yields. The volatilities finding procedure can be described as follows: π‘Ÿπ‘˜ = π‘ƒπ‘˜ βˆ’ π‘ƒπ‘˜βˆ’1 π‘ƒπ‘˜βˆ’1 𝜎 = βˆšβˆ‘(π‘Ÿπ‘˜ βˆ’ π‘ŸοΏ½Μ…οΏ½)2 4 π‘˜=1 Another input parameter was trade volume change values. USE OF NEURAL NETWORK MODELS IN MARKET RISK MANAGEMENT 55 Copyright Β©2018 ASSA. Adv. in Systems Science and Appl. (2018) π‘£π‘œπ‘™π‘’π‘šπ‘’π‘‘ = π‘‰π‘œπ‘™π‘’π‘šπ‘’π‘‘ βˆ’ π‘‰π‘œπ‘™π‘’π‘šπ‘’π‘‘βˆ’5 π‘‰π‘œπ‘™π‘’π‘šπ‘’π‘‘βˆ’5 , where π‘‰π‘œπ‘™π‘’π‘šπ‘’π‘‘ is an absolute trade volume value on the t day; π‘£π‘œπ‘™π‘’π‘šπ‘’π‘‘ is a trade volume relative change on the t day. 2. DISTRIBUTION OF THE NEURAL NETWORK ERRORS WHEN FORECASTING THE YIELD The model is based on the architecture of the artificial neural network of a multilayer perceptron or a direct propagation network with error back propagation learning method. The model is aimed at forecasting yield lower bound for the time being, which can be crossed by the actual yields graph not more than Ξ± in 100% of cases. To solve this problem, it was decided that the neural network should learn based on historical data. It was also assumed that the current yield and volatility depended on lagged yield and lagged volatility values. An empirical distribution function was constructed and a quantile of 0.95 level was taken. The error distribution density is shown in Fig. 4. Fig. 4 The resulting value was calculated as a correction level to the initially specified VaR curve. That is the final formula for the VaR based on the neural network is as follows: π‘‰π‘Žπ‘…π‘›π‘’π‘’π‘Ÿ = π‘Ÿπ‘›π‘’π‘’π‘Ÿ βˆ’ πœŽπ‘›π‘’π‘’π‘Ÿ βˆ’ π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘π‘‘π‘–π‘œπ‘› This curve was constructed in two ways. The first way of constructing is based on the fact that the neural network learns once and then a forecast is made using it. That is essentially a model with static weights in that the weights inside the network are calculated once and no longer change. This approach to the VaR curve constructing gives an advantage in terms of program running time, since the learning occurs once. For the sake of convenience this model will be hereinafter referred to as a neural network model with static weights. The second way is based on the assumption that the market structure is changeable (which is actually the case) and to make a forecast more accurate the neural network learns each time when calculating the VaR. That is, to forecast the yield for the time being the neural network learns using N size sample, which includes the previous N values of this index. This is a model with dynamic weights. At each calculation of the VaR value the neural network learns again. Of course, such method of the VaR constructing is inferior to the first one, but it should be more accurate. For the sake of convenience this model will be hereinafter referred to as a neural network model with dynamic weights. 56 M. RADOSTEVA, V.SOLOVIEV, V.IVANYUK, A.TSVIRKUN Copyright Β©2018 ASSA. Adv. in Systems Science and Appl. (2018) Kupic test consists in checking the following statistical hypothesis: 𝐻0: 𝛼0 = 𝛼 against alternative π»π‘Žπ‘™π‘‘: 𝛼0 β‰  𝛼, where the 𝛼 = 𝐾 𝑁 , 𝐾 is the number of the VaR line breaks, the 𝑁 is the quantity of forecast data, and the 1 βˆ’ 𝛼0 is a specified level of significance. Checking is performed using statistics 𝑆𝐢𝑒𝑝 = βˆ’2 ln((1 βˆ’ 𝛼) π‘βˆ’πΎπ›ΌπΎ) + βˆ’2 ln((1 βˆ’ 𝛼0) π‘βˆ’πΎπ›Ό0 𝐾), which has the πœ’2(1) distribution if the null hypothesis is true. Another quality index that helps to choice between the models that passed the Kupic test is the loss function value, which measures the average value of the VaR level excess by actual losses. The smaller the loss function value, the more adequately risk is assessed by the considered model. The loss functions most commonly used are the Lopez and Blanco-Ihle’s ones: πΏπΏπ‘œ = 1 𝐾 βˆ‘(𝑦𝑑 βˆ’ π‘‰π‘Žπ‘…π‘‘) 2𝐼(𝑦𝑑 < π‘‰π‘Žπ‘…π‘‘) 𝑇 𝑑=1 , 𝐿𝐡𝐼 = 1 𝐾 ( 𝑦𝑑 βˆ’ π‘‰π‘Žπ‘…π‘‘ π‘‰π‘Žπ‘…π‘‘ ) 𝐼(𝑦𝑑 < π‘‰π‘Žπ‘…π‘‘) The Lopez’s loss function is different in that it gives a greater weight to significant deviations. This is justified from a substantive point of view, since single large excesses are usually more dangerous than a few small ones. When constructing the VaR curve, the programming language R with the neuralnet library was used, which allowed to construct direct propagation neural networks with the error back propagation methods in different versions. In particular, the RPROP learning method was used. During the research, experiments to change the number of layers in the multilayer perceptron, as well as the number of neurons in each layer in order to improve forecast accuracy were carried out. The learning sample-based forecast error formula built into the neural network was used as a guide. Such error formula was calculated as follows: 𝐸 = 1 2 (π‘¦π‘“π‘Žπ‘π‘‘ βˆ’ οΏ½ΜƒοΏ½) 2 and was output by the program itself. Since the neural network showed different results at each learning session, it was decided to take the arithmetic mean of this error in order to generalize this parameter for the neural network with such layers and quantity. 𝐸ср = 1 𝑛 βˆ‘πΈπ‘– 𝑛 𝑖=1 , where the n was taken equal to the order of 30. The result of the research is the Error! Reference source not found.. Table 1. Number of neurons in layers Yield Volatility With a relative change in trade volume Without a relative change in trade volume Without a relative change in trade volume (6, 3) 0.14399 0.163759 0.00813 USE OF NEURAL NETWORK MODELS IN MARKET RISK MANAGEMENT 57 Copyright Β©2018 ASSA. Adv. in Systems Science and Appl. (2018) (8, 3) 0.135139 0.157891 0.00813 (11, 6) 0.12661 0.14632 0.00813 (12, 3) 0.12789 0.139695 0.00813 (12, 6) 0.13096 0.132457 0.00813 (22, 6) 0.1176 0.14441 0.00801 (22, 11) 0.10761 0.15441 0.00771 (24, 3) 0.107 0.14177 0.00713 (24, 6) 0.11826 0.17130 0.00712 (22, 11, 3) 0.12405 0.1789 0.01519 (22, 11, 6) 0.10574 0.17111 0.02907 (24, 12, 6) 0.11581 0.1753 0.01813 From the implementation point of view the back propagation method converges for a long time, therefore its various modifications are often used. In particular, during the neural network learning the RPROP method has been used which is as follows. The algorithm is based on the partial derivative sign. New weights are updated according to: 𝑀𝑖𝑗 (𝑑+1) = 𝑀𝑖𝑗 (𝑑) + βˆ†π‘€π‘–π‘— (𝑑) { βˆ†π‘€π‘–π‘— (𝑑) = βˆ’π‘ π‘–π‘”π‘› ( πœ•πΈ πœ•π‘€π‘–π‘— (𝑑) )βˆ†π‘–π‘— (𝑑), if πœ•πΈ πœ•π‘€π‘–π‘— (π‘‘βˆ’1) πœ•πΈ πœ•π‘€π‘–π‘— (𝑑) β‰₯ 0 βˆ†π‘€π‘–π‘— (𝑑) = βˆ’βˆ†π‘€π‘–π‘— (π‘‘βˆ’1) ΠΈ ( πœ•πΈ πœ•π‘€π‘–π‘— (𝑑) ) = 0, if πœ•πΈ πœ•π‘€π‘–π‘— (π‘‘βˆ’1) πœ•πΈ πœ•π‘€π‘–π‘— (𝑑) < 0 . where the 𝑠𝑖𝑔𝑛() is a function that assumes the value of +1 or -1 depending on which sign has a value in parentheses; βˆ†π‘–π‘— (𝑑)= { min(πœ‚+βˆ†π‘–π‘— (π‘‘βˆ’1) , Ξ”max ) , if πœ•πΈ πœ•π‘€π‘–π‘— (π‘‘βˆ’1) πœ•πΈ πœ•π‘€π‘–π‘— (𝑑) > 0 max(πœ‚βˆ’βˆ†π‘–π‘— (π‘‘βˆ’1), Ξ”min ) , if πœ•πΈ πœ•π‘€π‘–π‘— (π‘‘βˆ’1) πœ•πΈ πœ•π‘€π‘–π‘— (𝑑) < 0 βˆ†π‘–π‘— (π‘‘βˆ’1), if πœ•πΈ πœ•π‘€π‘–π‘— (π‘‘βˆ’1) πœ•πΈ πœ•π‘€π‘–π‘— (𝑑) = 0 where the zero values βˆ†π‘–π‘— (0) and 0 < πœ‚βˆ’ < 1 < πœ‚+ are chosen arbitrarily. Such an algorithm converges faster than a usual back propagation method. The result of this study is the VaR curve constructed on the basis of the neural network model. One of the ways to implement the neural network model for the VaR level forecasting is shown in Figure 5. 58 M. RADOSTEVA, V.SOLOVIEV, V.IVANYUK, A.TSVIRKUN Copyright Β©2018 ASSA. Adv. in Systems Science and Appl. (2018) Fig. 5 The VaR curve constructed on the basis of the neural network model with static weights and a significance level of 0.95 (the black line is the yield curve, the red line is the VaR level). In this case, the actual percentage of break is at the level of 4.65%. The Kupic test has shown a p-value= 0.6809912418, which is a good result. The Lopez and Blanco-Ihle’s tests for such a situation assumed the following values: πΏπΏπ‘œ = 0.0001344051456, 𝐿𝐡𝐼 = 0.1513434227, which generally evidences a good quality of the model, since the break depth is relatively small. In particular, the Lopez’s index indicates that existing breaks are light, which is a good sign. The result of the paper is the market risk assessment neural network model, which has shown good results according to the tests performed. REFERENCES [1] Ben, K. & Van der Smagt, P. (1996). An introduction to neural networks. University of Amsterdam. [2] Haykin, S. (1999) Neural Networks: A Comprehensive Foundation, Prentice Hall [3] Ivanyuk, V. & Tsvirkun, A. (2013). Intelligent system for financial time series prediction and identification of periods of speculative growth on the financial market. IFAC Proceedings Volumes, 46(9), 1128-1133. [4] Ivanyuk, V. & Pashchenko, F. (2015) Methods and models for the forecasting and management of time series. // ITISE 2015, Granada, 283-292 [5] Simonov, B., Ivanyuk, V., & Simonova, I. (2016). Existence of Best Approximation Elements in the spaces L. Journal of Mathematical Sciences, 217(5), 1-21. [6] Koroteev, M., Terelyanskii,, P. & Ivanyuk V. (2016) Approximation of Series of Expert Preferences by Dynamical Fuzzy Numbers. Journal of Mathematical Sciences, 216(5), 692-695. [7] Rumelhart, D. E., Hinton, G. E., & Williams, R. J. (1985). Learning internal representations by error propagation (No. ICS-8506). California Univ San Diego La Jolla Inst for Cognitive Science.