Forecasting Value at Risk (VaR) and Expected Shortfall (ES) in the Tehran Stock Exchange Index Using Stateful Recurrent Neural Network (Stateful-RNN) Models

Document Type : Original Article

Authors

1 Associate Prof., Department of Markets and Financial Institutions, Faculty of Accounting and Financial Sciences, College of Management, University of Tehran, Tehran, Iran.

2 Department of Markets and Financial Institutions, Faculty of Accounting and Financial Sciences, College of Management, University of Tehran, Tehran, Iran.

10.66224/ijf.2026.580106.1575
Abstract
The increasing importance of financial risk measurement, driven by regulatory requirements and market uncertainties, necessitates precise forecasting tools for Value at Risk (VaR) and Expected Shortfall (ES). This study introduces three novel models based on Stateful Recurrent Neural Networks (RNNs) and Feedforward Neural Networks (FNNs) for predicting VaR and ES. These models are evaluated against traditional econometric models, including Generalized Autoregressive Conditional Heteroskedasticity (GARCH) models, using a dataset of the Tehran Exchange Divedend and Price Index (TEDPIX) spanning more than three decades. This research presents a comprehensive comparison between Stateful and Non-Stateful RNN models, demonstrating that Stateful RNNs significantly enhance forecasting performance. First, the data is standardized before being fed into machine learning models and then used as input for the models. The results indicate strong predictive performance, while a reduction in the FZ0 loss score highlights the superior accuracy of these models. In the empirical study, the proposed models are applied to the Tehran Exchange Divedend and Price Index (TEDPIX). The models’ performance is assessed using the FZ0 loss function and backtesting methods, such as DQ regression tests and DES tests. The findings reveal that Stateful RNN-based models outperform traditional econometric models in terms of both accuracy and stability. In particular, the STRNN-II and STRNN-III models consistently rank highest, demonstrating their superior ability to capture the complex dynamics of financial risk. Moreover, these models do not rely on strong distributional assumptions, offering greater flexibility than traditional parametric models like GARCH.

Keywords


Abad, P., Benito, S., & López, C. (2014). A comprehensive review of Value at Risk methodologies. The Spanish Review of Financial Economics, 12(1), 15–32. https://doi.org/10.1016/j.srfe.2013.06.001
Acerbi, C., & Tasche, D. (2002a). Expected shortfall: A natural coherent alternative to value at risk. Economic Notes, 31(2), 379–388. https://doi.org/10.1111/1468-0300.00091
Acerbi, C., & Tasche, D. (2002b). On the coherence of expected shortfall. Journal of Banking & Finance, 26(7), 1487–1503. https://doi.org/10.1016/s0378-4266(02)00283-2
Aggarwal, C. C. (2023). Neural networks and deep learning: A textbook. Springer International Publishing.
Alberg, D., Shalit, H., & Yosef, R. (2008). Estimating stock market volatility using asymmetric GARCH models. Applied Financial Economics, 18(15), 1201–1208. https://doi.org/10.1080/09603100701604225
Aliyev, F., Ajayi, R., & Gasim, N. (2020). Modelling asymmetric market volatility with univariate GARCH models: Evidence from Nasdaq-100. The Journal of Economic Asymmetries, 22(e00167), e00167. https://doi.org/10.1016/j.jeca.2020.e00167
Almeida, D. de, & Hotta, L. K. (2014). The leverage effect and the asymmetry of the error distribution in GARCH-based models: The case of Brazilian market-related series. Pesquisa Operacional, 34(2), 237–250. https://doi.org/10.1590/0101-7438.2014.034.02.0237
Ardia, D., Bluteau, K., Boudt, K., & Catania, L. (2018). Forecasting risk with Markov-switching GARCH models:A large-scale performance study. International Journal of Forecasting, 34(4), 733–747. https://doi.org/10.1016/j.ijforecast.2018.05.004
Arian, H., Moghimi, M., Tabatabaei, E., & Zamani, S. (2022). Encoded Value-at-Risk: A machine learning approach for portfolio risk measurement. Mathematics and Computers in Simulation, 202, 500–525. https://doi.org/10.1016/j.matcom.2022.07.015
Artzner, P., Delbaen, F., Eber, J.-M., & Heath, D. (1999). Coherent measures of risk. Mathematical Finance. An International Journal of Mathematics, Statistcs and Financial Economics, 9(3), 203–228. https://doi.org/10.1111/1467-9965.00068
BenSaïda, A., Boubaker, S., Nguyen, D. K., & Slim, S. (2018). Value‐at‐risk under market shifts through highly flexible models. Journal of Forecasting, 37(8), 790–804. https://doi.org/10.1002/for.2503
Billio, M., & Pelizzon, L. (2000). Value-at-Risk: a multivariate switching regime approach. Journal of Empirical Finance, 7(5), 531–554. https://doi.org/10.1016/s0927-5398(00)00022-0
Bollerslev, T. (1986). Generalized autoregressive conditional heteroskedasticity. Journal of Econometrics, 31(3), 307–327. https://doi.org/10.1016/0304-4076(86)90063-1
Bucevska, V. (2013). An empirical evaluation of GARCH models in Value-at-risk estimation: Evidence from the Macedonian stock exchange. Business Systems Research Journal, 4(1), 49–64. https://doi.org/10.2478/bsrj-2013-0005
Chen, H., Wan, Q., & Wang, Y. (2014). Refined Diebold-Mariano test methods for the evaluation of wind power forecasting models. Energies, 7(7), 4185–4198. https://doi.org/10.3390/en7074185
Chronopoulos, I., Raftapostolos, A., & Kapetanios, G. (2024). Forecasting value-at-risk using deep neural network quantile regression. Journal of Financial Econometrics, 22(3), 636–669. https://doi.org/10.1093/jjfinec/nbad014
Cont, R., Cucuringu, M., Xu, R., & Zhang, C. (2022). Tail-GAN: Learning to simulate tail risk scenarios. In arXiv [q-fin.RM]. https://doi.org/10.48550/ARXIV.2203.01664
Crouhy, M., Galai, D., & Mark, R. (2014). The essentials of risk management, second edition (2nd ed.). McGraw-Hill Professional.
Degiannakis, S., Floros, C., & Dent, P. (2013). Forecasting value-at-risk and expected shortfall using fractionally integrated models of conditional volatility: International evidence. International Review of Financial Analysis, 27, 21–33. https://doi.org/10.1016/j.irfa.2012.06.001
Delbaen, F. (2002). Coherent risk measures on general probability spaces, in Advances in Finance and Stochastics (pp. 1–37). Springer Berlin Heidelberg.
Diebold, F. X., & Mariano, R. S. (1995). Comparing predictive accuracy. Journal of Business & Economic Statistics: A Publication of the American Statistical Association, 13(3), 253–263. https://doi.org/10.1080/07350015.1995.10524599
Duffie, D., & Pan, J. (1997). An overview of value at risk. The Journal of Derivatives, 4(3), 7–49. https://doi.org/10.3905/jod.1997.407971
Elman, J. (1990). Finding structure in time. Cognitive Science, 14(2), 179–211. https://doi.org/10.1016/0364-0213(90)90002-e
Engle, R. F. (1982). Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom inflation. Econometrica: Journal of the Econometric Society, 50(4), 987. https://doi.org/10.2307/1912773
Engle, R. F., & Manganelli, S. (2004). CAViaR: Conditional autoregressive value at risk by regression quantiles. Journal of Business & Economic Statistics: A Publication of the American Statistical Association, 22(4), 367–381. https://doi.org/10.1198/073500104000000370
Fissler, T., & Ziegel, J. F. (2015). Higher order elicitability and Osband’s principle. arXiv [Math.ST]. https://doi.org/10.48550/ARXIV.1503.08123
Fong Chan, K., & Gray, P. (2006). Using extreme value theory to measure value-at-risk for daily electricity spot prices. International Journal of Forecasting, 22(2), 283–300. https://doi.org/10.1016/j.ijforecast.2005.10.002
Gerlach, R., & Wang, C. (2020). Semi-parametric dynamic asymmetric Laplace models for tail risk forecasting, incorporating realized measures. International Journal of Forecasting, 36(2), 489–506. https://doi.org/10.1016/j.ijforecast.2019.07.003
Geron, A. (2019). Hands-on machine learning with scikit-learn, keras, and TensorFlow: Concepts, tools, and techniques to build intelligent systems (2nd ed.). O’Reilly Media.
Gu, S., Kelly, B., & Xiu, D. (2020). Empirical asset pricing via machine learning. The Review of Financial Studies, 33(5), 2223–2273. https://doi.org/10.1093/rfs/hhaa009
Guermat, C., & Harris, R. D. F. (2002). Forecasting value-at-risk, allowing for time variation in the variance and kurtosis of portfolio returns. International Journal of Forecasting, 18(3), 409–419. https://doi.org/10.1016/s0169-2070(01)00122-4
Hansen, B. E. (1994). Autoregressive Conditional Density Estimation. International Economic Review, 35(3), 705. https://doi.org/10.2307/2527081
Hartz, C., Mittnik, S., & Paolella, M. (2006). Accurate value-at-risk forecasting based on the normal-GARCH model. Computational Statistics & Data Analysis, 51(4), 2295–2312. https://doi.org/10.1016/j.csda.2006.09.017
Holton, G. A. (2003). Value-at-risk: Theory and practice (1st ed.). Academic Press.
Hornik, K., Stinchcombe, M., & White, H. (1989). Multilayer feedforward networks are universal approximators. Neural Networks: The Official Journal of the International Neural Network Society, 2(5), 359–366. https://doi.org/10.1016/0893-6080(89)90020-8
Huang, D., Yu, B., Fabozzi, F. J., & Fukushima, M. (2009). CAViaR-based forecast for oil price risk. Energy Economics, 31(4), 511–518. https://doi.org/10.1016/j.eneco.2008.12.006
Hutchinson, J. M., Lo, A. W., & Poggio, T. (1994). A nonparametric approach to pricing and hedging derivative securities via learning networks. The Journal of Finance, 49(3), 851. https://doi.org/10.2307/2329209
Ivașcu, C.-F. (2021). Option pricing using Machine Learning. Expert Systems with Applications, 163(113799), 113799. https://doi.org/10.1016/j.eswa.2020.113799
Jorion, P. (2000). Value at risk: The new benchmark for managing financial risk (2nd ed.). McGraw-Hill.
Kakade, K., Jain, I., & Mishra, A. K. (2022). Value-at-Risk forecasting: A hybrid ensemble learning GARCH-LSTM based approach. Resources Policy, 78(102903), 102903. https://doi.org/10.1016/j.resourpol.2022.102903
Khan, M. K., Kim, S.-K., & Alghathbar, K. (2011). Cryptanalysis and security enhancement of a ‘more efficient & secure dynamic ID-based remote user authentication scheme.’ Computer Communications, 34(3), 305–309. https://doi.org/10.1016/j.comcom.2010.02.011
Koenker, R., & Bassett, G., join(' ’. (1978). Regression Quantiles. Econometrica: Journal of the Econometric Society, 46(1), 33. https://doi.org/10.2307/1913643
Lu, X., Ma, F., Xu, J., & Zhang, Z. (2022). Oil futures volatility predictability: New evidence based on machine learning models. International Review of Financial Analysis, 83(102299), 102299. https://doi.org/10.1016/j.irfa.2022.102299
Lucas, A., & Zhang, X. (2016). Score-driven exponentially weighted moving averages and Value-at-Risk forecasting. International Journal of Forecasting, 32(2), 293–302. https://doi.org/10.1016/j.ijforecast.2015.09.003
Mandelbrot, B. B. (1997). The variation of certain speculative prices. In Fractals and Scaling in Finance (pp. 371–418). Springer New York.
Mariano, R. S., & Preve, D. (2012). Statistical tests for multiple forecast comparison. Journal of Econometrics, 169(1), 123–130. https://doi.org/10.1016/j.jeconom.2012.01.014
McNeil, A. J., Frey, R., & Embrechts, P. (2015). Quantitative Risk Management: Concepts, techniques and tools - revised edition. Princeton University Press.
Ormaniec, W., Pitera, M., Safarveisi, S., & Schmidt, T. (2022). Estimating value at risk: LSTM vs. GARCH. In arXiv [q-fin.RM]. https://doi.org/10.48550/ARXIV.2207.10539
Patel, J., Shah, S., Thakkar, P., & Kotecha, K. (2015). Predicting stock and stock price index movement using Trend Deterministic Data Preparation and machine learning techniques. Expert Systems with Applications, 42(1), 259–268. https://doi.org/10.1016/j.eswa.2014.07.040
Patton, A. J., Ziegel, J. F., & Chen, R. (2019). Dynamic semiparametric models for expected shortfall (and Value-at-Risk). Journal of Econometrics, 211(2), 388–413. https://doi.org/10.1016/j.jeconom.2018.10.008
Qiu, Z., Lazar, E., & Nakata, K. (2024). VaR and ES forecasting via recurrent neural network-based stateful models. International Review of Financial Analysis, 92(103102), 103102. https://doi.org/10.1016/j.irfa.2024.103102
Roccioletti, S. (2015). Backtesting value at risk and expected shortfall (1st ed.). Springer Gabler.
Saha, S., Gao, J., & Gerlach, R. (2021). Stock movement prediction on ex-divedend day using event-specific features and machine learning techniques—2021 International Joint Conference on Neural Networks (IJCNN).
Shim, J., Kim, Y., Lee, J., & Hwang, C. (2012). Estimating value at risk with semiparametric support vector quantile regression. Computational Statistics, 27(4), 685–700. https://doi.org/10.1007/s00180-011-0283-z
So, M. K. P., & Yu, P. L. H. (2006). Empirical analysis of GARCH models in value at risk estimation. Journal of International Financial Markets Institutions and Money, 16(2), 180–197. https://doi.org/10.1016/j.intfin.2005.02.001
Sollis, R. (2009). Value at risk: a critical overview. Journal of Financial Regulation and Compliance, 17(4), 398–414. https://doi.org/10.1108/13581980911004370
Taylor, J. W. (2007). Estimating value at risk and expected shortfall using expectiles. Journal of Financial Econometrics, 6(2), 231–252. https://doi.org/10.1093/jjfinec/nbn001
Taylor, J. W. (2019). Forecasting value at risk and expected shortfall using a semiparametric approach based on the asymmetric Laplace distribution. Journal of Business & Economic Statistics: A Publication of the American Statistical Association, 37(1), 121–133. https://doi.org/10.1080/07350015.2017.1281815
Tsay, R. S. (2010). Analysis of financial time series: Tsay/financial time series 3E (3rd ed.). Wiley-Blackwell.
Vrontos, S. D., Galakis, J., & Vrontos, I. D. (2021). Implied volatility directional forecasting: a machine learning approach. Quantitative Finance, 21(10), 1687–1706. https://doi.org/10.1080/14697688.2021.1905869
Wang, J., Wang, S., Lv, M., & Jiang, H. (2024). Forecasting VaR and ES by using deep quantile regression, GANs-based scenario generation, and heterogeneous market hypothesis. Financial Innovation, 10(1). https://doi.org/10.1186/s40854-023-00564-5
Wu, Q., & Yan, X. (2019). Capturing deep tail risk via sequential learning of quantile dynamics. Journal of Economic Dynamics & Control, 109(103771), 103771. https://doi.org/10.1016/j.jedc.2019.103771
Xu, Q., Liu, X., Jiang, C., & Yu, K. (2016). Nonparametric conditional autoregressive expectile model via neural network with applications to estimating financial risk: Q. XUET AL. Applied Stochastic Models in Business and Industry, 32(6), 882–908. https://doi.org/10.1002/asmb.2212
Ye, T., & Zhang, L. (2019). Derivatives pricing via machine learning. Journal of Mathematical Finance, 09(03), 561–589. https://doi.org/10.4236/jmf.2019.93029
Zhang, L. (2020). A general framework of derivatives pricing. Journal of Mathematical Finance, 10(02), 255–266. https://doi.org/10.4236/jmf.2020.102016
Zhang, N., Su, X., & Qi, S. (2023). An empirical investigation of multiperiod tail risk forecasting models. International Review of Financial Analysis, 86(102498), 102498. https://doi.org/10.1016/j.irfa.2023.102498