October 16, 2026
Dashboard data for consumption forecasting and anomaly detection in an electric distributor
Dashboard Data for Consumption Forecasting and Irregularity Detection in an Electric Distribution Company
Othon Soares Nascimento; William Barbosa
DOI: 10.22167/2675-6528-202603331
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
Statistical modeling with panel data was applied to estimate electricity consumption and signal units with atypical behavior, potentially associated with non-technical losses. The objective was to model monthly electricity consumption, controlling for structural differences between consumer units and common monthly variations, in order to identify persistent deviations from the expected pattern and support the prioritization of inspections for potential non-technical losses. Monthly series of 60 measurement cycles from consumer units were analyzed, in a balanced panel, after data cleaning and removal of extreme values. A two-way fixed-effects model (unit and month) was estimated, using simple operational variables (12-month moving average and consumption drop indicator). The distribution of standardized residuals was used to generate a classification of deviation persistence over the last twelve months. The model showed a good fit (R2=0.722) and indicated a positive association between expected consumption and recent history, as well as an additional reduction effect when the month was marked by a drop. As an applied product, the classification by average z highlighted units with systematic deviations, offering an objective criterion for prioritizing inspections. It was concluded that the approach is simple, interpretable, and suitable for supporting operational decisions, with the potential for efficiency gains in target selection.
Keywords: clustering; efficiency; fraud; non-technical losses; sustainability.
1. Introduction
The Brazilian electricity sector is one of the most complex and strategic in the national economy, being fundamental for the country’s development. In 2023, electricity consumption in Brazil reached 532 TWh, representing an expansion of 4.4% compared to the previous year (Energy Research Company, 2024). This sector is responsible for ensuring the energy supply to more than 85 million consumer units throughout the national territory, according to data from the National Electric System Operator (2020). The sector’s structure is divided into four main segments: generation, transmission, distribution, and commercialization of electricity. Among these, the distribution segment, which carries energy from substations to final consumers, is the focus of this study.
Currently, Brazil has approximately one hundred electricity distribution concessionaires, including public, private, and cooperative companies. Large distributors, such as Enel, Neoenergia, CPFL, and Equatorial, serve millions of customers in urban and rural areas with varying levels of complexity. These companies face significant challenges, including high rates of non-technical losses, the growth of distributed generation, increased non-payment and litigation, and the need for infrastructure modernization, which requires investments in smart grids and process digitalization.
Energy losses refer to the generated electrical energy that passes through transmission lines and distribution networks but is not commercialized, either for technical or commercial reasons (Agência Nacional de Energia Elétrica, 2021). These losses are defined as the difference between the electrical energy acquired by distributors and that billed to their consumers, and they are classified as technical and non-technical. Non-Technical Losses (NTL), also known as commercial losses, result mainly from theft, such as illegal connections or direct diversions from the grid, and energy fraud, which involves meter tampering, popularly known as “taps”.
The regulatory values of Non-Technical Losses (NTL), recognized in the energy tariff, are calculated by the National Electric Energy Agency through a methodology that compares the performance of distributors, considering efficiency criteria and socioeconomic characteristics of the concession areas. According to ANEEL’s Regulatory Resolution 1000/2021 (2021), the cost difference between the regulatory and actual value is the concessionaire’s responsibility. Non-technical losses generate significant economic, social, and environmental impacts. Economically, they represent direct losses for distributors and are often passed on to consumers through higher tariffs, affecting the sector’s competitiveness and the population’s purchasing power.
In the social aspect, energy theft is often associated with areas of vulnerability, where there is less access to quality public services, which reinforces inequalities and hinders the universalization of the service. Environmentally, energy waste implies a greater need for generation, potentially increasing greenhouse gas emissions, especially when fossil fuels are used. Thus, the reduction of non-technical losses not only improves the operational efficiency of distributors but also contributes to social justice and environmental sustainability.
Internationally, several countries face similar challenges. Successful experiences in Mexico and Colombia, for example, demonstrated the possibility of significantly reducing non-technical losses, from approximately 15% and 16% in 2010 to 11% and 8% in 2020, respectively (PwC Strategy&, 2020). These reductions were achieved through strategies such as the digitalization of the reading and payment cycle, engagement with local communities, and the use of smart meters. Such approaches highlight that the combination of technology, public policies, and social engagement can be effective in mitigating losses.
Thus, combating non-technical losses (NTL) is crucial for the financial sustainability of distributors and for society in general. The traditional method used by distributors to correct these distortions is to conduct inspections at customer facilities. However, due to the high number of consumers, it becomes essential to optimize the identification of customers with losses, directing the combating actions only to installations with prior indications of irregularity. The application of modeling and machine learning techniques has become increasingly common to automate this selection process.
The fight against commercial electricity losses is a widely discussed topic in academic works, given its importance for the efficiency and sustainability of distribution systems. Several studies explore methods and techniques to identify and mitigate these losses. For example, Souza and Teive (2021) used a support vector machine classifier to identify fraudulent load curves in commercial consumers. Souza (2010) developed a methodology to estimate residential consumption load curves without direct measurements, based on the estimation of component electrical equipment and verification of deviations. Villar-Rodriguez (2017) employed an elastic measure of similarity between consumption curves to accommodate the temporal variability of patterns, focusing on the shape patterns of the curves.
Given the need for more effective methods to identify atypical consumption patterns, this study is justified by the search for an approach that optimizes inspection prioritization. The objective of this study is to model monthly electricity consumption with panel data, controlling for structural differences between consumer units and common monthly variations, to identify persistent deviations from the expected pattern and, thereby, support the prioritization of inspections associated with possible non-technical losses.
2. Material and Methods
This research adopted a quantitative approach, based on panel data analysis, with the objective of modeling the electricity consumption of consumer units. The study sought to identify persistent deviations from the expected consumption pattern, aiming to support the prioritization of inspections associated with possible non-technical losses. For this purpose, statistical modeling was employed that controlled for structural differences between units and variations common to the months.
The data used were internal operational records from a Brazilian electricity distribution company. Monthly series of 60 measurement cycles were collected for each unit, covering the period from 2020 to 2025. The database constituted a balanced panel with monthly periodicity and longitudinal structure. To ensure privacy, the data were anonymized, and the reported results are aggregated, without identification of units or individuals. All processing occurred in a controlled environment.
The initial sample for the trials consisted of 120 thousand consumer units, selected randomly. In the preparation process, records with inconsistencies, missing values, and units with cut-off or low status, which represented extreme values, were excluded. Consumers from rural areas, whose high seasonality could compromise the model’s stability, were also removed. The final sample focused exclusively on low-voltage consumers, considered more homogeneous for the study’s objectives.
The data preparation stage included cleaning and standardization. Extreme values were removed using the interquartile range (IQR), applied individually for each month of the time series. The data were converted from wide format to long format, where each row represented a consumption observation per unit and per month. To ensure chronological ordering, the `MES_LABEL` variable was created, which standardized the months from -60 (oldest) to 0 (current month).
The study’s response variable was the monthly electricity consumption, named `CONSUMO_MES_ATUAL`, expressed in kilowatt-hours (kWh). This variable corresponded to the amount of energy effectively recorded in the last measurement cycle for each consumer unit. The choice of this continuous and quantitative variable allowed the application of appropriate statistical models for panel data, enabling the joint analysis of temporal variations and heterogeneities among consumers.
The explanatory variables initially considered included information on consumer profile, geographical location, technical characteristics of the electrical grid, meter type, tariff structure, and consumption history. However, the final model specification used only operational variables of direct interpretation as explicit regressors: the 12-month moving average (`MED12M`) and a binary indicator of atypical consumption drop (`QUEDA`).
The two-way fixed effects model was specified to simultaneously control for time-invariant structural differences between consumer units and common shocks to all consumers in each period. The estimated equation was `yit = αi + λt + β1MED12Mit + β2QUEDAit + εit`. In this formulation, `yit` denoted the monthly consumption of unit `i` in month `t`, `αi` represented the unit fixed effect, and `λt` the month fixed effect.
The `MED12Mit` variable corresponded to the 12-month moving average of consumption of unit `i` in month `t`, capturing the temporal persistence of consumption. `QUEDAit` was a binary indicator of atypical consumption drop, signaling months with an unusual reduction in measured consumption compared to the unit’s own history, unrelated to supply interruptions. The term `εit` represented the random error of the model.
The model estimation was performed by the ordinary least squares method (OLS), which minimizes the Residual Sum of Squares. For statistical inference, the standard errors were calculated by a robust estimator to heteroscedasticity of type HC1, according to White (1980). This approach ensured the validity of statistical tests even in the presence of non-constant variance of the residuals, a common condition in operational data with great heterogeneity.
After adjusting the model, residuals were obtained for each unit and month. To make the deviations comparable between periods, the residuals were standardized by month, generating a `Zit` score. This score represented the relative deviation of the observed consumption from the expected consumption in that period. To construct the prioritization indicator, the absolute value of these scores over the last 12 months was aggregated, producing an average of `|Z|` that signaled the persistence of systematic deviations.
For the development of the exploratory data analysis, the Python programming language, version 3.10.12, was used. The analysis was conducted with the support of the libraries matplotlib, seaborn, and numpy. These tools allowed the generation of time series graphs, box plots, and scatter plots, which aided in the identification of seasonal patterns, trends, extreme values, and possible anomalies, providing subsidies for subsequent statistical modeling.
3. Results and Discussion
The analysis of the results began with a descriptive evaluation of monthly electricity consumption, aiming to characterize the aggregate behavior of consumer units over time and identify moments of asymmetry and dispersion in the distribution. It was observed that the median consumption, which represents the “center” of the distribution, remained more stable compared to the mean during part of the analyzed period, while the mean showed more pronounced shifts in some months. This discrepancy is a classic indicator of the influence of extreme values on the average consumption level, suggesting that the distribution had heavier tails or asymmetry. The median, in this context, more accurately reflects the typical behavior of the majority of units, while the mean is more sensitive to a few extreme cases.
The presence of extreme values was notable in specific months, such as January and December 2021, February and December 2022, October and December 2024, and February 2023. During these periods, the difference between the mean and the median was more pronounced, accompanied by high standard deviation values. Such atypical variations in consumption could compromise the robustness of subsequent analyses and the quality of statistical models, justifying the need for prior data treatment. The persistence of these extreme observations, even if not representing measurement errors, could distort statistical measures and model parameter estimation, given their disproportionate influence.
To mitigate the impact of these extreme values and ensure the consistency of consumption time series, an interquartile range (IQR) based removal procedure was applied, individualized for each month of the series. This approach allowed for the preservation of the temporal structure of the data, while contributing to greater robustness and representativeness of the analyses. After cleaning, a significant improvement in the consistency of consumption time series was observed, with the mean and median curves approaching each other and a visible reduction in standard deviation and interquartile range, indicating lower data dispersion and a more stable and reliable dataset for predictive modeling.
Subsequently, the monthly electricity consumption was modeled using a two-way fixed effects model, incorporating a specific effect per consumer unit and a specific effect per month. This specification allowed for the simultaneous control of time-invariant structural differences between units and common shocks to all consumers in each period. The persistent characteristics of each unit, such as usage profile and load composition, are absorbed by the unit’s fixed effect, while common variations, such as seasonality and conjunctural shocks, are captured by the month’s fixed effect. This separation is crucial for producing a reference of expected consumption for each unit in each period, allowing for a consistent evaluation of deviations.
The operational explanatory variables chosen for the model were the 12-month moving average (MED12M) and the binary indicator of atypical consumption drop (QUEDA). MED12M was included to capture the temporal persistence of consumption, reflecting the tendency for usage patterns to repeat over the months. Empirically, an increasing relationship was observed between current consumption and the MED12M deciles. For example, in the lower decile (23.2 to 34.8 kWh), the average consumption was 22.6 kWh, while in the upper decile (197.1 to 1,978.9 kWh), this value jumped to 285.2 kWh. This evidence reinforces the importance of recent history for forecasting expected consumption.
The FALL indicator, in turn, signals months with an atypical reduction in measured consumption compared to the unit’s own history, without being related to supply interruptions. Its inclusion in the model allowed testing whether, after controlling for the fixed effects of the unit and the month, there would still be an additional average decline associated with these events. The model estimation was performed using Ordinary Least Squares (OLS) with robust standard errors to heteroscedasticity of type HC1, according to White’s procedure (1980), ensuring inferences less sensitive to variations in the dispersion of residuals between months and units.
The model metrics demonstrated a good within-panel explanatory capacity. With 120,000 observations, the R² obtained was 0.722 and the adjusted R² was 0.717, values that support the adequacy of the combination of unit and month fixed effects, MED12M and QUEDA for the analyzed problem. The Durbin-Watson statistic, with a value of approximately 1.94, suggests low first-order residual autocorrelation, while the high kurtosis (8) indicates the presence of heavier tails in the distribution of residuals, an expected behavior in databases with a large volume of consumers and the presence of extreme observations, even after initial cleaning.
Regarding the coefficients of the regressors of interest, the MED12M variable presented a positive coefficient of 0.0077, with high statistical significance (p < 0.001). This result corroborates the thesis of consumption persistence, indicating that the higher the average recent consumption of a unit, the higher the expected consumption in the current month, all other conditions being equal. This fine-tuning is fundamental to directing the expected consumption level of each unit, complementing the fixed effects that already capture the individual structural component and the monthly conjunctural component.
In contrast, the FALL indicator obtained a negative coefficient of -1.4328, also with high statistical significance (p < 0.001). This means that when a month is marked by an atypical drop in consumption, there is an additional decline relative to the expected pattern, even after considering the structural differences between the units and the month’s context. These findings reinforce the model’s ability to identify consumption patterns and deviations that may be relevant for detecting non-technical losses, providing a solid basis for building a prioritization indicator.
The results indicate that the model was effective in capturing a relevant part of the variability in electricity consumption, incorporating both structural differences between consumer units and the temporal variations common to the analyzed months. The selected variables demonstrated behavior consistent with expectations, reinforcing the adequacy of the adopted specification for estimating the expected consumption of the facilities. From these estimates, the standardized residuals became the main measure of deviation between observed and expected behavior, serving as the basis for constructing the persistence indicator used in prioritizing consumer units with potential indications of non-technical loss.
For operational purposes, the analysis is not based on a single error metric, but rather on standardized residuals per month. These residuals translate the deviation of observed consumption relative to expected consumption, after controlling for the fixed effects of the unit and the period. This standardization results in a z-score for each unit and month, which quantifies the relative deviation of observed consumption compared to the estimated standard in that monthly context. To capture the persistence of atypical behavior, regardless of the direction of the deviation, the absolute value of the z-score (|z|) was used, so that negative and positive deviations contribute equally to the indicator, both representing a relevant departure from the expected standard.
The consolidated classification for prioritizing inspections was built from the average of the absolute value of z over the last twelve months, reflecting the average intensity of the deviation over the recent period. The higher the average of |z|, the more systematically the unit behaved in a way distant from the pattern estimated by the model, becoming a priority case for evaluation. It is important to emphasize that this indicator should not be interpreted as “proof” of irregularity, but rather as an objective ordering criterion that combines the frequency and magnitude of deviations. Thus, it proves useful for directing inspection resources to cases with a greater persistence of atypical behavior.
The analysis of the consolidated classification highlighted the units with the highest average |z| values in the considered time frame. For example, Installation 01 presented an average of 3.80, followed by Installation 02 with 3.67 and Installation 03 with 3.19. These units are those in which the observed consumption most frequently deviated from the consumption expected by the model, even after structural and seasonal controls. Such findings suggest the need for a detailed analysis from an operational perspective, which may include checking history, prior inspections, and registration consistency, before any field decision.
Compared to the literature, the findings of this study converge on the central objective of identifying and prioritizing atypical consumption patterns, but differ in the methodological approach and the type of evidence generated. While studies such as those by Souza and Teive (2021) and Villar-Rodriguez (2017) explore the detection of irregularities with a focus on curve classification and similarity, and Souza (2010) works on building profiles for deviation comparison, the present work favors an econometric approach with panel data. This methodology explicitly controls for unobserved heterogeneity and common period shocks, delivering as its main output a ranking based on the persistence and magnitude of standardized deviations over twelve months.
The practical contribution of this work lies in offering a transparent ordering mechanism that transforms residual variation, after due controls, into a decision criterion. This approach is compatible with the operational need to select targets under inspection capacity constraints, optimizing resource utilization. Although the study was conducted with a sample base, which restricts automatic extrapolation of results to the entire population, the evidence obtained suggests that the model captures relevant consumption regularities and generates an interpretable classification for screening in the analyzed set.
The study’s main limitation lies in external validity, i.e., the generalization of results to the entire consumer population, rather than in the usefulness of the procedure as a prioritization tool. As a continuation, large-scale application and validation against field results will allow performance assessment, cutoff point calibration, and consolidation of the operational use of the classification. Future work can explore robust metrics, such as standardization by median and Median Absolute Deviation (MAD), and composite indicators that combine persistence, severity, and frequency of deviations, in addition to incorporating additional contextual variables and supervised techniques to increase precision, while always preserving the interpretability necessary for the operational environment.
In summary, the research demonstrated that modeling monthly electricity consumption with panel data, using fixed effects and simple operational variables, is an effective approach to identify persistent deviations from the expected pattern. The model, with its good fit and the interpretability of its coefficients, allowed for the construction of an objective indicator for prioritizing inspections, transforming historical data into actionable information and supporting operational decisions for combating non-technical losses.
4. Conclusion
This study sought to model monthly electricity consumption using panel data, controlling for structural differences between consumer units and common monthly variations, in order to identify persistent deviations from the expected pattern and support the prioritization of inspections for potential non-technical losses. It was found that data cleaning, by removing outliers using the interquartile range, was crucial to ensure the robustness of the analyses. The estimation of a two-way fixed-effects model (unit and month) showed a good fit, with an R² of 0.722, and indicated that the twelve-month moving average showed a positive and statistically significant association with expected consumption, corroborating the persistence of the usage pattern. Additionally, the indicator of atypical consumption drop obtained a negative and significant coefficient, signaling a further decrease in consumption when such an event occurred. These findings allowed for the construction of a deviation persistence classification, based on the average absolute value of standardized residuals over the last twelve months, which offers an objective and interpretable criterion for prioritizing inspections, optimizing the allocation of operational resources in combating non-technical losses.
The main limitation of the study lies in the external validity of the results, as the analysis was conducted with a sample base, restricting automatic generalization to the entire consumer population. However, the usefulness of the procedure as a prioritization tool was demonstrated in the analyzed set. As a continuation, it is suggested to apply the model on a larger scale and validate its results against field data, which will allow for the calibration of cutoff points and consolidate its operational use. Future work can explore robust standardization metrics, such as the median and the Median Absolute Deviation (MAD), in addition to developing composite indicators that combine the persistence, severity, and frequency of deviations. The incorporation of additional contextual variables and the use of supervised techniques, in scenarios with labeled data, can also increase the accuracy in detecting irregularities, always preserving the interpretability essential to the operational environment.
Bibliographic References
Agência Nacional de Energia Elétrica [ANEEL]. 2024. Perdas de Energia Elétrica na Distribuição. Disponível em: <https://git.aneel.gov.br/publico/centralconteudo//raw/main/relatorioseindicadores/tarifa economico/Relatorio_Perdas_Energia.pdf>. Acesso em: 15 mar. 2025.
Empresa de Pesquisa Energética [EPE]. 2024. Anuário Estatístico de Energia Elétrica. Disponível em: <https://www.epe.gov.br/pt/publicacoes-dados- abertos/publicacoes/anuario-estatistico-de-energia-eletrica>. Acesso em: 15 mar. 2025.
Operador Nacional do Sistema Elétrico [ONS]. 2025. O Planejamento da Operação Energética no Sistema Interligado Nacional: conceitos, modelagem matemática, previsão de geração e carga. Disponível em: <https://www.ons.org.br/AcervoDigitalDocumentosEPublicacoes/O%20Planejamento% 20da%20Operacao%20Energ%C3%A9tica%20no%20Sistema%20Interligado%20Naci onal%20conceitos,%20modelagem%20matem%C3%A1tica,%20previs%C3%A3o%20 de%20gera%C3%A7%C3%A3o%20e%20carga.pdf>. Acesso em: 18 maio 2025.
PwC Strategy&. 2020. Proposições para os problemas das perdas não técnicas na distribuição de energia elétrica. Disponível em: <https://www.strategyand.pwc.com/br/pt/no- pensamos/Proposicoes_para_os_Problemas_das_Perdas_Nao_Tecnicas_na_Distribui cao_de_Energia_Eletrica_A4_07Dez2020_VF.pdf>. Acesso em: 18 maio 2025.
Souza, A.N. de; Costa Junior, P. da; Oliveira, R. de; Zago, M.G.; Papa, J.P.; Gastaldello, D.S. 2010. Algoritmos para estimar curvas de cargas a partir de padrões de hábitos de consumo. In: Brazilian Conference on Dynamics, Control and Their Applications (DINCON), 2010, Serra Negra, SP, Brasil. Anais… p. [páginas inicial-final].
Souza, L.E. de; Teive, R.C. 2021. Aprendizagem de máquina aplicada a consumidores comerciais buscando identificar padrões atípicos de consumo de energia elétrica utilizando o software R. In: Computer on the Beach, 2021, [Cidade], [Estado], Brasil. Anais… p. 408-413.
Villar-Rodriguez, E. 2017. Detection of non-technical losses in smart meter data based on load curve profiling and time series analysis. Energy 137: 118-128.
White, H. 1980. A heteroskedasticity-consistent covariance matrix estimator and a direct test for heteroskedasticity. Econometrica 48(4): 817-838.
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