EKF-LSTM for Hospital Pharmaceutical Demand Forecasting: A One-Step Ahead Hybrid Framework
DOI:
https://doi.org/10.15575/join.v11i2.1808Keywords:
Diebold-Mariano test, Drug sales prediction, Extended Kalman Filter, Hospital Drug Sales, Long Short-Term Memory, PatchTST, Time Series DataAbstract
Accurate pharmaceutical demand forecasting in hospitals is essential for optimization, as inaccurate demand predictions lead to drug shortages, overstocking, and increased operational costs. Although the integration of the Extended Kalman Filter (EKF) with Long Short-Term Memory (LSTM) has shown potential in various domains, its application to hospital pharmaceutical sales prediction remains underexplored. This study proposes a hybrid EKF-LSTM model that leverages recursive state estimation to stabilize learning during zero-demand periods, effectively handling non-linear and zero-inflated drug sales time-series. The model was evaluated on eight drug commodities (2022–2024) using time-series cross-validation with one-step-ahead forecasting and compared against LSTM, GRU, Random Forest, XGBoost, PatchTST, and ARIMA using MAE, MSE, RMSE and MAPE. EKF-LSTM achieved the lowest aggregate error (MAE: 78.33 ± 54.12 units; RMSE: 95.67 ± 68.45 units), yielding 51.7% lower RMSE than LSTM, the second-best method. For items with continuous demand, MAPE was as low as 18.16%. A Diebold-Mariano test confirmed a statistically significant superiority over PatchTST (p = 0.018). These findings indicate that the EKF-LSTM hybrid model provides a robust solution for hospital pharmaceutical inventory planning, reducing stockouts and overstocking while improving overall operational efficiency.
References
[1] K. P. Fourkiotis and A. Tsadiras, “Applying machine learning and statistical forecasting methods for enhancing pharmaceutical sales predictions,” Forecasting, vol. 6, no. 1, pp. 170–186, 2024, doi: 10.3390/forecast6010010.
[2] T. S. De, M. Karthikeya, and S. Bhattacharya, “A non-linear Lasso and explainable LSTM approach for estimating tail risk interconnectedness,” Appl. Econ., vol. 57, no. 41, pp. 6433–6447, 2024, doi: 10.1080/00036846.2024.2385747.
[3] N. El Assri, M. A. Jallal, S. Chabaa, and A. Zeroual, “Enhancing building energy consumption prediction using LSTM, Kalman filter, and continuous wavelet transform,” Sci. Afr., vol. 27, p. e02560, Mar. 2025, doi: 10.1016/j.sciaf.2025.e02560.
[4] H. Hewamalage, C. Bergmeir, and K. Bandara, “Recurrent neural networks for time series forecasting: Current status and future directions,” Int. J. Forecast., vol. 37, no. 4, pp. 1381–1410, Dec. 2020, doi: 10.1016/j.ijforecast.2020.06.008.
[5] Z. Ke, H. Duan, and S. Qian, “Interpretable mixture of experts for time series prediction under recurrent and non-recurrent conditions,” arXiv preprint arXiv: 2409.03282, Sep. 2024, Sep. 2024, [Online]. Available: http://arxiv.org/abs/2409.03282
[6] W. Yin, A. Tivay, and J. O. Hahn, “Hemodynamic monitoring via model-based extended Kalman filtering: Hemorrhage resuscitation and sedation case study,” IEEE Control Syst. Lett., vol. 6, pp. 2455–2460, 2022, doi: 10.1109/LCSYS.2022.3164965.
[7] X. Zhu, Y. Shi, and Y. Zhong, “An EKF prediction of COVID-19 propagation under vaccinations and viral variants,” Math. Comput. Simul., vol. 231, pp. 221–238, May 2025, doi: 10.1016/j.matcom.2024.12.012.
[8] C. Wang, R. Li, Y. Cao, and M. Li, “A hybrid model for state of charge estimation of lithium-ion batteries utilizing improved adaptive extended Kalman filter and long short-term memory neural network,” J. Power Sources, vol. 620, p. 235272, Nov. 2024, doi: 10.1016/j.jpowsour.2024.235272.
[9] L. Jiang, Y. Wang, W. Zheng, C. Jin, Z. Li, and S. G. Teo, “LSTMSPLIT: Effective SPLIT learning based LSTM on sequential time-series data,” arXiv preprint arXiv:, Mar. 2022, [Online]. Available: http://arxiv.org/abs/2203.04305
[10] D. Botache, K. Dingel, R. Huhnstock, A. Ehresmann, and B. Sick, “Unraveling the complexity of splitting sequential data: Tackling challenges in video and time series analysis,” arXiv preprint arXiv:, Jul. 2023, [Online]. Available: http://arxiv.org/abs/2307.14294
[11] N. M. Vural, S. Ergüt, and S. S. Kozat, “An efficient and effective second-order training algorithm for LSTM-based adaptive learning,” arXiv preprint arXiv:, May 2021, [Online]. Available: http://arxiv.org/abs/1910.09857
[12] D. Wood, A. M. Webb, H. W. J. Reeve, M. Luján, and G. Brown, “A unified theory of diversity in ensemble learning,” Journal of Machine Learning Research, vol. 24, no. 23, pp. 1–49, 2023, [Online]. Available: http://jmlr.org/papers/v24/23-0041.html.
[13] Z. Yu, J. Liu, Y. Lu, C. Feng, L. Li, and Q. Wu, “Combined EKF–LSTM algorithm-based enhanced state-of-charge estimation for energy storage container cells,” J. Power Electron, vol. 24, no. 8, pp. 1329–1339, 2024, doi: 10.1007/s43236-024-00801-9.
[14] G. Mani and R. Volety, “A comparative analysis of LSTM and ARIMA for enhanced real-time air pollutant levels forecasting using sensor fusion with ground station data,” Cogent Eng., vol. 8, no. 1, p. 1936886, 2021, doi: 10.1080/23311916.2021.1936886.
[15] J. Zeng et al., “Application of XGBoost and logistic regression in predicting 90 days mortality for elderly severe acute renal failure patients,” Sci. Rep., vol. 16, no. 1, p. 7077, Feb. 2026, doi: 10.1038/s41598-026-37828-w.
[16] S. K. Perepu, B. S. Balaji, H. K. Tanneru, S. Kathari, and V. S. Pinnamaraju, “Reinforcement learning based dynamic weighing of ensemble models for time series forecasting,” arXiv preprint arXiv:, Aug. 2020, [Online]. Available: http://arxiv.org/abs/2008.08878
[17] Y. Nie, N. H. Nguyen, P. Sinthong, and J. Kalagnanam, “A time series is worth 64 words: Long-term forecasting with transformers,” arXiv preprint arXiv:, Mar. 2023, [Online]. Available: http://arxiv.org/abs/2211.14730
[18] D. Gusak, A. Volodkevich, A. Klenitskiy, A. Vasilev, and E. Frolov, “Time to split: Exploring data splitting strategies for offline evaluation of sequential recommenders,” in RecSys2025 - Proceedings of the 19th ACM Conference on Recommender Systems, Association for Computing Machinery, Inc, Aug. 2025, pp. 874–883. doi: 10.1145/3705328.3748164.
[19] M. Jaén-Vargas et al., “Effects of sliding window variation in the performance of acceleration-based human activity recognition using deep learning models,” PeerJ Comput. Sci., vol. 8, p. e1052, 2022, doi: 10.7717/PEERJ-CS.1052.
[20] C. Chen et al., “Forecast of rainfall distribution based on fixed sliding window long short-term memory,” Engineering Applications of Computational Fluid Mechanics, vol. 16, no. 1, pp. 248–261, 2022, doi: 10.1080/19942060.2021.2009374.
[21] A. Grant, M. Mrazik, and S. Satchell, “Evaluating forecasts at multiple horizons: An extension of the diebold–mariano approach,” J. Forecast., 2026, doi: 10.1002/for.70150.
Downloads
Published
Issue
Section
Citation Check
License
Copyright (c) 2026 Andung Harjito, Wayan Firdaus Mahmudy, Mahendra Data

This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.
You are free to:
- Share — copy and redistribute the material in any medium or format for any purpose, even commercially.
- The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
-
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
-
NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material.
-
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
Notices:
- You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
- No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.

This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License







