IDEAS home Printed from https://ideas.repec.org/a/spr/fininn/v10y2024i1d10.1186_s40854-024-00644-0.html
   My bibliography  Save this article

Forecasting relative returns for S&P 500 stocks using machine learning

Author

Listed:
  • Htet Htet Htun

    (University of Groningen)

  • Michael Biehl

    (University of Groningen)

  • Nicolai Petkov

    (University of Groningen)

Abstract

Forecasting changes in stock prices is extremely challenging given that numerous factors cause these prices to fluctuate. The random walk hypothesis and efficient market hypothesis essentially state that it is not possible to systematically, reliably predict future stock prices or forecast changes in the stock market overall. Nonetheless, machine learning (ML) techniques that use historical data have been applied to make such predictions. Previous studies focused on a small number of stocks and claimed success with limited statistical confidence. In this study, we construct feature vectors composed of multiple previous relative returns and apply the random forest (RF), support vector machine (SVM), and long short-term memory (LSTM) ML methods as classifiers to predict whether a stock can return 2% more than its index in the following 10 days. We apply this approach to all S&P 500 companies for the period 2017–2022. We assess performance using accuracy, precision, and recall and compare our results with a random choice strategy. We observe that the LSTM classifier outperforms RF and SVM, and the data-driven ML methods outperform the random choice classifier (p = 8.46e−17 for accuracy of LSTM). Thus, we demonstrate that the probability that the random walk and efficient market hypotheses hold in the considered context is negligibly small.

Suggested Citation

  • Htet Htet Htun & Michael Biehl & Nicolai Petkov, 2024. "Forecasting relative returns for S&P 500 stocks using machine learning," Financial Innovation, Springer;Southwestern University of Finance and Economics, vol. 10(1), pages 1-16, December.
  • Handle: RePEc:spr:fininn:v:10:y:2024:i:1:d:10.1186_s40854-024-00644-0
    DOI: 10.1186/s40854-024-00644-0
    as

    Download full text from publisher

    File URL: http://link.springer.com/10.1186/s40854-024-00644-0
    File Function: Abstract
    Download Restriction: no

    File URL: https://libkey.io/10.1186/s40854-024-00644-0?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    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:spr:fininn:v:10:y:2024:i:1:d:10.1186_s40854-024-00644-0. 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.

    We have no bibliographic references for this item. You can help adding them by using 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: Sonal Shukla or Springer Nature Abstracting and Indexing (email available below). General contact details of provider: http://www.springer.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.