Long Short-Term Memory Method: A Case Study of Pakistan Stock Market Volatility
DOI:
https://doi.org/10.58575/vpgec703Keywords:
Artificial neural network, LSTM, Pakistan stock market, Volatility, ForecastingAbstract
Forecasting volatility of stock market has an important role to minimize risk in f inancial markets. Investors track stock volatility to avoid market risk. Prediction of stock volatility gets attention of many investors and scholars. This study investigated Pakistan stock market volatility by employing Long Short-Term Memory method. Data contains eight macroeconomic variables named as Inflation, Money-Supply, Exchange-rate, Crude oil, Crop production, Gold prices, GDP growth and Unemployment. The data was obtained from World Development Indicators, the State Bank of Pakistan, the Pakistan Bureau of Statistics, and
Investing.com. The study covers the period from January 1, 2000 to June 30, 2023. The Long Short-Term Memory (LSTM) Method is type of recurrent neural network (RNN) and the information in matrices form of the order (5772, 14, 9). It can remember information over a long period of time due to its cell state. Three gates, namely forget gate, input gate, and output gate and one cell state which is used for saving of data. Forget gate is identified by ft and is responsible to forget information which is not necessary. Input gate is denoted by it output gate is denoted by ot and cell state is denoted by ct. The pivotal element within the
LSTM model is the cell state ct, which retains information over extended durations. The LSTM is used for prediction purposes. The results are produced using LSTM method in Spyder in python. The long short-term memory method has mean squared error of 0.01951.
Downloads
References
Abuein, Q. Q., Shatnawi, M. Q., Aljawarneh, E. Y., & Manasrah, A. (2024). Time series forecasting model for the stock market using LSTM and SVR. International Journal of Advance Soft Computing Applications, 16(1). https://doi.org/10.20944/preprints202409.1005.v1
Bhandari, H. N., Rimal, B., Pokhrel, N. R., Rimal, R., Dahal, K. R., & Khatri, R. K. (2022). Predicting stock market index using LSTM. Machine Learning with Applications, 9(2), 100320. https://doi.org/10.1016/j.mlwa.2022.100320
Bosworth, B., & Collin, S. (1999). Capital flows to developing economies: Implications for saving and investment. Brookings Papers on Economic Activity, 1999(1), 143–180.
Chen, Z. (2024). S&p 500 stock price prediction using LSTM. Highlights in Science, Engineering and Technology, 88, 57–63.
Gupta, P., Malik, S., Apoorb, K., Sameer, S. M., Vardhan, V., & Ragam, P. (2024). Stock market analysis using long short-term model. EAI Endorsed Transactions on Scalable Information Systems, 11(2), 1–6. https://publications.eai.eu/index.php/sis/article/view/4446
Khan, W., Ghazanfar, M., Azam, M., Karami, A., Alyoubi, K., & Alfakeeh, A. (2020). Stock market prediction using machine learning classifiers and social media, news. Journal of Ambient Intelligence and Humanized Computing, 13, 1–24.
Kim, H. Y., & Won, C. H. (2018). Forecasting the volatility of stock price index: A hybrid model integrating LSTM with multiple GARCH-type models. Expert Systems with Applications, 103, 25–37.
Parmar, I., Agarwal, N., Saxena, S., Arora, R., Gupta, S., & Dhiman, H. (2018). Stock market prediction using machine learning. First International Conference on Secure Cyber Computing and Communication (ICSCCC), 574-576.
Rather, A., Agarwal, A., & Sastry, V. (2015). Recurrent neural network and a hybrid model for prediction of stock returns. Expert Systems with Applications, 42(6), 3234–3241.
Stiglitz, J. (2000). The contributions of the economics of information to twentieth century economics. Quarterly Journal of Economics, 115(4), 1441–1478. https://doi.org/10.1162/003355300555015
Team, S. D. (2025). Spyder: The scientific Python development environment [Accessed: 2025-06-05].
Vaisla, K., & Bhatt, A. (2010). An analysis of the performance of artificial neural network technique for stock market forecasting. International Journal on Computer Science and Engineering, 2(6), 2104–2109.
van Rossum, G., & Fred L. Drake, J. (2009). Python 3 reference manual. Python Software Foundation. https://docs.python.org/3/reference/
Wang, Y. (2024). Research on stock price prediction based on LSTM modeling - A stock market as a case study. Highlights in Business, Economics and Management, 24, 1634–1640.
You, Y. (2024). Forecasting stock price: A deep learning approach with LSTM and hyperparameter optimization. Highlights in Science, Engineering and Technology, 85, 328–338. https://doi.org/10.54097/vfa8fe80
Zhang, J., Xiang, Y., Zou, Y., & Guo, S. (2024). Volatility forecasting of Chinese energy market: Which uncertainty have better performance? International Review of Financial Analysis, 91, 102952. https://doi.org/10.1016/j.irfa.2023.102952








