Comparison of Random Forest and Multiple Linear Regression Algorithms in Predicting Daily Drug Expenditure: A Case Study At Bambuan Pharmacy
DOI:
https://doi.org/10.56211/tsabit62Keywords:
Machine Learning;; Random Forest;; Multiple Linear Regression;; Drug sales prediction, Pharmacy
Abstract
Accurate drug inventory management is essential for pharmacies to avoid shortages or excess stock. This study aims to compare the performance of Multiple Linear Regression (MLR) and Random Forest Regression (RFR) in predicting daily drug sales at Apotek Bambuan. The dataset consists of sales records from 2022–2024, which were preprocessed and divided into training and testing sets. Both models were evaluated using Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), Mean Squared Error (MSE), Root Mean Squared Error (RMSE), and R² Score. The results show that Random Forest provides higher prediction accuracy with lower error values compared to MLR, although MLR remains useful for interpreting the contribution of predictor variables. Therefore, Random Forest is recommended for daily drug sales prediction due to its superior accuracy, while MLR offers advantages in model interpretability.
Downloads
References
Book: Single Author
Indah Purnama Sari. Algoritma dan Pemrograman. Medan: UMSU Press, 2023, pp. 290.
Indah Purnama Sari. Buku Ajar Pemrograman Internet Dasar. Medan: UMSU Press, 2022, pp. 300.
Indah Purnama Sari. Buku Ajar Rekayasa Perangkat Lunak. Medan: UMSU Press, 2021, pp. 228.
Janner Simarmata Arsan Kumala Jaya, Syarifah Fitrah Ramadhani, Niel Ananto, Abdul Karim, Betrisandi, Muhammad Ilham Alhari, Cucut Susanto, Suardinata, Indah Purnama Sari, Edson Yahuda Putra. Komputer dan Masyarakat. Medan: Yayasan Kita Menulis, 2024, pp.162.
Mahdianta Pandia, Indah Purnama Sari, Alexander Wirapraja Fergie Joanda Kaunang, Syarifah Fitrah Ramadhani Stenly Richard Pungus, Sudirman, Suardinata Jimmy Herawan Moedjahedy, Elly Warni, Debby Erce Sondakh. Pengantar Bahasa Pemrograman Python. Medan : Yayasan Kita Menulis, 2024, pp.180
Zelvi Gustiana Arif Dwinanto, Indah Purnama Sari, Janner Simarmata Mahdianta Pandia, Supriadi Syam, Semmy Wellem Taju Fitrah Eka Susilawati, Asmah Akhriana, Rolly Junius Lontaan Fergie Joanda Kaunang. Perkembangan Teknologi Informatika. Medan: Yayasan Kita Menulis, 2024, pp.158
Journal Article from the Internet
Arifuddin, D., Kusrini, & Kusnawi. (2025). Perbandingan performansi algoritma Multiple Linear Regression dan Multi Layer Perceptron Neural Network dalam memprediksi penjualan obat. MALCOM: Indonesian Journal of Machine Learning and Computer Science, 5(2), 722–737.
Ayuni, G. N., & Fitrianah, D. (2022). Penerapan metode regresi linier untuk prediksi penjualan properti pada PT XYZ. Jurnal Telematika, 14(2). Institut Teknologi Harapan Bangsa, Bandung.
Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32. https://doi.org/10.1023/A:1010933404324
Efendi, M. S., & Zyen, A. K. (2024). Penerapan algoritma Random Forest untuk prediksi penjualan dan sistem persediaan produk. Resolusi, 5(1), 12–20. https://djournals.com/resolusi/article/view/2149/1156
Farhanuddin, F., Sihombing, S. E. K., & Yahfizham, Y. (2024). Komparasi Multiple Linear Regression dan Random Forest Regression dalam memprediksi anggaran biaya manajemen proyek sistem informasi. Journal of Computers and Digital Business, 3(2), 86–97.
Sari, I.P., Hariani, P.P., Al-Khowarizmi, A., Ramadhani, F., Sulaiman, O.K., Satria, A, & Manurung, A.A. (2024). CLUSTERING HIV/AIDS DISEASE USING K-MEANS CLUSTERING ALGORITHM. Proceeding International Seminar on Islamic Studies 5 (1), 1668-1676
Sari, I.P., Ramadhani, F., Satria, A., & Sulaiman, O.K. Leukocoria Identification: A 5-Fold Cross Validation CNN and Adaboost Hybrid Approach. 2023 6th International Seminar on Research of Information Technology and Intelligent Systems (ISRITI), 486-491
Fahlepi, M. R., & Widjaja, A. (2019). Penerapan Metode Multiple Linear Regression untuk Prediksi Harga Sewa Kamar Kost. Jurnal STRATEGI.
Hutahaean, M., & Handoko, K. (2022). Penerapan data mining untuk memprediksi penjualan obat di Klinik Harapan Kita Batam. Jurnal Comasie, 6(5).
Sari, I.P., Ramadhani, F., Satria, A., & Apdilah, D. (2023). Implementasi Pengolahan Citra Digital dalam Pengenalan Wajah menggunakan Algoritma PCA dan Viola Jones. Hello World Jurnal Ilmu Komputer 2 (3), 146-157
Sari, I.P., Al-Khowarizmi, A, Sulaiman, O.K., & Apdilah, D. (2023). Implementation of Data Classification Using K-Means Algorithm in Clustering Stunting Cases. Journal of Computer Science, Information Technology and Telecommunication Engineering 4 (2), 402-412
Sulaiman, O.K & Batubara, I.H. (2021). Implementation Data Mining For Level Analysis Traffic Violation By Algorithm Association Rule. Al'adzkiya International of Computer Science and Information Technology (AIoCSIT) Journal 2 (2), 128-135
Josaphat, B. P., & Pangestika, Z. (2025). Predicting stock price using convolutional neural network and long short-term memory (case study: Stock of BBCA). Journal of the Indonesian Mathematical Society. https://jimsa.org/index.php/jimsa/article/view/1512
Sari, I.P., Batubara, I.H., & Al-Khowarizmi, A. (2021). Sensitivity Of Obtaining Errors In The Combination Of Fuzzy And Neural Networks For Conducting Student Assessment On E-Learning. International Journal of Economic, Technology and Social Sciences (Injects) 2 (1), 331-338
Sari, I.P., Al-Khowarizmi, A., & Batubara, I.H. (2021). Cluster Analysis Using K-Means Algorithm and Fuzzy C-Means Clustering For Grouping Students' Abilities In Online Learning Process. Journal of Computer Science, Information Technology and Telecommunication Engineering 2 (1), 139-144
Apdilah, D., & Sari, I.P. (2021). Optimization Of The Fuzzy C-Means Cluster Center For Credit Data Grouping Using Genetic Algorithms. Al'adzkiya International of Computer Science and Information Technology (AIoCSIT) Journal 2 (2), 156-163
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Muammar Farhan, Zuli Agustina Gultom

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Authors who publish in Tsabit Journal of Computer Science agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).
CC BY-SA: This license allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the creator. The license allows for commercial use. If you remix, adapt, or build upon the material, you must license the modified material under identical terms.









