MEASURING THE IMPACT OF THE STOCK MARKET INDEX RETURN ON STOCKS RETURN USING THE STOCHASTIC APPROXIMATION

Value at Risk (VAR) is a risk measure frequently used in market finance. This tool gives an idea of the losses that may occur to a financial asset (share or option), but does not predict when these losses may occur. The objective of our work is to propose a method that allows us to know the state of the economy necessary for Microsoft's performance to suffer extreme losses with alpha probability. This represents a significant asset for investors to consider before trading on the stock market. To answer this problem, we will try to explain the VAR using the ROBBINS-MONRO-JOSEPH procedure for the estimation of a percentile for binary variables, as a function of a systemic risk factor. We will also propose a method for applying the procedure without using real-time experiments. We are going to estimate the different parameters of the process, based on the history of the data available for statistical modelling, then analyse the results of the convergence of the process over the iterations, and finally see the impact of adding a random element to the binary variable yn of the process on convergence. The final results are satisfying and seem to be in line with reality, but there is room for improvement, either by increasing the number of iterations needed to refine convergence, whereas the stochastic approximation aims to obtain a good estimate in a minimum number of iterations, or by applying other more recent procedures that show better results following simulations. 3730 LABRIJI, BENNAR, LABRIJI, RACHIK


INTRODUCTION
The main arbitrage in market finance is to know the right time to sell or buy financial products, while minimising losses and maximising gains. One of the first attempts to address this arbitrage was made by Markowitz (1952) [1] with his approach to minimizing the variance of a portfolio of financial assets. Since then, several approaches have been adopted, but one of the most widely used methods for managing financial product risk remains Value At Risk (VAR). Thus, the Basel Committee has even imposed its use on financial institutions [2].
VaR is the maximum level of loss that a financial asset can sustain, with a confidence level α∊ (0,1). There are several methods for calculating VaR. However, the most commonly used are: historical VaR which is based on past returns, and assumes that future returns are independent and have the same distribution as past returns. The second method is the parametric method. In this case it is assumed that the returns on the financial asset follow a known distribution, and we deduce the VAR according to the percentile of this law which is consistent with the confidence level set.
The third method uses Monte Carlo simulation, which, by setting a given time horizon, generates returns according to a specific distribution, and then calculates the VaR on the basis of the simulated returns. Typically, the return on assets is assumed to follow the following differential equation = ∆ + √∆ (1) With: the return on financial assets after i periods, the average of financial asset prices, the standard deviation of the price of the financial asset, a random number generated according to the standard normal law, and Δ the process step.

MEASURING THE IMPACT OF THE STOCK MARKET INDEX RETURN
The frequently used generalisation is Wiener's process, which is more suitable for distributions with a thick tail, and which incorporates time jumps. To know more about the VaR see [3].
However, we do not know when these losses might occur, and therefore we have difficulty protecting ourselves against this risk of loss. In this paper, we will introduce a method for estimating the impact of a given exogenous risk factor on the return on the financial asset of interest, using a sequential stochastic approximation algorithm of the Robbins and Monro (1951) [4] type.

Robbins and Monro have shown that
→ , the percentile value α of an unknown distribution, in probability if is generated according to the following process.
The value of a latent variable at iteration n • A threshold linked to the latent variable Therefore, we will try to estimate the value θ of the α percentile that will cause losses equivalent to the VaR of the financial asset of interest. To do so, we will use the optimal Robbins-Monro procedure proposed by V. Roshan Joseph (2004) [5].

Optimal Robbins-Monro procedure
Let ( ) be a distribution function of an unknown law and assume that ̇( ) is known with , such that ( ) = with the order of the percentile that we are trying to estimate. The experiment starts with a value 1 close to the value of of the percentile of order that we are trying to estimate, based on a priori knowledge. Therefore, we can choose an a priori distribution for with (Ɵ) = 1 and (Ɵ) = 1 2 < ∞, ℎ 1 represents uncertainty 3732 LABRIJI, BENNAR, LABRIJI, RACHIK of estimation of . Joseph proposes the following modified Robbins-Monro procedure +1 = − ( − ) (5) Note that even if 1 is fixed, 2 , … , are random, given their dependencies on past data.
Let be = − Ɵ (6) Therefore Joseph found the sequences { } and { } such as → 0 in probability, assuming that they verify the following condition He has shown that: With: With the distribution function of the standard normal law, its density function, =̇( )/ { −1 ( )} , and 1 = 2 1 2 , so once 1 is determined, we can start the process.
Moreover, the confidence interval at the level (1 − ) for each value of de is

Problematic
It should be noted that this is not the first application of stochastic approximation to the VAR, see [6]- [7], but where the cited work focuses on modeling the VAR, we seek earlier to explain it.
Let the Value at Risk of a financial asset with a q∈(0,1) level, we define such as : With the return on the financial asset we want to study.
Let X be an exogenous factor, correlated to the performance of the financial asset we wish to study, and which is capable of explaining the losses or gains of the financial asset.
So, we can use Robbins-Monro-Joseph's algorithm to estimate the value such that has a probability that = 1 and thus a probability 1 − of causing losses greater than or equal to the threshold of , with the percentile of the unknown density function that we want to estimate Let ( ) be a function such that = ( ) + with a noise with a mean of zero. We can therefore write in the following form

Model estimation
The most well-known basic model in the literature is the Capital Asset Pricing Model (CAMP).
Created by Sharpe, in the 1960s [8] and based on studies by Markowitz in 1952 (modern portfolio theory). This tool describes the relationship between the risk of a financial asset and the expected return on that asset, and can be formulated as follows

With
• ̅ The expected return on financial assets • The risk-free rate • ̅ The expected market profitability Therefore, the equation can be written as follows. Below is Table 1 describing the two returns. The two yields have a correlation of 0.7414856. It can also be seen from the graph below, which represents the Microsoft Return versus the S&P Return, that there is indeed a linear relationship between the two returns, visible through the linear regression line. However, we also note the existence of outliers which may affect the quality of our model ( Figure 1).

Figure 1. Adjusting Microsoft's performance to S&P's performance by a linear line
A linear regression model is a statistical model that estimates a straight line using the ordinary least squares method. At first glance, the fit is acceptable. However, it is noticeable that in some regions, it would be preferable to use a polynomial with a degree greater than 1. The most commonly used method to solve this local fitting problem is the LOESS (LOcally weighted Scatterplot Smoother) method. Originally proposed by Cleveland (1979) [9] and further developed by Cleveland and Devlin (1988) [10], it specifically refers to a locally weighted polynomial regression. At each point in the database, a low-level polynomial is fitted to a sample, based on the values of explanatory variables close to the point whose response is estimated. The polynomial is adjusted using weighted least squares, giving more weight to points close to the point whose response is estimated and less weight to points further away. The value of the regression function for the point is then obtained by evaluating the local polynomial using the explanatory variable values for that data point. The LOESS adjustment is achieved once the regression function values have been calculated for each of the n points in our database (Figure 2).

Figure 2. Adjusting Microsoft's performance to S&P's performance using a LOESS model
We can see that there is a slight parabola near zero yields as well as towards low yields. So the relationship is not perfectly linear. (Figure 2)  (Figure 3), the relationship between the two returns is no longer linear, but becomes parabolic. An ordinary least squares adjustment will push us to impute the data that we consider aberrant, with a linear view, whereas the relationship that describes the links between the two variables tends towards a quadratic relationship. From this, we retain the LOESS model.
The second element necessary for our approximation is to have the , as =̇( )/ { −1 ( )}, as we assume that ̇( ) is known.
So the first step is to have an approximation of M(x). Since we have a history, we can define the variable as follows With. •

Microsoft's performance
• 95% Value at risk at the 95% level which is -3.73% in our case, using the historical method.
Therefore, we can express the relationship between the values of de & and trough the logistic regression.
A relationship which is formulated as follows.
With α,et c, the parameters estimated using logistic regression.

LABRIJI, BENNAR, LABRIJI, RACHIK
The result of the estimation of the model coefficients is as follows ( Table 2). Therefore, one can approximate ̇( ) by ( ). Furthermore, to have an approximation of θ associated with each α, we can use the solution of the following equation demonstrated that the process converges towards the target value of θ, regardless of the value of ̇( ) provided [4]. However, an estimate far from the real value should cause a slowing down of the convergence. In our case the slowdown should be minimal, as our estimates are based on available data.
The last element to be fixed is the to define , in our case, as well as the definition of y, the historical VAR at the 95% level is -3.73%. So The definition of causes the approximation to return the value of , will be greater than the VAR, with a given probability α. Therefore, it returns the value of which will be lower than the VAR with a probability 1-α.

Simulation
In our case we take 1 as the solution to the equation

Figure 4. Result of the stochastic approximation as a function of each alpha
The black curve is the result of the S.A. We can see that the S.A. has converged directly to the LOESS model solution and this, independently of the value of α. This is due to our definition of which only takes into account the systemic risk factor that is represented by the S&P return, whereas it is the intrinsic risk that causes volatility.
To overcome this problem, we define ( ) as follows With a randomly simulated value according to the distribution of the residuals of the LOESS regression. The next step therefore is to determine the error distribution of our model.
The density function estimated from the residuals can be seen below ( Figure 5).

Figure 5. distribution of regression residuals
It can be seen that the curve is closer to a Student distribution than the normal distribution.
Furthermore, the result of Student's Kolmogorov Smirnov test for standardised residuals using a scale=0.01, location=0 with 3 degrees of freedom showed that the test statistic D = 0.026157, pvalue = 0.9941. Therefore, we cannot reject the hypothesis H0= "the residuals follow a Student distribution". Thus, we can see below ( Figure 6) the result of the stochastic approximation by adding a noise for the calculation of after 100 iterations. It can therefore be clearly seen that the results of the stochastic approximation are consistent with Microsoft's historical performance. Indeed, for Alpha close to 1, the S.A. clearly indicates a low but positive return at a 1-alpha chance of causing losses exceeding the VAR threshold at Microsoft, and the same is true for Alpha close to zero. The red lines represent the result of the S.A. for alpha equal to 0.5. It should be noted that 50% of the occurrences of Microsoft's losses had an associated S&P return greater than the estimate for alpha equal to 0.5.

Discussion
The estimation method chosen is the method proposed by Joseph, the latter had demonstrated that his algorithm gives better results than the classical Robbins and Monro algorithm even for extreme alpha values, and this for a low number of iterations but with a high root mean square error for extreme alpha values, but still lower than the basic algorithm. We cannot verify this finding because the target value of our process is unknown. However, 100 iterations are not enough to converge, as can be seen in the graph below ( Figure 8) after 1000 iterations. It can be seen that the values of the estimate for alphas below 0.6 have been refined. This is due to the low speed of convergence that can be caused by the same value 1 independently of alpha. Several methods have been proposed to overcome this convergence speed problem, such as those of [11], [12] and [13]. They have shown that their improved versions return a lower MSE than joseph's version for low iterations, especially for extreme alpha values. But, which are relatively heavier in terms of compilations, and require several iterations to calibrate particular parameters. Especially since in our case, we have to be more interested in the time needed for compilation than the number of iterations performed given the power of the compilers available.
All the more so as adding iterations allows us to better control the effect of the noise we add to the

CONCLUSION
The results obtained represent a significant asset to be taken into consideration by investors before trading on the stock market. Therefore, sell when the return of the stock market index is dangerously close to the results obtained by the stochastic approximation, or buy if the return of the stock market index is far from our results and thus be sure not to suffer significant losses.
Moreover, this work can be duplicated for any value return. Therefore, at time "t" we can judge the state of the economy and make our forecasts of the evolution of the stock market index. We can set a target positive return, for example, and thus know whether our forecasts will generate the targeted return, and thus buy the stock at a low price to be able to resell it at a more advantageous price. It would also be interesting to apply the stochastic approximation, but this time not to a single stock, but to a portfolio of stocks, trying to capture the covariance between the different stocks that make up the portfolio.

MATERIALS AND METHODS
All data used to conduct this study was obtained through Yahoo Finance. In addition, the theory discussed in this article has been transcribed on the programming language "R" with functions native to it. As for the graphs, they were drawn using the functions of the "Ggplot2" package of this language.

DATA AVAILABILITY
1. The Microsoft stock price data used to support the findings of this study can be accessed free of charge on « https://finance.yahoo.com/quote/MSFT/history?p=MSFT » 2. The S&P data used to support the findings of this study can be accessed free of charge on «https://finance.yahoo.com/quote/%5EGSPC/history?p=%5EGSPC»

CONFLICT OF INTERESTS
The author(s) declare that there is no conflict of interests.