Answers are grounded in this paper and cite their sources.
Accurate stock price prediction is challenging due to the dynamic, non-linear, and noisy nature of financial markets. Traditional methods, such as technical and fundamental analysis, are often subjective and limited. However, machine learning techniques offer significant potential for improved forecasting. This study compared the performance of Artificial Neural Network (ANN) and Random Forest (RF) models in predicting the next-day closing stock prices for five companies listed on the Nairobi Securities Exchange (NSE-20 Index): British American Tobacco Kenya Ltd (BAT), East African Breweries Ltd (EABL), Kenya Commercial Bank (KCB), Equity Group Holdings (EQTY), and Safaricom (SCOM). The study utilized a longitudinal financial dataset of 6,176 daily trading observations, spanning five years from January 2, 2020, to January 2, 2025. The implementation of the predictive models was based on three historical lagging features (Lag t-1, Lag t-2, and Lag t-3) and a 5-day rolling moving average (MA5) which were created to capture localized momentum. Furthermore, a strict chronological data split involving 80% observations (n =4,941) for training partition and 20% observations (n =1,235) for testing partition was enforced to minimize data leakage and enhance model evaluation. The test partition was then used to evaluate model performance using Root Mean Square Error (RMSE), Mean Absolute Percentage Error (MAPE), Mean Bias Error (MBE), and the coefficient of determination (R2). The findings depicted high out-of-sample goodness-of-fit metrics, with R 2 values consistently exceeding 0.9300 for both ANN and RF models across all five equities. The ANN model tracking KCB Group achieved the highest R 2 of 0.9881. For BAT, the ANN achieved a lower RMSE of 4.48 (MAPE = 0.61%); however, the RF model deviated by 5.93 (MAPE = 1.01%). Moreover, the ANN model achieved a significantly lower error rate for SCOM (RMSE = 0.31) outperforming the RF model (RMSE = 0.38). The RF model depicted a highly persistent, negative bias across all equities except EABL, peaking at MBE of 0.32 for BAT Kenya. However, the ANN model depicted a mixed directional bias error, generating a positive bias of 0.19 for BAT (MBE = 0.19), while minimal negative bias errors across the remaining four companies. The persistent out-of-sample predictive achievements decisively reject the strict application of the semi-strong form of the Efficient Market Hypothesis (EMH) on the NSE, instead validating the use of the Adaptive Market Hypothesis (AMH). This implies persistent price predictability at the NSE, therefore, necessitating the need for stronger marketing strategies, improvement in investor sentiment, and enhancement of disclosure frameworks.
No takes yet. Share an insight, caveat, or question.
Chepngetich et al. (2026) studied this question.
Synapse has enriched 10 related papers. Consider them for comparative context: