October 20, 2026
EGIE3 Stock Volatility Forecast (Clean Energy) by GARCH Model with LSTM Neural Network
Forecast of Egie3 Stock Volatility (Clean Energy) by Garch Model with Lstm Neural Network
Vinícius Reinert; Adâmara Felício
DOI: 10.22167/2675-6528-202603540
Article derived from a Course Conclusion Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.
Summary
The Brazilian transition to low-carbon matrices intensified the importance of clean energy companies, but the national capital market exhibited sharp volatility, creating challenges in risk management. The volatility of Engie Brasil shares (EGIE3.SA) was predicted using a hybrid model that combined GARCH econometrics with a Long Short-Term Memory (LSTM) neural network. Performance was compared to benchmark models such as naive forecast, EWMA, HAR-RV, and a pure LSTM. The methodology involved collecting historical data for EGIE3.SA (2015-2025), processing logarithmic returns, diagnosing the GARCH (1,1) specification via the Bayesian Information Criterion, and applying the Walk-Forward Validation technique with multiple random seeds, complemented by Diebold-Mariano tests. The results indicated that the integration of Deep Learning captured non-linear dependencies and complex patterns during periods of economic stress, adding value over the purely econometric component. However, the hybrid model did not outperform the naive forecast, HAR-RV, or the pure LSTM for the EGIE3 asset. A control simulation on random noise revealed that part of the absolute level of error metrics stemmed from the overlap of the 20-day realized volatility window. It was concluded that the hybrid model offered a superior tool to traditional GARCH and EWMA for the financial resilience of sustainable portfolios, but simpler benchmarks and isolated LSTM remained competitive or superior for EGIE3, highlighting the need for rigorous comparisons with multiple benchmarks before declaring the superiority of Deep Learning architectures in finance.
Keywords: Diebold-Mariano; Machine Learning; Hybrid Model; RNN; Walk-Forward Validation.
1. Introduction
The global energy transition towards low-carbon matrices has increased the strategic importance of companies operating in the clean energy segment. In the Brazilian context, the country stands out for an electricity matrix predominantly based on natural and renewable resources, with renewable sources accounting for 88.2% of the internal electricity supply in 2024 (EPE/MME, 2025). Sources such as wind and solar have shown exponential growth, consolidating Brazil as a benchmark in sustainable generation.
However, this rapid transformation of the Brazilian electricity sector introduces complex challenges for the financial market (Erber, 2024). The growing participation of intermittent sources, such as solar and wind energy, combined with hydrological uncertainties, causes sharp volatility in energy prices and, consequently, in the stocks of companies in the sector (Leite et al., 2013). This instability highlights the critical need for improved methods for risk management and volatility forecasting, especially in the Free Contracting Environment (ACL) (Ribeiro, 2015).
The modern financial market is intrinsically characterized by uncertainty, and volatility is one of its central components, representing the risk of price fluctuations. The ability to predict volatility accurately is of great importance to investors and traders, given its direct application in areas such as risk management and quantitative finance (Manimaran et al., 2006). Historically, time series models have been the basis for volatility modeling, notably the family of Generalized Autoregressive Conditional Heteroskedasticity (GARCH) models (Bollerslev, 1986).
GARCH models are recognized for their robustness in capturing important characteristics of financial data, such as volatility clustering, where periods of high volatility are followed by others of high volatility, and heteroscedasticity, which refers to non-constant volatility over time (Engle, 2001). However, the increasing complexity of markets and the presence of nonlinear patterns often limit the predictive capacity of pure linear econometric models, such as GARCH (Neto, 2014).
In this context, volatility forecasting is crucial for pricing derivatives, calculating risk metrics such as Value-at-Risk, and optimizing asset allocation in portfolios. Deep Learning tools, such as Long Short-Term Memory (LSTM) Neural Networks, emerge as a promising alternative. They are capable of modeling nonlinear patterns and long-term dependencies that traditional models cannot capture (Xu et al., 2024; Zhao et al., 2024). LSTM Neural Networks stand out for their effectiveness in learning long-term dependencies in time series (Sanjaya, 2024).
This research is justified by the need to improve volatility forecasting in an increasingly complex capital market influenced by non-linear factors. The combination of econometric and machine learning approaches can offer a more robust tool for risk management and financial decision-making. Thus, this work seeks to contribute to the literature by evaluating the effectiveness of a hybrid model in the context of the Brazilian market, offering a solution for the risk management of sustainable portfolios.
The objective of this work was to predict the volatility of Engie Brasil shares [EGIE3.SA] using a hybrid model that combined classical econometrics with the Long Short-Term Memory (LSTM) neural network, comparing its performance with a comprehensive set of benchmark models: naive forecast (persistence), EWMA, HAR-RV, and a pure LSTM (without the GARCH component).
2. Material and Methods
The research adopted a quantitative and exploratory approach, focused on the predictive volatility modeling of financial assets (Oliveira, 2011). The study focused on the shares of Engie Brasil Energia (EGIE3.SA), a representative asset of the Brazilian electricity sector. Historical data were collected from the Yahoo Finance portal, covering January 1, 2015, to January 1, 2025, totaling 2,467 daily observations.
For the data treatment, daily closing prices were converted into logarithmic returns, according to the formulation $r_t = \ln(P_t / P_{t-1})$ (Bucci, 2019). Realized volatility, defined as the target variable for prediction, was calculated as the moving standard deviation of returns in a twenty-day trading window (Taylor, 2008). Initial descriptive analysis of returns revealed a leptokurtic distribution, with a raw kurtosis of 6.88, and non-normality was confirmed by the Jarque-Bera test (Cardoso, 2025).
The modeling of conditional heteroscedasticity was performed with the GARCH(1,1) model, selected through the Bayesian Information Criterion (BIC). The assumption of normal distribution in the likelihood was maintained, based on Quasi-Maximum Likelihood theory (Bollerslev; Wooldridge, 1988). The diagnosis of the standardized GARCH(1,1) residuals was conducted with the Ljung-Box and ARCH-LM tests, confirming the adequacy of the specification. The persistence of a residual nonlinear component, not captured by GARCH, served as input for the deep learning stage.
The deep learning architecture employed a Long Short-Term Memory (LSTM) Neural Network, built with the TensorFlow/Keras framework. The network consisted of two hidden layers, each with fifty neurons, optimized to capture non-linear patterns and long-term dependencies. The “Adaptive Moment Estimation” (Adam) optimizer was used for training, minimizing the mean squared error (MSE). To mitigate overfitting, the “Early Stopping” technique was utilized, which monitored the validation error on a 20% sample of the data, interrupting training after three cycles without improvement, with a ceiling of fifty epochs. The “Batch Size” was set to thirty-two samples.
The hybrid GARCH-LSTM model was designed so that GARCH would estimate the conditional variance, and LSTM would be trained on the residuals generated by this approach (the “additive gap”). This synergy aimed to allow LSTM to learn historical behaviors and correct future predictions, mapping the non-linear complexities not captured by pure GARCH. The predictive performance evaluation was carried out using the “Walk-Forward Validation” technique with an expanded window, simulating a real trading environment. The procedure was repeated for five distinct random seeds (42, 7, 123, 2024, and 99) to quantify the inherent stochasticity of the neural network weight initialization.
The metrics Mean Squared Error (MSE), Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and QLIKE (Patton, 2006) were employed to compare the accuracy of the models. The statistical significance of the performance differences was evaluated by the Diebold-Mariano test (Diebold; Mariano, 1995), with Newey and West (1987) correction and twenty lags. Benchmark models included naive forecast, EWMA (J.P Morgan/Reuters, 1996), HAR-RV (Corsi, 2004), and a pure LSTM, trained directly on realized volatility.
To isolate the effect of the moving window on the error metrics, a control simulation with i.i.d. Gaussian returns was performed, using the same daily standard deviation as EGIE3.SA, without volatility clustering dynamics. This allowed for the evaluation of the model’s genuine predictive content. The Python libraries `yfinance`, `pandas`, `numpy`, `arch`, `statsmodels`, `scikit-learn`, `tensorflow/keras`, `matplotlib`, `seaborn`, and `scipy.stats` were used for data collection, processing, modeling, deep learning, evaluation, and visualization.
3. Results and Discussion
The present investigation had as its central objective to predict the volatility of Engie Brasil shares (EGIE3.SA) through a hybrid GARCH-LSTM model, comparing its performance with a comprehensive set of benchmark models. The results revealed a multifaceted performance, where the integration of Deep Learning demonstrated value over traditional econometric approaches, but did not surpass simpler benchmarks or the isolated LSTM neural network for the studied asset. The initial analysis of historical data for EGIE3.SA, comprising 2,467 observations between 2015 and 2025, was fundamental to understanding the nature of the time series.
The descriptive analysis of EGIE3.SA daily returns indicated a slightly positive skewness of 0.06, suggesting a relatively balanced distribution with a subtle predominance of upward movements. However, the most critical aspect for modeling was the raw kurtosis of 6.88, which, being greater than 3 (the standard for a normal distribution), characterized the series as leptokurtic, meaning it has “heavy tails.” This implies a higher frequency of extreme events and volatility spikes than expected in a normal distribution, as illustrated by the return distribution. This nonlinearity, combined with a daily standard deviation of 1.4310% — approximately 37 times greater than the average daily return of 0.0388% — provided strong statistical evidence of heteroscedasticity, justifying the application of advanced conditional heteroscedasticity models (Gujarati and Porter, 2009).
To confirm the violation of the normality assumption, the Jarque-Bera test was applied to the logarithmic returns, which resulted in a p-value close to zero and a statistic of 1539. This result rejected the null hypothesis of normality, corroborating the leptokurtic nature of the series. The GARCH(1,1) specification was selected as the most efficient for this study, determined by the Bayesian Information Criterion (BIC) after the systematic comparison of four lag combinations. This GARCH(1,1) configuration captured a short memory structure, where today’s volatility was influenced by the previous day’s shock (q=1 parameter) and inherited the persistence of the volatility recorded on the previous day (p=1 parameter).
The choice to maintain the assumption of normal distribution in the GARCH likelihood, even in the face of non-normality of returns, was technically justified by Quasi-Maximum Likelihood theory (Bollerslev; Wooldridge, 1988). This approach allowed the statistical component of GARCH to focus on capturing linear variance, delegating the non-linear residuals and extreme events to be processed by artificial intelligence. The Ljung-Box tests applied to the squared standardized residuals (Z²) and the ARCH-LM test, both with high p-values (well above 0.05), confirmed that the GARCH(1,1) model adequately captured the conditional heteroscedasticity structure of the series, with no remaining ARCH effect. However, a residual excess kurtosis of 1.51 remained, evidencing the persistence of a non-linear component that the LSTM neural network would seek to learn.
The analysis of volatility dispersion, performed versus that predicted by the pure GARCH model, revealed a detachment from the perfect fit line. In periods of low volatility, the points on the graph tended to be above the line, indicating that GARCH overestimated the risk. On the other hand, in times of high volatility, many points were below the line, suggesting that GARCH underestimated market stress peaks. The broad cloud of points observed indicated that, for the same value of real volatility, pure GARCH could predict distinct values, resulting in higher RMSE and MAE errors. This limitation of the pure linear model reinforced the need for an approach capable of capturing the nonlinear complexities of the data.
The Long Short-Term Memory (LSTM) neural network was integrated into the model to learn about the volatility “gap” that GARCH was unable to explain. The LSTM architecture consisted of two hidden layers, each with 50 neurons, designed to map extremely complex nonlinear behaviors, such as volatility spikes that GARCH, by its linear nature, did not capture. To avoid overfitting, the “Walk-Forward Validation” technique with “Early Stopping” was employed, configured with a ceiling of 50 epochs and a patience of three cycles without improvement in the validation error, ensuring that learning reached its optimal generalization point.
The learning curve of the LSTM network demonstrated a healthy convergence of the algorithm. In the initial epochs, both training error and validation error showed a sharp decrease, evidencing the rapid capture of the most latent patterns of the volatility “gap”. From the tenth epoch onwards, both metrics began a stabilization process. “Early Stopping” allowed the training to be automatically interrupted, with the lowest validation error recorded in the twentieth epoch, ensuring an optimized mathematical matrix for the prediction phase. A batch size of 32 samples was empirically validated as the most efficient, presenting the lowest RMSE in a sensitivity analysis, confirming its suitability for balancing stability and noise sensitivity.
The evaluation of predictive performance, carried out through Walk-Forward Validation with five distinct random seeds, revealed that the hybrid GARCH-LSTM model presented an average RMSE of 0.000764. This performance was superior to that of pure GARCH, which registered an RMSE of 0.002030, and to EWMA, with an RMSE of 0.001213. This improvement represented a gain of 62.38% compared to pure GARCH and 37.02% compared to EWMA, corroborating the capability of Deep Learning integration in capturing nonlinear dependencies and complex patterns that traditional econometric models cannot accurately map (Xu et al., 2024; Zhao et al., 2024).
However, the comparative analysis also showed that the hybrid model failed to outperform the naive forecast (RMSE of 0.000659), the HAR-RV model (RMSE of 0.000662), or the pure LSTM (RMSE of 0.000711). The Diebold-Mariano test, with Newey-West (1987) correction and 20 lags, confirmed that the accuracy differences between the hybrid model and all benchmarks were statistically significant, with p-values below 0.05. Specifically, the hybrid model was statistically inferior to the naive forecast, HAR-RV, and pure LSTM, indicating that hybridization, in this case, was not the determining source of the observed predictive gain.
The comparison with pure LSTM was particularly instructive, revealing that providing the GARCH “gap” as input to the neural network, for the asset and period studied, resulted in a negative effect on predictive gain. A plausible interpretation is that the realized volatility, calculated by a 20-day moving window, already carries strong short-term autocorrelation, which is more easily captured directly by the LSTM than through the “gap” in relation to a GARCH that presents a systematic bias in low volatility regimes. The visualization of volatility predictions confirmed that the naive model and the hybrid GARCH-LSTM followed the realized series much more closely and responsively than the pure GARCH.
A control simulation with i.i.d. (independent and identically distributed) Gaussian returns with the same daily standard deviation as EGIE3 (0.014309) was performed to isolate the effect of the 20-day moving window overlap on realized volatility. The naive forecast on this pure noise achieved an average RMSE of 0.000748, a value very close to the RMSE of the hybrid model on the actual series (0.000764). This finding is revealing, as it demonstrates that a significant portion of the absolute plateau of the error metrics stems from the mechanics of the moving window, and not exclusively from the genuine predictive content of the models. This reinforces the importance of focusing on relative comparisons between models, rather than solely on the absolute values of the error metrics.
The sensitivity of performance to batch size was evaluated, and the batch of 32 samples showed the lowest RMSE among the tested alternatives (16, 32, and 64), empirically confirming the choice adopted in the literature. Larger batches excessively smoothed the gradient estimate, impairing the network’s ability to react to punctual volatility peaks, while smaller batches introduced excessive noise. Additionally, an alternative formulation for the LSTM target was tested: the multiplicative ratio versus the “additive gap”. The “additive gap” formulation showed a slightly lower average RMSE and a much smaller standard deviation between seeds, indicating greater stability, although the Diebold-Mariano test did not reject the hypothesis of equal accuracy between the two formulations (p = 0.1004).
In practical terms, this work offers a relevant validation tool and methodology for strategic risk management in the energy sector. For an organization already operating with a GARCH-based risk structure, adding an LSTM layer on top of the volatility “gap” offers a measurable and statistically validated improvement, without requiring its complete replacement. However, for organizations without this prior commitment, the results suggest that simpler alternatives, such as HAR-RV or pure LSTM, may deserve consideration as a first alternative, due to the lower computational cost and the “black-box” nature of LSTM.
Despite the relevant results, limitations were identified during the study. Firstly, the model was restricted to the use of endogenous variables (logarithmic prices and returns), not incorporating exogenous variables such as macroeconomic indicators, interest rates, or market news, which could enrich predictive capacity. Furthermore, the research focused exclusively on the EGIE3 asset, which limits the generalization of conclusions to other B3 sectors, which may present distinct volatility dynamics. The “black box” nature of the LSTM network imposed challenges on the direct interpretability of its parameters, contrasting with the mathematical transparency of the GARCH model equations.
Still regarding statistical robustness, the sensitivity analyses of batch size and the comparison between “additive gap” and multiplicative ratio were conducted with a more restricted number of runs, so that their conclusions, although indicative, have less statistical robustness than the main comparison between the six models. The stochastic nature of the LSTM architecture and the random initialization of its weights resulted in variations in the final error metrics, with the network trained in isolation being proportionally more sensitive to random initialization than the hybrid network. However, the order of superiority between the models remained consistent throughout the runs, and the observed differences remained statistically significant.
In summary, the hybrid GARCH-LSTM model proved to be a superior tool to traditional GARCH and EWMA in forecasting the volatility of EGIE3.SA stocks, capturing nonlinear and complex patterns during periods of economic stress. However, for this specific asset, simpler benchmarks such as naive forecasting and HAR-RV, and pure LSTM, proved competitive or even superior, indicating that hybridization itself was not the determining source of the observed predictive gain. These findings highlight the need for rigorous comparisons with multiple benchmarks before declaring the superiority of Deep Learning architectures in finance, providing a valuable contribution to the risk management of sustainable portfolios.
4. Conclusion
This work sought to predict the volatility of Engie Brasil stocks (EGIE3.SA) through a hybrid model that combined GARCH econometrics with a Long Short-Term Memory (LSTM) neural network, comparing its performance with benchmark models such as naive forecasting, EWMA, HAR-RV, and a pure LSTM. It was found that the integration of Deep Learning allowed the hybrid model to capture non-linear dependencies and complex patterns during periods of economic stress, resulting in superior predictive accuracy compared to pure GARCH and EWMA, with RMSE gains of 62.38% and 37.02%, respectively. However, for the EGIE3 asset, the hybrid model did not outperform naive forecasting, HAR-RV, or pure LSTM, with statistically significant accuracy differences. A control simulation on random noise revealed that part of the absolute level of error metrics stemmed from the overlap of the 20-day volatility window, and not exclusively from genuine predictive content, reinforcing the importance of relative comparisons between models.
In practical terms, the study offers a relevant tool for strategic risk management in the energy sector, providing a measurable and statistically validated improvement for organizations already using GARCH. However, for those without a prior commitment to this framework, simpler alternatives, such as HAR-RV or pure LSTM, may be more suitable due to lower computational cost and greater interpretability. The work’s limitations included the restriction to endogenous variables and the exclusive focus on the EGIE3 asset, which limits the generalization of the findings. The “black-box” nature of LSTM also posed challenges to interpretability. For future studies, it is suggested to extend the rigorous benchmarking protocol to a diversified basket of assets in the electricity sector, incorporate exogenous variables such as macroeconomic indicators and sentiment analysis, and explore alternative combination architectures between GARCH and neural networks.
Bibliographic References
EMPRESA DE PESQUISA ENERGÉTICA (EPE); MINISTÉRIO DE MINAS E ENERGIA (MME). Balanço Energético Nacional 2025: Ano Base 2024. Relatório Final. Rio de Janeiro: EPE, 2025. Disponível em: https://www.gov.br/mme/pt-br/assuntos/noticias/brasil-gera-88-da-sua-energia-eletrica-a-partir-de-fontes-renovaveis
ERBER, Pietro. Desafios da Transição Energética. GESEL/UFRJ. Rio de Janeiro, 2024. Disponível em: https://gesel.ie.ufrj.br/wp-content/uploads/2024/03/Erber_2024_03_07.pdf
LEITE, André Luis da Silva; DE CASTRO, Nivalde José; TIMPONI, Raul Ramos. Causas da volatilidade do preço spot de eletricidade no Brasil. Ensaios FEE, Porto Alegre, v. 34, n. 2, p. 647-668. 2013. Disponível em: https://revistas.planejamento.rs.gov.br/index.php/ensaios/article/download/2551/3182
RIBEIRO, Luísa Helena Machado
Article originating from the Final Course Project of the Specialization in Data Science and Analytics of the MBA USP/Esalq
To learn more about the course, click here and access the MBX Academy platform