IDEAS home Printed from https://ideas.repec.org/p/pra/mprapa/129067.html

Directional Macroeconomic Forecasting: Robustness of KNN versus Flexibility of ANN and SVM on Limited Data

Author

Listed:
  • Bahaa Aly, Tarek
  • Ahmed, El-Masry

Abstract

In this paper, we predicted the directional movement (up or down) of five macroeconomic variables: the equity market (EQUITY), foreign exchange rate (FX), central bank policy rate (POLRATE), GDP growth rate (GDP), and inflation rate (INF), using K-Nearest Neighbors (KNN), Artificial Neural Networks (ANN), and Support Vector Machine (SVM) classifiers, compared with a logistic regression model included as a linear benchmark. The analysis was conducted on monthly data from eight diverse markets across different geographical regions (US, UK, Mexico, Brazil, Egypt, South Africa, Indonesia, China) over forecast horizons of 1, 3, and 6 months. Our aim was to compare the predictive performance of these three fundamentally different classifiers and identify common patterns in macroeconomic variable behavior. We found that the standard KNN classifier significantly outperformed SVM and ANN, achieving the highest average out-of-sample directional accuracy. Our analysis revealed that the optimal number of neighbors, K, did not materially affect out-of-sample accuracy and remained relatively stable across forecast horizons. Feature importance analysis showed that KNN relied on a few strong signals, such as the yield curve level, while SVM and ANN distributed importance weights more broadly. The highest average prediction accuracies were achieved by the equity market and FX, while the US and China recorded the strongest country-level performance. In addition, inflation and the equity market exhibited the highest predictive power. Our results demonstrated the continued value of simple, robust models like KNN for macroeconomic directional forecasting, particularly when compared to more complex models such as SVM and ANN on limited panel data.

Suggested Citation

  • Bahaa Aly, Tarek & Ahmed, El-Masry, 2024. "Directional Macroeconomic Forecasting: Robustness of KNN versus Flexibility of ANN and SVM on Limited Data," MPRA Paper 129067, University Library of Munich, Germany.
  • Handle: RePEc:pra:mprapa:129067
    as

    Download full text from publisher

    File URL: https://mpra.ub.uni-muenchen.de/129067/1/MPRA_paper_127925.pdf
    File Function: original version
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. K. Hassan Shareef & Santhakumar Shijin, 2017. "The term structure of interest rates and macroeconomic factors: Evidence from Indian financial market," Borsa Istanbul Review, Research and Business Development Department, Borsa Istanbul, vol. 17(4), pages 249-256, December.
    2. Vincent Fromentin & Turki Alshammari, 2022. "Time-varying causality between stock prices and macroeconomic fundamentals: Connection or disconnection?," Post-Print hal-03721792, HAL.
    3. Rizwan Raheem Ahmed & Jolita Vveinhardt & Dalia Streimikiene & Majid Fayyaz, 2017. "Multivariate Granger causality between macro variables and KSE 100 index: evidence from Johansen cointegration and Toda & Yamamoto causality," Economic Research-Ekonomska Istraživanja, Taylor & Francis Journals, vol. 30(1), pages 1497-1521, January.
    4. Arturo Estrella & Anthony P. Rodrigues & Sebastian Schich, 2003. "How Stable is the Predictive Power of the Yield Curve? Evidence from Germany and the United States," The Review of Economics and Statistics, MIT Press, vol. 85(3), pages 629-644, August.
    5. Tomáš Plíhal, 2016. "Granger Causality between Stock Market and Macroeconomic Indicators: Evidence from Germany," Acta Universitatis Agriculturae et Silviculturae Mendelianae Brunensis, Mendel University Press, vol. 64(6), pages 2101-2108.
    6. Djuranovik, Leslie, 2014. "The Indonesian macroeconomy and the yield curve: A dynamic latent factor approach," Journal of Asian Economics, Elsevier, vol. 34(C), pages 1-15.
    7. Jahn, Malte, 2018. "Artificial neural network regression models: Predicting GDP growth," HWWI Research Papers 185, Hamburg Institute of International Economics (HWWI).
    8. Ang, Andrew & Piazzesi, Monika, 2003. "A no-arbitrage vector autoregression of term structure dynamics with macroeconomic and latent variables," Journal of Monetary Economics, Elsevier, vol. 50(4), pages 745-787, May.
    9. Tkacz, Greg, 2001. "Neural network forecasting of Canadian GDP growth," International Journal of Forecasting, Elsevier, vol. 17(1), pages 57-69.
    10. Vincent Fromentin, 2022. "Time-varying causality between stock prices and macroeconomic fundamentals: Connection or disconnection?," Post-Print hal-04206765, HAL.
    11. Fromentin, Vincent, 2022. "Time-varying causality between stock prices and macroeconomic fundamentals: Connection or disconnection?," Finance Research Letters, Elsevier, vol. 49(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. Bahaa Aly, Tarek, 2025. "Nonlinear Macroeconomic Granger Causality: An ANN Input Occlusion Approach on MSSA-Denoised Data," MPRA Paper 125453, University Library of Munich, Germany.
    2. Ibarra-Ramírez Raúl, 2021. "The Yield Curve as a Predictor of Economic Activity in Mexico: The Role of the Term Premium," Working Papers 2021-07, Banco de México.
    3. Xu, Yongdeng & Guan, Bo & Lu, Wenna & Heravi, Saeed, 2024. "Macroeconomic shocks and volatility spillovers between stock, bond, gold and crude oil markets," Energy Economics, Elsevier, vol. 136(C).
    4. Mohamad, Azhar & Fromentin, Vincent, 2023. "Herd and causality dynamics between energy commodities and ethical investment: Evidence from the different phases of the COVID-19 pandemic," Energy Economics, Elsevier, vol. 126(C).
    5. Xiong, Youlin & Shen, Jun & Yoon, Seong-Min & Dong, Xiyong, 2024. "Macroeconomic determinants of the long-term correlation between stock and exchange rate markets in China: A DCC-MIDAS-X approach considering structural breaks," Finance Research Letters, Elsevier, vol. 61(C).
    6. Ahmed, Walid M.A. & Sleem, Mohamed A.E., 2023. "Short- and long-run determinants of the price behavior of US clean energy stocks: A dynamic ARDL simulations approach," Energy Economics, Elsevier, vol. 124(C).
    7. Mi, Michelle Xuan & Masih, Rumi, 2025. "How resilient are PE/VC returns to real shocks?," Global Finance Journal, Elsevier, vol. 68(C).
    8. Long, Shaobo & Xue, Ning & Zhang, Yuan, 2025. "The divergence of China’s prices under economic policy uncertainty shock: A time-varying perspective," The North American Journal of Economics and Finance, Elsevier, vol. 76(C).
    9. Azimli, Asil & Kalmaz, Demet Beton, 2025. "The impact of Russia’s Geopolitical Risk on stock markets’ high-moment risk," Economic Systems, Elsevier, vol. 49(1).
    10. Martina Halouskov'a & v{S}tefan Ly'ocsa, 2025. "Forecasting U.S. equity market volatility with attention and sentiment to the economy," Papers 2503.19767, arXiv.org.
    11. David C. Wheelock & Mark E. Wohar, 2009. "Can the term spread predict output growth and recessions? a survey of the literature," Review, Federal Reserve Bank of St. Louis, vol. 91(Sep), pages 419-440.
    12. Leo Krippner, 2005. "A New Framework for Yield Curve, Output and Inflation Relationships," Working Papers in Economics 05/07, University of Waikato.
    13. Leo Krippner & Michelle Lewis, 2018. "Real-time forecasting with macro-finance models in the presence of a zero lower bound," Reserve Bank of New Zealand Discussion Paper Series DP2018/04, Reserve Bank of New Zealand.
    14. Duarte, Agustin & Venetis, Ioannis A. & Paya, Ivan, 2005. "Predicting real growth and the probability of recession in the Euro area using the yield spread," International Journal of Forecasting, Elsevier, vol. 21(2), pages 261-277.
    15. Venetis, Ioannis A. & Paya, Ivan & Peel, David A., 2003. "Re-examination of the predictability of economic activity using the yield spread: a nonlinear approach," International Review of Economics & Finance, Elsevier, vol. 12(2), pages 187-206.
    16. Rajabrata Banerjee & Tony Cavoli & Ron McIver & Shannon Meng & John K. Wilson, 2023. "Predicting long‐run risk factors of stock returns: Evidence from Australia," Australian Economic Papers, Wiley Blackwell, vol. 62(3), pages 377-395, September.
    17. Anshul Kumar & Agnirup Sarkar & Bodhisattva Sengupta, 2024. "Monetary and Fiscal Policy Impacts on the Indian Sovereign Bond Market: A VAR Approach," South Asian Journal of Macroeconomics and Public Finance, , vol. 13(2), pages 143-168, December.
    18. Abdymomunov, Azamat, 2013. "Predicting output using the entire yield curve," Journal of Macroeconomics, Elsevier, vol. 37(C), pages 333-344.
    19. Guidolin, Massimo & Ono, Sadayuki, 2006. "Are the dynamic linkages between the macroeconomy and asset prices time-varying?," Journal of Economics and Business, Elsevier, vol. 58(5-6), pages 480-518.
    20. Shuping Shi & Peter C. B. Phillips & Stan Hurn, 2018. "Change Detection and the Causal Impact of the Yield Curve," Journal of Time Series Analysis, Wiley Blackwell, vol. 39(6), pages 966-987, November.

    More about this item

    Keywords

    ;
    ;
    ;
    ;
    ;
    ;
    ;
    ;
    ;
    ;

    JEL classification:

    • C32 - Mathematical and Quantitative Methods - - Multiple or Simultaneous Equation Models; Multiple Variables - - - Time-Series Models; Dynamic Quantile Regressions; Dynamic Treatment Effect Models; Diffusion Processes; State Space Models

    Statistics

    Access and download statistics

    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:pra:mprapa:129067. 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: Joachim Winter (email available below). General contact details of provider: https://edirc.repec.org/data/vfmunde.html .

    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.