Research Article

Stock Forecasting Based on Random Forest and ARIMA Models

Tianrui Cai*
Department of Mathematics, Hangzhou Normal University, Hangzhou, China

* Corresponding author: [email protected]

Abstract

In this paper, a Random Forest model and an ARIMA model are established to predict stock closing prices. The data from six Chinese stocks—Shandong Gold Mining, WanYi Technology, iFLYTEK, Space-Time Technology, TianYue Advanced Materials Technology, and Harmontronics Intelligent Technology—spanning from January 1, 2024, to December 30, 2024, are used. The results show that these two models are more accurate in short-term stock price prediction. By combining and comparing these two models, we conclude that the Random Forest model predicts the next day's closing price highly accurately and has obvious advantages in ultra-short-term trading. This offers insights for investors and related researchers in pursuit of short-term profits.

Keywords: closing price of stocks; time series; Random Forest model; ARIMA model
Published: April 24, 2025
DOI: 10.54254/2753-8818/2025.CH22310
Volume: TNS Vol.101
pp. 118-128
Download PDF

References

  1. Fama, E. F. and French, K. R. (1988) Dividend yields and expected stock returns[J]. J Finance Econ, 22(1), 3-25.
  2. Xu, H., Xu, B. and Xu, K. (2020) A Survey on the Application of Machine Learning in Stock Prediction[J]. Computer Engineering and Applications, 56(12), 19 - 24.
  3. Zhao, T., Han, Y., Yang, M., Ren, D., Chen, Y., Wang, Y. and Liu, J. (2021) A Survey on Time Series Data Prediction Methods Based on Machine Learning[J]. Journal of Tianjin University of Science and Technology, 36(05), 1 - 9.
  4. Liu, M., Lang, R. and Cao, Y. (2015) The Number of Trees in Random Forest[J]. Computer Engineering and Applications, 51(05), 126-131.
  5. Mohammad, Z., Okke, B., Marzieh, F. and Reinhard, H. (2021) Ensemble machine learning paradigms in hydrology: A review [J]. Journal of Hydrology, 598, 126266.
  6. Gao, X., Ruan, Z., Liu, J., Chen, Q. and Yuan, Y. (2022) Analysis of atmospheric pollutants and meteorological factors on concentration and temporal variations in Harbin[J]. Atmosphere, 13(9), 1426-1426.
  7. Tao, Y. and Du, J. (2019) Temperature prediction using long short term memory network based on Random Forest[J]. Computer Engineering and Design, 40(03), 737-743.
  8. Shen, P., Jin, Q., Zhou, Y., Xu, R. and Huang, H. (2022) Spatial-temporal pattern and driving factors of surface ozone concentrations in Zhejiang Province[J]. Research of Environmental Sciences, 35(09), 2136-2146.
  9. Lin, N. and Qin, J. (2018) Forecast of A-share stock change based on Random Forest[J].Journal of Shanghai University of Science and Technology, 40(03), 267-273+301.
  10. Zhang, X., Zhang, Z. and Zhan, H. (2005) Identification of multiple damaged locations in structures based on curvature mode and flexibility curvature[J]. Journal of Wuhan University of Technology, 08, 35-37+55.
  11. Ahmed, S., Karimuzzaman, M. and Hossain, M. M. (2021) Modeling of Mean Sea Level of Bay of Bengal: A Comparison between ARIMA and Artificial Neural Network[J]. International Journal of Tomography & Simulation™, 34 (1), 31-40.
  12. Li, Y. and Cheng, Z. (2011) Application of Time Series Models in Stock Price Forecasting [J]. Modernization of Commerce, 33, 61-63.
  13. Huang, M. (2023) Empirical Study on Stock Price Forecasting Based on ARIMA Model[J]. Neijiang Science & Technology, 44 (03), 61-62
  14. Wu, F., Cattani, C., Song, W. and Zio, E. (2020) Fractional ARIMA with an improved cuckoo search optimization for the efficient Short-term power load forecasting [J]. Alexandria Engineering Journal, 59, 3111-3118.
  15. Li, H., Song, D., Kong, J., Song, Y. and Chang, H. (2024) Evaluation of hyperparameter optimization techniques for traditional machine learning models [J].Computers & Science, 51(08), 242-255.