Forecasting of Nigeria’s Energy Demand: A Comparative Study of ARIMA, RNN, and LSTM Models
- Popoola Damilola Raphael
- Akanji A. R
- 305-314
- Aug 8, 2024
- Computer Science
Forecasting of Nigeria’s Energy Demand: A Comparative Study of ARIMA, RNN, and LSTM Models
Popoola Damilola Raphael1 and Akanji A. R2
1Data Science Department, Cardiff Metropolitan University Institute, Cardiff, UK
2Department of Mathematical sciences, Bingham University, Karu, Nasarawa state. Nigeria
DOI: https://doi.org/10.51584/IJRIAS.2024.907028
Received: 20 July 2024; Revised: 24 July 2024; Accepted: 27 July 2024; Published: 08 August 2024
ABSTRACT
The present study aimed to forecast future energy demand in Nigeria for a five-year period using three predictive models: ARIMA, RNN, and LSTM. The research explored historical energy consumption data from 2015 to 2022, collected from various distribution companies in Nigeria. The data underwent pre-processing to handle missing values and outliers, and stationary analysis was conducted to ensure the suitability of the models. The dataset was then split into training and testing sets using a sliding window technique. The models were trained and evaluated based on performance metrics such as RMSE, MSE, and MAPE. The findings revealed that the RNN model outperformed both ARIMA and LSTM in predicting energy demand, exhibiting the lowest error scores. The study demonstrates the effectiveness of advanced deep learning models, like RNN, for precise and accurate energy demand forecasting in Nigeria over the next five years.
Keywords: Time series, Forecasting, Predictive Models,
INTRODUCTION
The growing global energy demand, driven by population growth, urbanization, and industrialization, challenges energy planners and policymakers in ensuring efficient, sustainable, and reliable energy supply (International Energy Agency, 2021; Mystakidis et al., 2024). Traditional forecasting methods often fail to capture the complexities of energy consumption, prompting the need for advanced statistical and machine learning techniques (Chatfield & Xing, 2019; Chen et al., 2021). Energy demand forecasting must account for various influencing factors, such as weather and economic conditions (Baliyan et al., 2015), necessitating specialized models. Machine learning techniques, including neural networks, are being explored to enhance forecasting accuracy (Ouyang et al., 2017). Accurate forecasting aids in resource optimization, infrastructure planning, renewable energy integration, and demand-side management (Chen et al., 2018).
The motivation for this research arises from the need for robust and accurate energy demand forecasting models. Traditional methods often fail to capture the complex dynamics of energy consumption. Advanced statistical and machine learning techniques are needed for more accurate forecasts, which are essential for informed resource allocation, infrastructure investments, and maintaining stable and reliable energy systems (Chen et al., 2021; Mystakidis et al., 2024). Accurate forecasting also aids in renewable energy integration and effective demand-side management strategies, leading to reduced energy consumption, lower costs, and a more sustainable energy future (Baliyan et al., 2015; Chen et al., 2004). By leveraging advanced techniques, this research aims to develop models that handle the complexity of energy demand patterns and provide more accurate and reliable forecasts (Divina et al., 2019; Mohammadi et al., 2022).
The aim of this research is to develop a time series forecasting model for energy demand by analyzing historical usage patterns to predict future energy needs and optimize resource allocation. This involves reviewing literature on forecasting techniques, collecting and preprocessing historical energy data, developing and comparing various statistical, machine learning, and hybrid models, evaluating these models and predicting future energy demand over the next five years based on historical data.
The significance of this study lies in its potential to improve energy demand forecasting and resource allocation. Accurate forecasts assist in optimizing resource distribution, maintaining energy system stability, and implementing effective demand-side management. It also advances forecasting techniques in energy demand analysis and demonstrates practical applicability through real-world case studies. The findings can benefit energy planners, policymakers, and stakeholders, contributing to efficient energy management and sustainability.
LITERATURE REVIEW
Global energy demand is rising due to population growth, industrialization, and technological advancements, necessitating accurate forecasting to ensure reliable supply and prevent infrastructure overinvestment. The shift towards renewable energy sources to combat climate change has increased the importance of accurate forecasting for resource allocation and grid integration. Time series forecasting has emerged as a powerful technique for predicting energy demand by analyzing historical usage patterns and underlying consumption trends. Numerous models, including Neural Networks, Support Vector Machines, and statistical methods, have been documented in literature for energy usage forecasting (Charytoniuk et al., 1998; Chen et al., 2004; Cho et al., 1995; Feinberg et al., 2003; Kiartzis et al., 2000; Popova et al., 2014)
Time Series Forecasting for Energy Demand
Time series forecasting is a key method for predicting future energy demand by analyzing historical data to aid in resource allocation and infrastructure planning. This approach identifies recurring patterns, trends, and fluctuations, which helps stakeholders make informed decisions (Wilson, 2016). Historical usage patterns are essential for accurate forecasting. For instance, Uayan (2024) utilized Auto-Regressive Integrated Moving Average (ARIMA) and exponential smoothing methods to forecast demand effectively, while Ismail et al., (2015) developed a hybrid model combining ARIMA with fuzzy time series to capture demand uncertainties. Additionally, Kaytez et al., (2015) found that Artificial Neural Networks (ANN) were superior to ARIMA and Support Vector Machines (SVM) in modeling complex nonlinear relationships.
Forecasting methods have evolved to include techniques like ARIMA, Recurrent Neural Networks (RNN), and Long Short-Term Memory (LSTM) networks. ARIMA is known for its efficacy in capturing temporal patterns (Box et al., 2015), RNNs excel at handling sequential data and temporal dependencies (Lipton et al., 2015), and LSTM networks are particularly effective at capturing long-term dependencies (Hochreiter & Schmidhuber, 1997). Kaytez et al., (2015) reported that RNNs outperformed ARIMA and SVM in terms of forecasting accuracy, while Ismail et al., (2015) highlighted the benefits of combining ARIMA with fuzzy time series forecasting to address data uncertainties (Song & Chissom, 1993).
Optimized Resource Allocation
Optimal resource allocation is crucial for efficient energy provision, avoiding overburdened or underutilized infrastructures. Time series forecasting, combined with optimization algorithms, empowers energy providers to allocate resources efficiently. Hoffmann et al., (2020) demonstrated that integrating historical usage patterns into forecasting models enhances resource allocation efficiency. This integration allows for precise anticipation of future energy requirements, minimizing wastage and operational inefficiencies.
Their study highlights the transformative potential of combining forecasting and optimization, benefiting not only the energy sector but also transportation, manufacturing, and urban planning, where resource allocation optimization is vital.
Energy Sector Case Studies
Time series forecasting has proven valuable in the energy sector, particularly in renewable energy integration and smart grid systems. Kyritsakas et al., (2023) emphasized accurate forecasting for optimizing renewable energy utilization, highlighting its role in enhancing reliability and cost-effectiveness. Singla & Hans, (2018) applied time series analysis for short-term energy demand prediction and storage optimization within smart grids, facilitating seamless energy distribution and efficient utilization.
These case studies demonstrate the transformative potential of time series forecasting in tackling energy challenges, including load forecasting, price prediction, and energy consumption analysis. Accurate forecasting models are indispensable for optimizing operations, enhancing reliability, and steering the energy sector towards sustainability and resilience.
METHODOLOGY
The objective of this study is to assess and compare the predictive capabilities of ARIMA, RNN, and LSTM models in forecasting energy usage patterns. The methodology is structured into subsections detailing data collection, preprocessing procedures, hyperparameter configurations, data division, and evaluation metrics. This comprehensive approach ensures replicability and provides a clear understanding of the experimental implementation.aa
Data for this study was obtained from the National Bureau of Statistics (NBS) and includes monthly energy supply information from various electricity distribution companies in Nigeria, such as Abuja Electricity Distribution Company (AEDC), Benin Electricity Distribution Company (BEDC), and others. The dataset spans eight years, from 2015 to 2022, and is sourced from the “Electricity Report Q3_Q4 2022” quarterly publications on the NBS website. For analysis, the data was aggregated to obtain monthly summaries.
Exploratory Data Analysis involved examining individual time series through line plots and histograms to identify patterns and trends in energy supply. The analysis revealed that the distribution of electricity supply did not follow a normal pattern, informing subsequent preprocessing steps.
Stationarity was crucial for the ARIMA models, analyzed using the Augmented Dickey-Fuller (ADF) test. Log transformations were applied to the dataset to achieve stationarity. While LSTM and RNN models are not directly affected by non-stationarity, ensuring stationarity provided a basis for comparison with ARIMA models.
The dataset was divided into training, validation, and testing sets using a sequence-based approach with a sliding window of size 20. This resulted in 20 features, with the most recent 20% of the data allocated for evaluation and the remaining 80% for training. Data normalization was performed using the Min-Max scaler technique to rescale values between 0 and 1.
The study employed a sliding window approach for data splitting, with 20% of the most recent data used for evaluation and 80% for training. Models were normalized using Min-Max scaling. LSTM, RNN, and ARIMA models were trained and evaluated based on performance metrics such as Mean Absolute Percentage Error (MAPE), Mean Squared Error (MSE), and Root Mean Squared Error (RMSE)
RESULTS AND DISCUSSION
The methodology described earlier was implemented on the monthly energy supply data of all distribution companies in Nigeria from 2015 to 2022. The primary objective was to determine the most suitable model for analyzing the series and accurately forecast future energy supply patterns. By applying the discussed methodology to this specific dataset, the study aimed to identify the optimal model that could effectively capture the underlying patterns and make reliable predictions about future energy supply trends.
Figure 1 illustrates the time plot of energy supply in Nigeria spanning the years 2015 to 2022. The plot visually represents the presence of a discernible trend within the dataset, indicating a noticeable pattern or direction of change over the given time period.
Figure 1: Time plot of electricity supply
Nevertheless, the graph provides indications of seasonal fluctuations within the data. Specifically, the time plot exhibits a downward trend during the months of May in both 2015 and 2016.
Augmented Dickey-Fuller test (ADF TEST)
Hypothesis
Ho: The data has a unit root
H1: The data has no unit root
Level of significant: α = 0.05
Test statistics
Augmented Dickey-Fuller Test
data: Electricity supply
Dickey-Fuller = -4.4084, Lag order = 4, p-value = 0.01
Alternative hypothesis: stationary
The decision rule for the Augmented Dickey-Fuller (ADF) test is to reject the null hypothesis (Ho) if the test statistic is lower than the critical values at the 5% significance level or if the p-value is less than 0.05. In this case, since the ADF test statistic is less than the critical value, the null hypothesis is rejected. This indicates that the data does not have a unit root and is therefore considered stationary at the 5% significance level
When the data is log transformed, the ADF test still shows stationarity with a lower test statistic of -6.0052 and a p-value of 0.1. Reject the null hypothesis of non-stationarity as shown below.
Hypothesis
Ho: The data has a unit root
H1: The data has no unit root
Level of significant: α = 0.05
Test statistics
Augmented Dickey-Fuller Test
data: energy
Dickey-Fuller = -6.0052, Lag order = 4, p-value = 0.01
Alternative hypothesis: stationary
The decision rule for the Augmented Dickey-Fuller (ADF) test is to reject the null hypothesis (Ho) if the test statistic is lower than the critical values at the 5% significance level or if the p-value is less than 0.05. In this case, since the ADF test statistic is less than the critical value, the null hypothesis is rejected. This indicates that the data does not have a unit root and is therefore considered stationary at the 5% significance level
Modelling Results
ARIMA models
ARIMA achieved an RMSE of 131.838032. The figure 2 shows the raw data used to train the model and what it predicted.
Figure 2: ARIMA modelling results in a graph
The ARIMA model offers certain advantages over SARIMAX. It is simpler to implement and requires less effort in identifying the parameters that best fit the data.
Figure 3: ARIMA prediction performance
Table 1: ARIMA performance/results
Metrics | Scores |
MAPE | 0.05685334 |
RMSE | 131.838032 |
MSE | 11.4820744 |
RNN
The following are results of the RNN based models which were the main core for the project.
Figure 4: Electricity supply and RNN model forecast value
The forecast depicted in Figure 4 illustrates a declining trend in energy supply for the upcoming five-year period.
Figure 5: RNN prediction performance
Table 2: RNN performance/results
Metrics | Scores |
MAPE | 0.04209237 |
RMSE | 96.8664058 |
MSE | 9.84207325 |
LSTM
Figure 6: Electricity supply and LSTM model forecast value
Figure 6 demonstrates a similar pattern to the RNN model, projecting a downward trend in future energy supply.
Figure 7: LSTM prediction performance
Table 3: LSTM performance/results
Metrics | Scores |
MAPE | 0.05848306 |
RMSE | 135.340785 |
MSE | 11.6336058 |
Based on the information presented on the tables 3, it can be concluded that the RNN model outperformed the other two architectures across all three metrics. It attained the lowest scores for RMSE, MSE, and MAPE, suggesting that the RNN model is the most precise and well-suited for the given dataset.
DISCUSSIONS
In this study, three models, namely ARIMA, RNN, and LSTM, were employed to forecast future energy demand. The results obtained from this investigation shed light on the prediction of energy supply in Nigeria. The study employed various models, including ARIMA, RNN, and LSTM, to forecast future energy supply based on historical data.
The findings indicate that the RNN model exhibited superior performance compared to the other architectures. It achieved the lowest RMSE, MSE, and MAPE scores, suggesting its superior accuracy and suitability for the dataset. These results imply that the RNN model is a more effective tool for predicting energy supply trends in Nigeria.
The notable performance of the RNN model could be attributed to its ability to capture and model the underlying patterns and trends present in the energy supply data. The RNN architecture excels at handling time series data and can effectively incorporate sequential dependencies, enabling it to make more accurate predictions.
However, it is important to acknowledge the limitations of this study. The analysis focused on a specific dataset and time frame, which may restrict the generalizability of the findings to other regions or time periods. Additionally, the choice of evaluation metrics may have influenced the comparison between the models. To gain a comprehensive understanding of the models’ performance, it is crucial to consider additional metrics and conduct further analysis.
Future research could explore the inclusion of additional factors such as economic indicators, population growth, and environmental factors, which may impact energy supply. Furthermore, the study could be expanded to evaluate the models’ performance on different subsets of the dataset or consider alternative time series forecasting techniques to enhance the accuracy and robustness of the predictions. By addressing these aspects, researchers can further improve the accuracy and applicability of energy supply forecasting models.
This research successfully achieved its objectives, which included conducting a thorough literature review on time series forecasting techniques in energy demand analysis to establish a theoretical foundation and identify state-of-the-art methods. It involved collecting and preprocessing historical energy consumption data, ensuring data reliability and relevance through thorough cleaning, transformation, and feature engineering processes. The research also entailed developing and comparing various time series forecasting models, such as ARIMA, RNN, and LSTM, through extensive implementation and fine-tuning to identify the most accurate and suitable model for energy demand forecasting. Furthermore, the study evaluated the performance of these models using appropriate metrics like MSE, RMSE and MAPE to assess their predictive accuracy based on historical usage patterns. Lastly, the research successfully forecast 5 years energy demand for proper future planning of Nigeria.
CONCLUSION AND RECOMMENDATION
Based on the study’s findings, several key recommendations can be made to improve energy demand forecasting. First, while the Recurrent Neural Network (RNN) model showed the best performance, exploring other advanced forecasting techniques, such as deep learning architectures or hybrid models, could offer valuable insights into their relative strengths and limitations. Additionally, integrating external factors like economic indicators, weather patterns, and policy changes into forecasting models could enhance their accuracy and reliability.
Furthermore, conducting robustness analyses by evaluating the models on different subsets of data or across various time periods will help assess their performance under diverse conditions, ensuring stability and effectiveness. To ensure the practical utility of these models, they should be validated and deployed in real-world settings, with predictions compared to actual energy supply data. Continuous monitoring and updating of the models are also essential to adapt to changing trends and maintain forecasting accuracy over time.
This study successfully evaluated three forecasting models—ARIMA, RNN, and LSTM—to predict future energy demand in Nigeria, revealing that the RNN model outperformed the others with the lowest RMSE, MSE, and MAPE scores. This superior performance is attributed to the RNN’s ability to capture complex sequential dependencies and patterns in the data. Despite these findings, the study’s limitations, such as the specific dataset and time frame, should be noted, as they may restrict the generalizability of the results. Future research should expand the evaluation with additional metrics and analyses to provide a more thorough understanding of model effectiveness and applicability.
REFERENCES
- Baliyan, A., Gaurav, K., & Mishra, S. K. (2015). A Review of Short Term Load Forecasting using Artificial Neural Network Models. Procedia Computer Science, 48, 121–125. https://doi.org/10.1016/j.procs.2015.04.160
- Box, G. E. P., Jenkins, G. M., & Reinsel, G. C. (2008). Forecasting. In Time Series Analysis (pp. 137–191). John Wiley & Sons, Ltd. https://doi.org/10.1002/9781118619193.ch5
- Charytoniuk, W., Chen, M. S., & Van Olinda, P. (1998). Nonparametric regression based short-term load forecasting. IEEE Transactions on Power Systems, 13(3), 725–730. IEEE Transactions on Power Systems. https://doi.org/10.1109/59.708572
- Chatfield, C., & Xing, H. (2019). The Analysis of Time Series: An Introduction with R (7th ed.). Chapman and Hall/CRC. https://doi.org/10.1201/9781351259446
- Chen, B.-J., Chang, M.-W., & lin, C.-J. (2004). Load forecasting using support vector Machines: A study on EUNITE competition 2001. IEEE Transactions on Power Systems, 19(4), 1821–1830. IEEE Transactions on Power Systems. https://doi.org/10.1109/TPWRS.2004.835679
- Chen, K., Chen, K., Wang, Q., He, Z., Hu, J., & Jinliang, H. (2018). Short-Term Load Forecasting With Deep Residual Networks. IEEE Transactions on Smart Grid, PP. https://doi.org/10.1109/TSG.2018.2844307
- Chen, Z., Chen, Y., Xiao, T., Wang, H., & Hou, P. (2021). A novel short-term load forecasting framework based on time-series clustering and early classification algorithm. Energy and Buildings, 251, 111375. https://doi.org/10.1016/j.enbuild.2021.111375
- Cho, M. Y., Hwang, J. C., & Chen, C. S. (1995). Customer short term load forecasting by using ARIMA transfer function model. Proceedings 1995 International Conference on Energy Management and Power Delivery EMPD ’95, 1, 317–322 vol.1. https://doi.org/10.1109/EMPD.1995.500746
- Divina, F., Garcia Torres, M., Gómez-Vela, F., & Vazquez Noguera, J. (2019). A Comparative Study of Time Series Forecasting Methods for Short Term Electric Energy Consumption Prediction in Smart Buildings. Energies, 12, 1934. https://doi.org/10.3390/en12101934
- Feinberg, E., Genethliou, D., & Hajagos, J. (2003). Statistical load modeling. Proceedings of the IASTED Multi-Conference- Power and Energy Systems, 7.
- Hochreiter, S., & Schmidhuber, J. (1997). Long Short-term Memory. Neural Computation, 9, 1735–1780. https://doi.org/10.1162/neco.1997.9.8.1735
- Hoffmann, M., Kotzur, L., Stolten, D., & Robinius, M. (2020). A Review on Time Series Aggregation Methods for Energy System Models. Energies, 13(3), Article 3. https://doi.org/10.3390/en13030641
- IEA (2021), World Energy Outlook 2021, IEA, Paris https://www.iea.org/reports/world-energy-outlook-2021
- Ismail, Z., Efendi, R., & Mat Deris, M. (2015). Application of Fuzzy Time Series Approach in Electric Load Forecasting. New Mathematics and Natural Computation, 11, 229–248. https://doi.org/10.1142/S1793005715500076
- Kaytez, F., Taplamacioglu, M., Çam, E., & Hardalaç, F. (2015). Forecasting electricity consumption: A comparison of regression analysis, neural networks and least squares support vector machines. International Journal of Electrical Power & Energy Systems, 67. https://doi.org/10.1016/j.ijepes.2014.12.036
- Kiartzis, S. J., Bakirtzis, A. G., Theocharis, J. B., & Tsagas, G. (2000). A fuzzy expert system for peak load forecasting. Application to the Greek power system. 2000 10th Mediterranean Electrotechnical Conference. Information Technology and Electrotechnology for the Mediterranean Countries. Proceedings. MeleCon 2000 (Cat. No.00CH37099), 3, 1097–1100 vol.3. https://doi.org/10.1109/MELCON.2000.879726
- Kyritsakas, G., Boxall, J. B., & Speight, V. L. (2023). A Big Data framework for actionable information to manage drinking water quality. AQUA – Water Infrastructure, Ecosystems and Society, 72(5), 701–720. https://doi.org/10.2166/aqua.2023.218
- Mohammadi, S., Nabavi, S., Hossein Motlagh, N., Anvari-Moghaddam, A., Tarkoma, S., & Geyer, P. (2022). A Comparative Study of Machine Learning Modeling in Electricity Load Forecasting. SSRN Electronic Journal. https://doi.org/10.2139/ssrn.4200148
- Mystakidis, A., Koukaras, P., Tsalikidis, N., Ioannidis, D., & Tjortjis, C. (2024). Energy Forecasting: A Comprehensive Review of Techniques and Technologies. Energies, 17, 1662. https://doi.org/10.3390/en17071662
- Ouyang, T., He, Y., Li, H., Sun, Z., & Baek, S. (2017). A Deep Learning Framework for Short-term Power Load Forecasting.
- Popova, S., Iliev, S., & Trifono, M. (2014). Neural Network Prediction of the Electricity Consumption of Trolleybus and Tram Transport in Sofia City.
- Singla, M., & Hans, S. (2018). Load Forecasting using Fuzzy Logic Tool Box.
- Song, Q., & Chissom, B. (1993). Fuzzy time series and its model. Fuzzy Sets and Systems, 54, 269–277. https://doi.org/10.1016/0165-0114(93)90372-O
- Uayan, C. J. (2024). Energy Demand Forecasting Using Auto Regression, Moving Average and Exponential Smoothing in Mindanao Grid.
- Wilson, G. T. (2016). Time Series Analysis: Forecasting and Control,5th Edition, by George E. P. Box, Gwilym M. Jenkins, Gregory C. Reinsel and Greta M. Ljung, 2015. Published by John Wiley and Sons Inc., Hoboken, New Jersey, pp. 712. ISBN: 978-1-118-67502-1. Journal of Time Series Analysis, 37, n/a-n/a. https://doi.org/10.1111/jtsa.12194