IDEAS home Printed from https://ideas.repec.org/a/gam/jjrfmx/v17y2024i7p293-d1431830.html
   My bibliography  Save this article

Assessing the Predictive Power of Transformers, ARIMA, and LSTM in Forecasting Stock Prices of Moroccan Credit Companies

Author

Listed:
  • Karima Lahboub

    (Laboratory of Research and Studies in Management, Entrepreneurship and Finance (LAREMEF), Nation School of Commerce and Management of Fez, Sidi Mohamed Ben Abdellah University, Fes 30050, Morocco)

  • Mimoun Benali

    (Laboratory of Research and Studies in Management, Entrepreneurship and Finance (LAREMEF), Nation School of Commerce and Management of Fez, Sidi Mohamed Ben Abdellah University, Fes 30050, Morocco)

Abstract

In this paper, we present a data-driven approach to forecasting stock prices in the Moroccan Stock Exchange. Our study tests three predictive models: ARIMA, LSTM, and transformers, applied to the historical stock price data of three prominent credit companies (EQD, LES, and SLF) listed on the Casablanca Stock Exchange. We carefully selected and optimized hyperparameters for each model to achieve optimal performance. Our results showed that the LSTM model achieved high accuracy, with R-squared values exceeding 0.99 for EQD and LES and surpassing 0.95 for SLF. These findings highlighted the effectiveness of LSTM in stock price forecasting. Our study offers practical insights for traders and investors in the Moroccan Stock Exchange, demonstrating how predictive modeling can aid in making informed decisions. This research contributes to advancing stock market forecasting in Morocco, providing valuable tools for navigating the Casablanca Stock Exchange.

Suggested Citation

  • Karima Lahboub & Mimoun Benali, 2024. "Assessing the Predictive Power of Transformers, ARIMA, and LSTM in Forecasting Stock Prices of Moroccan Credit Companies," JRFM, MDPI, vol. 17(7), pages 1-16, July.
  • Handle: RePEc:gam:jjrfmx:v:17:y:2024:i:7:p:293-:d:1431830
    as

    Download full text from publisher

    File URL: https://www.mdpi.com/1911-8074/17/7/293/pdf
    Download Restriction: no

    File URL: https://www.mdpi.com/1911-8074/17/7/293/
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Ahmed, Abdullahi D. & Huo, Rui, 2021. "Volatility transmissions across international oil market, commodity futures and stock markets: Empirical evidence from China," Energy Economics, Elsevier, vol. 93(C).
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Mensi, Walid & Rehman, Mobeen Ur & Vo, Xuan Vinh, 2022. "Spillovers and diversification benefits between oil futures and ASEAN stock markets," Resources Policy, Elsevier, vol. 79(C).
    2. Roberto Cellini & Tiziana Cuccia & Johan Lyrvall, 2023. "On the price dynamics of non-fungible tokens: The ‘Bored Apes’ case," PLOS ONE, Public Library of Science, vol. 18(11), pages 1-20, November.
    3. Giang Thi Huong Vuong & Manh Huu Nguyen & Khanh Hoang, 2024. "Oil price uncertainty, oil pricing reform, and corporate profitability: The case of China," PLOS ONE, Public Library of Science, vol. 19(2), pages 1-25, February.
    4. Sen, Chitrakalpa & Chakrabarti, Gagari, 2024. "Beyond the glitter: An empirical assessment of the true risk and hedging role of precious metals," Resources Policy, Elsevier, vol. 96(C).
    5. Shuo YANG, 2025. "Identifying Multiple Bubbles and Time-Varying Contagion Effect between Iron Ore and China's Stock Markets: A New Recursive Evolving Test," Journal for Economic Forecasting, Institute for Economic Forecasting, vol. 0(1), pages 81-100, April.
    6. Elgammal, Mohammed M. & Ahmed, Walid M.A. & Alshami, Abdullah, 2021. "Price and volatility spillovers between global equity, gold, and energy markets prior to and during the COVID-19 pandemic," Resources Policy, Elsevier, vol. 74(C).
    7. Saif-Alyousfi, Abdulazeez Y.H., 2025. "Energy shocks and stock market returns under COVID-19: New insights from the United States," Energy, Elsevier, vol. 316(C).
    8. Banerjee, Ameet Kumar & Dionisio, Andreia & Sensoy, Ahmet & Goodell, John W., 2024. "Extant linkages between Shanghai crude oil and US energy futures: Insights from spillovers of higher-order moments," Energy Economics, Elsevier, vol. 136(C).
    9. Tong, Yuan & Wan, Ning & Dai, Xingyu & Bi, Xiaoyi & Wang, Qunwei, 2022. "China's energy stock market jumps: To what extent does the COVID-19 pandemic play a part?," Energy Economics, Elsevier, vol. 109(C).
    10. Yin, Libo & Cao, Hong & Xin, Yu, 2024. "Impact of crude oil price innovations on global stock market volatility: Evidence across time and space," International Review of Financial Analysis, Elsevier, vol. 96(PB).
    11. Wang, Kai-Hua & Su, Chi-Wei & Xiao, Yidong & Liu, Lu, 2022. "Is the oil price a barometer of China's automobile market? From a wavelet-based quantile-on-quantile regression perspective," Energy, Elsevier, vol. 240(C).
    12. Muñoz Mendoza, Jorge A. & Veloso Ramos, Carmen L. & Delgado Fuentealba, Carlos L. & Cornejo Saavedra, Edinson E. & Sepúlveda Yelpo, Sandra M., 2024. "Stock, foreign exchange and commodity markets linkages: Implications for risk diversification and portfolio management," Global Finance Journal, Elsevier, vol. 63(C).
    13. Coskun, Merve & Taspinar, Nigar, 2022. "Volatility spillovers between Turkish energy stocks and fossil fuel energy commodities based on time and frequency domain approaches," Resources Policy, Elsevier, vol. 79(C).
    14. Mensi, Walid & Aslan, Aylin & Vo, Xuan Vinh & Kang, Sang Hoon, 2023. "Time-frequency spillovers and connectedness between precious metals, oil futures and financial markets: Hedge and safe haven implications," International Review of Economics & Finance, Elsevier, vol. 83(C), pages 219-232.
    15. Mensi, Walid & Hanif, Waqas & Vo, Xuan Vinh & Choi, Ki-Hong & Yoon, Seong-Min, 2023. "Upside/Downside spillovers between oil and Chinese stock sectors: From the global financial crisis to global pandemic," The North American Journal of Economics and Finance, Elsevier, vol. 67(C).
    16. Xian Xi & Xiangyun Gao & Xiaotian Sun & Huiling Zheng & Congcong Wu, 2024. "Dynamic analysis and application of network structure control in risk conduction in the industrial chain," Palgrave Communications, Palgrave Macmillan, vol. 11(1), pages 1-13, December.
    17. Zhu, Yanli & Yang, Xian & Zhang, Chuanhai & Liu, Sihan & Li, Jiayi, 2024. "Asymmetric multi-scale systemic risk spillovers across international commodity futures markets: The role of infectious disease uncertainty," Journal of Commodity Markets, Elsevier, vol. 36(C).
    18. Szczygielski, Jan Jakub & Charteris, Ailie & Obojska, Lidia, 2023. "Do commodity markets catch a cold from stock markets? Modelling uncertainty spillovers using Google search trends and wavelet coherence," International Review of Financial Analysis, Elsevier, vol. 87(C).
    19. Xi, Xian & Gao, Xiangyun & Zhong, Weiqiong, 2025. "How risk spillover network structure affects VaR: A study using complex networks and quantile regression," International Review of Economics & Finance, Elsevier, vol. 98(C).
    20. Maria Ghani & Feng Ma & Dengshi Huang, 2024. "Forecasting the Asian stock market volatility: Evidence from WTI and INE oil futures," International Journal of Finance & Economics, John Wiley & Sons, Ltd., vol. 29(2), pages 1496-1512, April.

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:gam:jjrfmx:v:17:y:2024:i:7:p:293-:d:1431830. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: MDPI Indexing Manager (email available below). General contact details of provider: https://www.mdpi.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.