Predicting Car Sales in Indonesia Using Long Short-Term Memory and Gated Recurrent Unit Algorithms

I Putu Agung Bayupati*, Information Technology, Udayana University
Bali, Indonesia, bayupati@it.unud.ac.id
I Made Mahardika Dharmajaya, Information Technology, Udayana University
Bali, Indonesia, madedika124@student.unud.ac.id
Desy Purnami Singgih Putri, Information Technology, Udayana University
Bali, Indonesia, desysinggihputri@unud.ac.id
* Corresponding author

Abstract — Predicting car sales in Indonesia provides valuable insights into the country's automotive market and economic trends. This study evaluates and compares two deep learning models— Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU)—to predict domestic car sales. Using historical sales data from GAIKINDO alongside macroeconomic indicators from BPS, Trading Economics, Kemendag, and Bank Indonesia, both models were tested across standard evaluation metrics (MAE, MSE, RMSE, and MAPE). The GRU model outperformed LSTM, achieving a lower average error rate of 12.49% compared to 12.56%. To make these insights accessible, the final predictive pipeline was deployed into an interactive web dashboard.

Keywords — Prediction; Sales; Cars; Long Short-Term Memory; Gated Recurrent Unit; Fine-Tuning; Evaluation Metrics

I. Introduction

The automotive sector is a critical driver of Indonesia's national economy, with car sales reflecting overall market health, government policies, and consumer behavior [1]. Accurate sales prediction helps stakeholders anticipate demand and make strategic decisions. Building on deep learning approaches for time-series prediction, this paper compares LSTM and GRU models using passenger car sales data and macroeconomic indicators spanning from 2015 to 2025 [2]. The primary goal is to evaluate model accuracy across multiple time horizons and present the prediction through an interactive web-based dashboard.

II. Methodology

The study follows four key phases: data acquisition, preprocessing, model development, and dashboard integration.

A. Data Acquisition & Preprocessing
The study combines automotive sales records with macroeconomic statistics spanning 2015 to 2025. Monthly passenger car sales records were obtained from the Indonesian Automotive Industry Association (GAIKINDO) [3]. Macroeconomic variables—including inflation rates from the Central Statistics Agency (BPS), exchange rates from the Ministry of Trade (Kemendag), interest rates from Bank Indonesia, and fuel prices—were collected from Trading Economics. During preprocessing, data cleaning removed unused features and zero-sales records. The dataset was reshaped from a wide to a long format and integrated into a relational MySQL database. To prepare the data for recurrent neural networks, MinMax scaling normalized feature values, and a sliding window technique formatted the time-series data for supervised learning [4]. Before model training, exploratory data analysis via Pearson correlation assessed linear relationships between monthly car sales and macroeconomic indicators. The resulting heatmap matrix justified including these multivariate features in the prediction models [5]. Python served as the primary development platform, utilizing TensorFlow and Keras for model execution and Streamlit for web dashboard integration [6].

B. Proposed Prediction Models and Evaluation
The prediction phase evaluated two recurrent neural network architectures: Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU). Model training followed a two-step approach: baseline testing to establish a benchmark, followed by hyperparameter fine-tuning (adjusting hidden units, batch size, learning rate, and network layer configurations) to maximize prediction accuracy. A critical parameter in time-series prediction is the lookback window, which defines the historical data span fed into the network. An appropriately tuned lookback window filters out historical noise and optimizes performance [7]. To evaluate different temporal dynamics, four lookback window scenarios were tested: 3 months (short-term), 6 months (medium-term), 12 months (annual seasonality), and 24 months (long-term). Model performance was evaluated across four standard metrics: MAE, MSE, RMSE, and MAPE [8].

C. System Integration and Web Dashboard
To provide interactive access to the prediction results, the top-performing model was deployed into a Streamlit-based web application. The dashboard automatically fetches trained models and dataset records from the MySQL database. Users can dynamically filter predictions by vehicle segment, brand, and fuel type to explore detailed automotive sales trends in Indonesia.

Schematic Diagram of Research
Figure 1. Schematic Diagram of Research

III. Results and Discussion

Feature Correlation Analysis
Exploratory data analysis using Pearson correlation assessed linear relationships between GAIKINDO vehicle sales data and key macroeconomic indicators, including fuel prices, general inflation, interest rates, and the Rupiah exchange rate. Pearson correlation coefficients range from -1 to 1, where values closer to -1 or 1 reflect strong linear relationships and values near 0 indicate weak ones. Figure 4 presents these bivariate relationships in a correlation matrix heatmap. As shown in Figure 4, car sales exhibit moderate negative correlations with the exchange rate (-0.38) and fuel prices (-0.25). These figures indicate an inverse relationship: Rupiah depreciation and rising fuel costs correlate with lower sales volumes. In contrast, car sales show negligible positive correlations with inflation (0.05) and interest rates (0.08), suggesting minimal direct linear impact on overall vehicle sales. Despite their weak linear relationship, inflation and interest rates were retained in the dataset. Advanced deep learning architectures, such as LSTM and GRU, excel at capturing complex non-linear patterns and temporal dependencies that standard Pearson correlation might miss. Consequently, all macroeconomic features were used for model training, with performance thoroughly evaluated in the following section.

Model Performance
To find the ideal historical data window for prediction, we evaluated lookback periods of 3, 6, 12, and 24 months. The 6-month window consistently produced the lowest error rates for both LSTM and GRU models, making it the baseline for further optimization. After baseline testing, we fine-tuned the model hyperparameters using a grid search. The optimal configuration for both architectures consisted of 256 hidden units, a batch size of 32, a standard network structure, and a learning rate of 0.0005. Table 2 summarizes the final performance metrics for the optimized models. As shown in Table 2, both models effectively captured automotive sales trends. However, the GRU architecture performed superiorly across all metrics, achieving the lowest MAE (5,800.46), RMSE (7,828.31), and a strong MAPE of 12.49%. This advantage stems from GRU’s streamlined gating mechanism, which efficiently captures non-linear patterns and temporal dependencies in multivariate sales data—resulting in an average monthly error margin of roughly 7,828 vehicle units.

As shown in Figure 3, the model closely tracks actual sales trends over the three-year testing period, capturing both seasonal patterns and cyclical fluctuations in Indonesia's automotive sector. We then used the model to project monthly passenger car sales volumes for 2026. Table 2 summarizes these data-driven projections. These insights highlight upcoming market trends, offering manufacturers and stakeholders actionable foresight to anticipate demand and refine strategic planning. To ensure practical usability, we integrated the optimized GRU model into an interactive web dashboard built with Streamlit. The system automatically retrieves data from a MySQL database and feeds it into the model to generate real-time predictions, bridging the gap between complex deep learning algorithms and end-user decision-making. As shown in Figure 4, the dashboard features an intuitive sidebar for dynamic data filtering. Industry stakeholders can segment sales data by vehicle category, brand, and fuel type. For example, selecting "Crossover" body types and "Electric" fuel sources generates a targeted market projection of 32,578 units for 2026, alongside an interactive trend comparison between the LSTM and GRU models. Additionally, the dashboard calculates market share distributions, identifying key players like BYD and VinFast expected to lead this niche. By translating complex multivariate data into actionable visual insights, the system serves as a practical decision-support tool for Indonesia's automotive sector.
Pearson Correlation Matrix between Car Sales and Macroeconomic Variables
Figure 2. Pearson Correlation Matrix between Car Sales and Macroeconomic Variables
Table 1. Performance Evaluation of Optimized Prediction Models
ModelMAEMSERMSEMAPE
LSTM5,994.0369,248,438.648,321.5612.56%
GRU5,800.4661,282,488.237,828.3112.49%
Continuous Actual vs. Predicted Car Sales Trajectory (2023–2025)
Figure 3. Continuous Actual vs. Predicted Car Sales Trajectory (2023–2025)
Table 2. Monthly Passenger Car Sales Prediction for 2026
Month (2026)LSTM Prediction (Units)GRU Prediction (Units)
January49,62052,791
February50,12853,807
March50,42253,733
April50,86952,594
May51,62153,219
June51,82653,787
July50,20952,697
August51,16252,608
September51,46752,460
October49,85851,970
November48,64951,473
December49,06751,527
2026 Sales Prediction Dashboard Interface with Multi-Filter Selection
Figure 4. 2026 Sales Prediction Dashboard Interface with Multi-Filter Selection

IV. Conclusion

This study evaluated LSTM and GRU deep learning models to predict multivariate automotive sales in Indonesia. A 6-month historical lookback window proved optimal for capturing market cycles. After hyperparameter optimization, the GRU model emerged as superior, achieving the lowest error rates (MAE of 5,800.46, RMSE of 7,828.31, and MAPE of 12.49%) and a fast training time of 2.97 seconds per epoch. The top-performing setup used 256 hidden units, a batch size of 32, a standard architecture, and a learning rate of 0.0005.

References

[1] M. I. H. Dyan Almaas Turkita, “Faktor-Faktor Yang Mempengaruhi Produksi Industri Otomotif Di Indonesia Tahun 2019 - 2021,” Jul. 31, 2024, Zenodo. doi: 10.5281/ZENODO.13626900.
[2] Widhiyaffa Akbariaza, “Impact of Macroeconomic Indicators on The Indonesia Stock Exchange (IDX) Composite Index Performance”, International Journal of Current Science Research and Review, Vol 7 No 8, 2024
[3] GAIKINDO, “Perkembangan Industri Otomotif RI”, [Online]. Available: https://www.gaikindo.or.id/. [Accessed: Aug. 17, 2024]
[4] I. Abdelmalak et al., “Channel Dependence, Limited Lookback Windows, and the Simplicity of Datasets: How Biased is Time Series Forecasting?,” 2025, arXiv. doi: 10.48550/ARXIV.2502.09683.
[5] D. D. Pramesti, D. C. R. Novitasari, F. Setiawan, and H. Khaulasari, “Long-Short Term Memory (LSTM) For Predicting Velocity And Direction Sea Surface Current On Bali Strait,” Barekeng J. Ilmu Mat. Dan Terap., vol. 16, no. 2, pp. 451–462, Jun. 2022, doi: 10.30598/barekengvol16iss2
[6] Jaffy Sherlin A et al, “A Streamlit-Based Interactive Framework for Exploratory Data Analysis, Model Building, Intelligent Recommendations, and Real-Time PubMed Article Search, ” IEEE Xplore, 2025 6th International Conference on Inventive Research in Computing Applications (ICIRCA), 25-27 June 2025, DOI: 10.1109/ICIRCA65293.2025.11089587
[7] I. Abdelmalak et al., “Channel Dependence, Limited Lookback Windows, and the Simplicity of Datasets: How Biased is Time Series Forecasting?,” 2025, arXiv. doi: 10.48550/ARXIV.2502.09683.
[8] F. Marzbani, A. H. Osman, and M. S. Hassan, “Electric Vehicle Energy Demand Prediction Techniques: An In-Depth and Critical Systematic Review,” IEEE Access, vol. 11, pp. 96242–96255, 2023, doi: 10.1109/ACCESS.2023.3308928.