Comparing the Performance of LSTM, Random Forest, and ARIMA Models in Stock Price Prediction on the Tehran Stock Exchange

Comparing the Performance of LSTM, Random Forest, and ARIMA Models in Stock Price Prediction on the Tehran Stock Exchange

Arian Fathinejad1

1) Master’s student in Financial Engineering and Risk Management, Farabi Campus, University of Tehran, Qom, Iran,

IOI Code : AAHC-ABKAEB
Publication : National Conference on Management, Commercialization, Knowledge-Based Economy and Investment for Production(impeb.ir)
Abstract :
    Stock price forecasting is one of the most challenging issues in finance due to the nonlinear and highly volatile nature of capital markets. In this study, the performance of three forecasting models—the classical Autoregressive Integrated Moving Average (ARIMA) model, the Random Forest machine learning model, and the Long Short-Term Memory (LSTM) deep learning model—was compared in predicting stock prices on the Tehran Stock Exchange. To ensure a fair comparison, all three models were evaluated using a rolling one-step-ahead walk-forward approach, such that each model had access only to actual observations up to the previous day at each forecasting step. Daily data for four actively traded stocks (Shapna, Kegel, Fameli, and Rampna) were cleaned and adjusted to remove the effects of corporate capital increases, then divided into training (80%) and testing (20%) sets using a 60-day rolling window. The models were assessed using RMSE, MAE, MAPE, and R², as well as the Diebold–Mariano significance test, alongside a naive random walk benchmark model. Contrary to common expectations, the results showed that under the one-step-ahead evaluation setting, the ARIMA model significantly outperformed both LSTM (R² = 0.847) and Random Forest (R² = −0.306), achieving an average R² of 0.968 and a MAPE of 2.01%. However, comparison with the benchmark model revealed that ARIMA significantly outperformed the naive random walk forecast in only two out of the four stocks, suggesting that a substantial portion of ARIMA’s predictive accuracy stemmed from the strong intrinsic autocorrelation of stock prices rather than from superior modeling complexity. The findings indicate that, in a one-step-ahead forecasting horizon, complex machine learning and deep learning models do not exhibit a consistent advantage over simpler time-series models in forecasting stock prices on the Tehran Stock Exchange.

Keywords : stock price forecasting one step ahead evaluation lstm random forest arima tehran stock exchange