Bahaa Aly, Tarek and Ahmed, El-Masry (2024): Directional Macroeconomic Forecasting: Robustness of KNN versus Flexibility of ANN and SVM on Limited Data.
Preview |
PDF
MPRA_paper_127925.pdf Download (784kB) | Preview |
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.
| Item Type: | MPRA Paper |
|---|---|
| Original Title: | Directional Macroeconomic Forecasting: Robustness of KNN versus Flexibility of ANN and SVM on Limited Data |
| Language: | English |
| Keywords: | Classifier, ANN, SVM, KNN, Equity Market, Foreign Exchange Rate, Inflation, Policy Rate, GDP, Feature Importance |
| Subjects: | C - Mathematical and Quantitative Methods > C3 - Multiple or Simultaneous Equation Models ; Multiple Variables > C32 - Time-Series Models ; Dynamic Quantile Regressions ; Dynamic Treatment Effect Models ; Diffusion Processes ; State Space Models |
| Item ID: | 129067 |
| Depositing User: | Dr. Tarek Bahaa Aly |
| Date Deposited: | 15 May 2026 17:30 |
| Last Modified: | 15 May 2026 17:30 |
| References: | Nti, I., Adekoya, A., & Weyori, B. (2020). A comprehensive evaluation of ensemble learning for stock market prediction. Journal of Big Data, 7, 20. Retrieved from https://journalofbigdata.springeropen.com/articles/10.1186/s40537-020-00299-5 Ahmed, R., Vveinhardt, J., Streimikiene, D., & Fayyaz, M. (2017). Multivariate Granger Causality Between Macro Variables and KSE 100 Index: Evidence from Johansen cointegration and Toda & Yamamoto Causality. Economic Research, 30(1), 1497–1521. Retrieved from https://www.tandfonline.com/doi/full/10.1080/1331677X.2017.1340176 Alotaibi, S. (2021). Ensemble technique with optimal feature selection for Saudi stock market prediction: A novel hybrid red deer-grey algorithm. IEEE Access, 9. Retrieved from https://www.researchgate.net/publication/350903773_Ensemble_Technique_With_Optimal_Feature_Selection_for_Saudi_Stock_Market_Prediction_A_Novel_Hybrid_Red_Deer-Grey_Algorithm Ang , A., & Piazzesi, M. (2003). A no-arbitrage vector autoregression of term structure dynamics with macroeconomics and latent variables. Journal of Monetary Economics, 50(4), 745-787. Retrieved from https://www.sciencedirect.com/science/article/pii/S0304393203000321 Bal, C., & Demir, S. (2017). A comparative study of artificial neural network models for forecasting USD/EUR-GBP-JPY-NOK exchange rates. Journal of Emerging Issues in Economics, Finance and Banking, 6(2), 2248-2259. Retrieved from http://globalbizresearch.org/economics/images/files/87431_N706_JEIEFB_Cagatay%20Bal_Serdar%20Demir.pdf Ballings, M., Poel, D.-V.-d., Hespeels, N., & Gryp, R. (2015). Evaluating multiple classifiers for stock price direction prediction. Expert Systems with Applications, 42(20), 7046-7056. Retrieved from https://www.sciencedirect.com/science/article/abs/pii/S0957417415003334 Breiman , L. (2001). Random forests. Machine Learning, 45(1), 5–32. Retrieved from https://link.springer.com/article/10.1023/A:1010933404324 Cortes, C., & Vapnik, V. (1995). Support-vector networks. Machine Learning, 20(3), 273–297. Retrieved from https://link.springer.com/article/10.1007/BF00994018 Djuranovik, L. (2014). The Indonesian Macroeconomy And The Yield Curve: A Dynamic Latent Factor Approach. Journal of Asian Economics, 34, 1-15. Retrieved from https://www.sciencedirect.com/science/article/pii/S1049007814000396 Estrella, A., Rodrigues, A., & Schich, S. (2003). How stable is the predictive power of the yield curve? evidence from germany and the united states. The Review of Economics and Statistics, 85(3), 629-644. Retrieved from https://direct.mit.edu/rest/article/85/3/629/57434/How-Stable-is-the-Predictive-Power-of-the-Yield Fiori, L. (2020). Distance metrics and K-Nearest Neighbor (KNN). Retrieved from Medium.com: https://medium.com/@luigi.fiori.lf0303/distance-metrics-and-k-nearest-neighbor-knn-1b840969c0f4 Fisher, A., Rudin, C., & Dominici, F. (2019). All models are wrong, but many are useful: Learning a variable's importance by studying an entire class of prediction models simultaneously. Journal of Machine Learning Research, 20(177), 1−81. Retrieved from https://jmlr.org/papers/v20/18-760.html Fromentin, V. (2022). Time-varying causality between stock prices and macroeconomic fundamentals: Connection or disconnection? Finance Research Letters, 49. Retrieved from https://www.sciencedirect.com/science/article/abs/pii/S154461232200304X Harrison, O. (2018). Machine Learning Basics with the K-Nearest Neighbors Algorithm. Retrieved from Medium.com: https://medium.com/data-science/machine-learning-basics-with-the-k-nearest-neighbors-algorithm-6a6e71d01761 Huang, W., Nakamori, Y., & Wang, S. (2005). Forecasting stock market movement direction with support vector machine. Computers & Operations Research, 32(10), 2513–2522. Retrieved from https://www.sciencedirect.com/science/article/abs/pii/S0305054804000681 Jahn, M. (2018). Artificial neural network regression models: Predicting GDP growth. Hamburg Institute of International Economics Working Paper. Retrieved from https://update.hwwi.org/fileadmin/hwwi/Publikationen/Publikationen_PDFs_2018/HWWI_ResearchPaper_185.pdf Kaya, H. (2013). The yield curve and macroeconomic variables in the presence of policy change: Evidence from Turkey. Economic Modelling, 32, 100-107. Retrieved from https://www.sciencedirect.com/science/article/pii/S026499931300045X Kim, K. (2003). Financial time series forecasting using support vector machines. Neurocomputing, 55, 307–319. Retrieved from https://c.mql5.com/forextsd/forum/35/kim2003.pdf Kingma, D., & Ba, J. (2017). Adam: A Method for Stochastic Optimization. arXiv:1412.6980. Retrieved from https://arxiv.org/abs/1412.6980 Maccarrone, G., Morelli, G., & Spadaccini, S. (2021). GDP forecasting: machine learning, linear or autoregression. Frontiers in Artificial Intelligence, 4. Retrieved from https://www.frontiersin.org/articles/10.3389/frai.2021.757864/full McNelis, P. (2005). Neural networks in finance: Gaining predictive edge. United Kingdom: Elsevier Academic Press. Plíhal, T. (2016). Granger Causality between Stock Market and Macroeconomic Indicators: Evidence from Germany. Acta Universitatis Agriculturae et Silviculturae Mendelianae Brunensis, 64(6), 2101-2108. Retrieved from https://ideas.repec.org/a/mup/actaun/actaun_2016064062101.html Priambodo, B., Rahayu, S., Hazidar, A.-H., Naf’an, E., Masril, M., Handriani, I., . . . Jumaryadi, Y. (2019). Predicting GDP of Indonesia using K-nearest neighbour regression. Journal of Physics, 1339. Retrieved from https://iopscience.iop.org/article/10.1088/1742-6596/1339/1/012040 Rodríguez-Vargas, A. (2020). Forecasting Costa Rican inflation with machine learning methods. American Journal of Central Banking, 1(1). Retrieved from https://ideas.repec.org/a/eee/lajcba/v1y2020i1s2666143820300120.html Shareef, H., & Shijin, S. (2017). The term structure of interest rates and macroeconomic factors: Evidence from Indian financial market. Borsa Istanbul Review, 17(4), 249-256. Retrieved from https://www.sciencedirect.com/science/article/pii/S221484501630120X Simonyan, K., Vedaldi, A., & Zisserman, A. (2014). Deep Inside Convolutional Networks Visualising Image Classification Models and Saliency Maps. arXiv:1312.6034. Retrieved from https://arxiv.org/abs/1312.6034 Suhaibu, I., Harvey, S., & Amidu, M. (2017). The impact of monetary policy on stock market performance: Evidence from twelve (12) African countries. Research in International Business and Finance, 42, 1372-1382. Retrieved from https://www.sciencedirect.com/science/article/abs/pii/S0275531916304792 Tkacz, G. (2001). Neural network forecasting of canadian GDP growth. International Journal of Forecasting, 17(1), 57-69. Retrieved from https://www.sciencedirect.com/science/article/pii/S0169207000000637 Zhao, M., & Chen, J. (2016). Improvement and Comparison of Weighted k Nearest Neighbors Classifiers for Model Selection. Journal of Software Engineering, 10(1), 109-118. Retrieved from https://www.researchgate.net/publication/284174726_Improvement_and_Comparison_of_Weighted_k_Nearest_Neighbors_Classifiers_for_Model_Selection |
| URI: | https://mpra.ub.uni-muenchen.de/id/eprint/129067 |

