Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11, 839-852 2025 Publisher: Learning Gate DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate Β© 2025 by the authors; licensee Learning Gate History: Received: 4 September 2025; Revised: 14 October 2025; Accepted: 17 October 2025; Published: 13 November 2025 * Correspondence: rebazy34@gmail.com Bayesian hybrid Kalman filter auto-regressive for smarter electricity load forecasting Rebaz Othman Yahya1*, Kurdistan Ibrahim Mawlood2 1,2Department of Statistics, College of Administration and Economics, Salahaddin University-Erbil, Kurdistan Region, Iraq; rebazy34@gmail.com (B.O.Y.). Abstract: Energy management efficiency requires highly accurate electricity load forecasting, especially in dynamic and complex environments. This study presents the Bayesian Hybrid Kalman Filter Auto- Regressive (BAR-KF) model as an advanced technique for improving load forecasting accuracy. This hybrid framework addresses the fundamental limitations of the autoregressive model and the Kalman filter model in previous works by better handling non-stationarity and model uncertainty through Markov Chain Monte Carlo (MCMC) methods in estimating the posterior of AR parameters, which are subsequently integrated into the Kalman filter framework. The analysis of hourly electricity consumption data demonstrates the model's ability to capture temporal dependencies and provide probabilistic forecasts that offer a better understanding of possible load ranges. The results offer valuable insights into the dynamics of electricity consumption, aiding policymakers and grid experts in building greater operational resilience, distributing load more effectively, and consequently improving forecast accuracy. The interaction between the MCMC-derived model parameters and their adaptive mechanisms enhances the robustness of the Kalman filter, making the forecast model more responsive to innovative approaches for electricity demand. Keywords: Autoregressive modelling, Electricity load forecasting; Kalman filter, Markov chain monte Carlo, Probabilistic forecasting. 1. Introduction Electricity load forecasting plays an important role in energy management systems for reliable power supply, optimization of energy resources, and reduction in operational costs. In these dynamic and complex environments, the relevance of appropriate forecasting models, which can predict the future demand for electricity, becomes highly significant. So far, the Bayesian Auto-Regressive Kalman Filter BAR-KF has emerged as an advanced technique in which Bayesian estimation is integrated with auto-regressive modeling and Kalman filtering to improve the accuracy of load forecasting. This introduction covers the theoretical basics, advantages, and applications of BAR-KF in the context of load electricity forecasting, referencing relevant works. Electricity load forecasting involves the prediction of future electrical demand from historical data and a variety of factors that determine it [1, 2]. The Kalman filter was originally developed by Kalman [3] to give an optimum estimate of the state of a linear dynamic system from noisy observations [4, 5]. It predictively updates the state estimates recursively with minimum error covariance. The traditional Kalman filter is reasonably effective when working with linear systems that assume Gaussian noise; however, it may fall short in performance related to non-stationary data or when model parameters are not well known [6, 7]. Bayesian methods update the incrementing probabilities of a hypothesis when evidence is acquired and have provided a robust framework for incorporating uncertainty and prior knowledge into https://orcid.org/0000-0001-8954-9275 https://orcid.org/0000-0002-1612-1996 840 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate forecasting models [8, 9]. In load forecasting, Bayesian inference dynamically adjusts based on both historical data and current observations to enable adaptiveness in the forecasting model [10, 11]. In general, time series forecasting employs an autoregressive (AR) model that predicts future values based on previous observations alone [12, 13]. Even though AR models capture temporal dependencies effectively, they assume that in most cases the data follows a linear structure, which may not hold in realistic cases. Merging AR models with Kalman filtering and Bayesian inference will surmount these deficiencies by modeling model uncertainty and adjusting to potential non-stationarity in the data [14, 15]. The Bayesian Auto-Regressive Kalman Filter or BAR-KF combines features of Bayesian inference, AR modeling, and Kalman filtering to improve the accuracy of load forecasting. The BAR-KF framework considers the AR model parameters to be random variables with assigned prior distributions, thus enabling a more robust and adaptive estimation [16, 17]. This Bayesian approach explicitly takes into account model uncertainty and automatically adapts to changing data patterns. In this regard, it overcomes the limitations of previous AR and Kalman models [18, 19]. In BAR-KF, the Kalman filter recursively projects forward and updates the state, while Bayesian inference is used to estimate parameters of the AR model. Incorporating these into a single algorithm enables the filter to dynamically adapt the predictions with the incoming data and prior information, thereby improving its robustness and accuracy [20, 21]. BAR-KF will also be able to capture the time- evolving nature of a non-stationary load pattern and model the uncertainty in the forecasting process through modeling prior distributions and updating them based on new data [22] and Liu and An [23]. One of the biggest advantages of BAR-KF is that it can provide probabilistic forecasts, not just point estimates. In fact, this offers quantification of uncertainty in load forecasting that is, better decisions and risk management can be informed by understanding the range of possible demands in the future [24, 25]. More importantly, external factors and domain knowledge can be encapsulated into the Bayesian framework to improve the model's forecast performance accordingly [26, 27]. BAR-KF has been used in many domains under the heading of load forecasting, which includes residential, commercial, and industrial sectors. In residential load forecasting, it is performed using historical data of electricity consumption and weather variables to predict consumption patterns [28, 29]. In the case of commercial and industrial purposes, the filter optimizes energy usage by correctly estimating peak load demand and identifying possible opportunities for energy savings [30, 31]. Advancements in computational techniques and algorithms have been very effective in making BAR-KF more efficient. Some of the methods employed to achieve these improvements are particle filtering and MCMC methods that better evaluate the posterior distribution of the AR parameters, which further refine the filtering process [32, 33]. Corresponding challenges in high-performance computing and parallel computation also made the real-time application of BAR-KF with large amounts of data possible [34, 35]. Fusing machine learning algorithms with BAR-KF is another promising development that warrants further improvement. This may help to enhance the sophisticated yet probabilistic adaptive creeping behavior of BAR-KF by capturing non-linearities and feature interactions present in the load series [36, 37]. This is the approach that quite interestingly combines both traditional, statistical approaches and modern, machine learning techniques to produce accurate load forecasting [38, 39]. The BAR-KF is a generic linear model in electricity load forecasting, in light of the great innovation that it possesses: Bayesian approaches combining modeling with Kalman. In this manner, the BAR-KF resolves the illustrated limitations by fixed forecasting techniques in power prediction and adds some average probabilistic and adaptive mechanics for the prediction of future electricity requirements. That is, constant theories and the enhancement of technology keep the grounds of the system developing more and more. It has grown to be quite a beneficial tool in optimizing energy management and decision- making in complex and dynamic environments. 841 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate 2. Literature Review 2.1. Bayesian Model in Load Electricity Forecasting As much as there are vital tasks that resemble electricity load forecasting, one specific task stands out, and that is inferring from the previous data, taking into consideration the demands that will be made in the coming days based on several factors influencing that basic economic need. It has been identified that, more often than not, conventional methods of load forecasting, which are most commonly used, fall short in tracking internal variations and the time dimension in electricity load data. Bayesian equations provide a powerful framework in which prior knowledge can be incorporated, and the quantification of uncertainty in the predictions is enabled. This section discusses Bayesian equations, their application in electricity load forecasting, and the advantages of such an approach over traditional methods [40]. It has been mentioned above that Bayesian equations find their roots in Bayesian inference. It is due to Thomas Bayes that the term is derived from. The term Bayesian inference involves a way to modify the likelihood of a certain hypothesis based on obtaining further corroborative evidence. It presents a mechanism for revising the estimate of a given parameter's probability based on prior knowledge and the observed data, through the application of Bayes' theorem [41]. Bayes' theorem is mathematically expressed as: 𝑃( πœƒ ∣∣ 𝑦 ) = 𝑃( 𝑦 ∣∣ πœƒ ) β‹… 𝑃(πœƒ) 𝑃(𝑦) (1) where: β€’ 𝑃( πœƒ ∣∣ 𝑦 ) is the posterior probability of the parameter πœƒ given the data 𝑦. β€’ 𝑃(𝑦 ∣ πœƒ) is the likelihood of the observed data 𝑦 given the parameter πœƒ. β€’ 𝑃(πœƒ) is the prior probability of the parameter πœƒ. β€’ 𝑃(𝑦) is the marginal likelihood or evidence, ensuring that the posterior probabilities sum to one 2.2. The Kalman Filter The Kalman filter is an intricate computation procedure employed in estimating the parameters of a dynamic linear system through the successive acquisition of a set of measurements, which may be affected by some form of noise. This makes it particularly attractive for real-time systems, which require a constant estimation of the state. In the case of electricity load forecasting, the Kalman filter with a comprehensive model makes for a good arrangement that attempts, relying on historical records and a handful of other variables, to compute the future demand for power. This paper presents a brief overview of the Kalman filter and its basic mathematical concepts, as well as its implementation in load forecasting of electricity [42]. 2.3. The Auto Regressive Model AR (1): Time series analysis can also be performed using the AR(1) model, which is both simple and effective in associating an observation with its preceding one. This relationship can be expressed in a mathematically straightforward manner, as Yang et al. [43] and Roy and Karmakar [44]. 2.4. Markov Chain Monte Carlo (MCMC) Markov Chain Monte Carlo (MCMC) methods are a broad category of computational approaches used to generate posterior samples and estimate integrals. In Bayesian analysis, MCMC methods are frequently employed to create simulated samples in order to approximate the posterior distribution. For generating posterior samples, the Metropolis-Hastings (MH) algorithm is a popular principle in Bayesian analysis according to Khidir et al. [45]. 842 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate 3. Methodology This study utilized the recorded dataset on electricity load for 2024, provided by the Erbil Electricity Control Directorate. The dataset consists of 8,760 observations, with each observation representing the daily electricity load in Erbil, the capital of the Kurdistan region of Iraq. Before training the model, several preprocessing steps were carried out on the dataset. First, an inspection for missing values indicated that none were present. Additionally, the original dataset was not stationary, so a first-difference transformation was applied to achieve stationarity. 3.1. Bayesian Hybrid AR-Kalman Filter Model 3.1.1. State and Observation Models Using Kalman filter methodology, the state of the system vector is defined as the electricity load at time t, and the measurement model describes how this state, the so-called system state, relates to the measurements [46]. The state transition equation for load forecasting can be written as 𝑋𝑑 = πΉπ‘‘π‘‹π‘‘βˆ’1 + π‘Šπ‘‘ (2) Where 𝑋𝑑 is the Current State, 𝐹𝑑 is the transition matrix and π‘Šπ‘‘ is the process noise with covariance 𝑄𝑑 i.e., π‘Šπ‘‘~𝑁(0, 𝑄𝑑). The predicted load to the actual measurements to the observation model is: 𝑍𝑑 = 𝐻𝑑𝑋𝑑 + 𝑉𝑑 (3) Where 𝑍𝑑 are the measurements of the true state 𝑋𝑑 , 𝐻𝑑 is the measurement function or (matrix) and 𝑉𝑑 is the measurement noise with covariance 𝑅𝑑 i.e., 𝑉𝑑~𝑁(0, 𝑅𝑑) 3.1.2. Integration of Auto Regressive with Kalman Filtering Algorithm: AR (1) can be expressed mathematically as below: 𝑍𝑑 = πœ™π‘‹π‘‘βˆ’1 + πœ–π‘‘ (4) 𝑍𝑑 is the load value at t. πœ™ is the AR coefficient. πœ–π‘‘ is white noise distributed with (mean= 0 and variance= πœŽπœ– 2 in order to introduce the AR model in the framework of the Kalman Filter, we consider AR coefficients to be the state variables. Definition of a State Vector [47]. 𝐹 = [ π“π’Š 1 ] 3.1.3. Prediction Step (State and Covariance) State Prediction: �̂�𝑑|π‘‘βˆ’1 = πœ™π‘–οΏ½Μ‚οΏ½π‘‘βˆ’1|π‘‘βˆ’1 (5) Here, πœ™π‘– is the sample from the posterior distribution of πœ™π‘–. β€’ Covariance Prediction Similarly, the covariance prediction depends on πœ™π‘– (from the posterior) and the process noise 𝑄: �̂�𝑑|π‘‘βˆ’1 = πœ™π‘– 2οΏ½Μ‚οΏ½π‘‘βˆ’1|π‘‘βˆ’1 + 𝑄 (6) Where 𝑄 is the process noise, and πœ™π‘– is sampled from the posterior distribution. β€’ Update Step (State and Covariance) β€’ Kalman Gain: The Kalman gain 𝐾𝑑 is computed based on the predicted covariance and the measurement noise covariance 𝑅, as usual: 843 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate 𝐾𝑑 = �̂�𝑑|π‘‘βˆ’1 �̂�𝑑|π‘‘βˆ’1 + 𝑅 (7) β€’ State Update The state estimate �̂�𝑑|π‘‘βˆ’1 is updated based on the predicted state and the observation data 𝑍𝑑 �̂�𝑑|π‘‘βˆ’1 = �̂�𝑑|π‘‘βˆ’1 + 𝐾𝑑(𝑍𝑑 βˆ’ �̂�𝑑|π‘‘βˆ’1) (8) β€’ Covariance Update: The Covariance estimate is updated as follows: �̂�𝑑|𝑑 = (1 βˆ’ 𝐾𝑑)�̂�𝑑|π‘‘βˆ’1 (9) 3.2. Model Implementation and Parameter Tuning The suggested technique offers a reliable way to analyze dynamic time series data by combining the estimation of the AR (1) parameter using MCMC with its integration into the Kalman Filter architecture. An accurate AR (1) parameter (πœ™), which is a crucial input for the state prediction equation in the Kalman Filter, is produced by the MCMC-based estimate step, which also captures the temporal dependencies and uncertainty in the data. The filter can now balance real-time observations and past dependencies owing to this connection, producing accurate state estimations and increased forecast accuracy. As more observations are added, state estimates closely match the actual dynamics of the system because of the Kalman Filter's iterative nature, which guarantees convergence over time. 4. Results The dataset's Bayesian AR (1) MCMC analysis shows important new information about the patterns of electricity use over a 24-hour period, including its acceptance rate, variability, and temporal dependencies. This research reveals subtle predictability and variability influenced by temporal and external influences by highlighting important correlations between autoregressive coefficients (πœ™), noise variances (𝜎²), and acceptance rates. 844 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate Table 1. Descriptive statistics of the posterior distribution. Hour Phi Sigma2 Acceptance Rate Mean SD CI Lower CI Upper Mean SD CI Lower CI Upper 1 0.8004 0.0321 0.7369 0.8631 0.363 0.0275 0.3132 0.4207 31% 2 0.8440 0.0285 0.7881 0.9001 0.2901 0.0215 0.2517 0.3354 29% 3 0.8676 0.0266 0.815 0.9194 0.2504 0.0188 0.2155 0.2892 27% 4 0.8811 0.0245 0.8328 0.9292 0.2221 0.0162 0.1925 0.2559 25% 5 0.9064 0.0223 0.8623 0.9501 0.1762 0.0133 0.1522 0.2042 23% 6 0.8806 0.0251 0.8315 0.9292 0.2252 0.0167 0.1945 0.2603 26% 7 0.8839 0.0244 0.836 0.9317 0.2171 0.016 0.1879 0.2502 25% 8 0.8406 0.0285 0.7857 0.8961 0.2907 0.0215 0.2514 0.3358 28% 9 0.8103 0.0311 0.7487 0.8705 0.3432 0.0257 0.296 0.3968 30% 10 0.8099 0.0306 0.7497 0.8694 0.3425 0.0256 0.2956 0.3955 30% 11 0.7708 0.0337 0.7046 0.8365 0.4052 0.0299 0.3511 0.4675 32% 12 0.7513 0.0353 0.6824 0.8208 0.4398 0.0329 0.3798 0.5088 33% 13 0.7115 0.0369 0.6393 0.7836 0.4981 0.0369 0.4311 0.576 34% 14 0.716 0.0366 0.6448 0.7883 0.4842 0.0363 0.4173 0.561 34% 15 0.7015 0.0379 0.6276 0.7758 0.5064 0.0376 0.4368 0.5837 35% 16 0.7264 0.0358 0.6554 0.7966 0.4681 0.0352 0.4043 0.5421 34% 17 0.7517 0.0344 0.6847 0.8185 0.427 0.0322 0.3685 0.4936 33% 18 0.7090 0.0366 0.637 0.7814 0.4867 0.0359 0.4207 0.5632 34% 19 0.7420 0.0351 0.6735 0.811 0.4403 0.0331 0.3798 0.5097 33% 20 0.7936 0.0317 0.7311 0.8558 0.3594 0.0270 0.3111 0.4171 31% 21 0.8193 0.0298 0.7613 0.8775 0.3186 0.0238 0.275 0.3689 30% 22 0.8034 0.031 0.7425 0.8639 0.3453 0.0258 0.2983 0.3991 29% 23 0.8239 0.0296 0.7661 0.8818 0.3137 0.0237 0.2708 0.3638 28% 24 0.8473 0.0278 0.7928 0.9020 0.2763 0.0204 0.2394 0.3195 28% Strong temporal dependencies were shown by periods with high autoregressive coefficients (πœ™), where the usage of electricity during the preceding hour had a considerable impact on power consumption. For example, there was substantial autoregressive behavior during hours 24 (πœ™ = 0.85) and 23 (πœ™ β‰ˆ 0.82), indicating great predictability. Hours 4 (πœ™ = 0.88), and 5 (πœ™ β‰ˆ 0.91), also exhibited significant autocorrelation, indicating recurring reliance on previous spending. Moderately high πœ™ values were displayed by hours, such as 8 (πœ™ β‰ˆ 0.84) and 9 (πœ™ β‰ˆ 0.81), which showed a balance between temporal dependence and outside effects. Periods with poor secure reliability, such as 13 ((πœ™ = 0.71) and Hour 14 (πœ™ β‰ˆ 0.72), have lower coefficients, which makes the period less predictable and more affected by outside variables. Unaccounted-for variability is more commonly used by noise variances (𝜎²). Periods with rich values 𝜎² values, as Hour 13 (𝜎² β‰ˆ 0.50) and Hour 15 (𝜎² β‰ˆ 0.51), indicated significant variability that the model was unable to account for, which might be a result of environmental factors or outside disturbances. On the other hand, smaller σ² values were observed during times such as Hour 5 (σ² = 0.18) and Hour 6 (𝜎² β‰ˆ 0.23), which indicated more steady and regular consumption habits. The convergence and sampling efficiency were assessed through the acceptance rate of the Bayesian MCMC model. A slower mixing process was suggested by the research; however, it became evident that the acceptance rate fluctuated throughout the day. For instance, lower values were observed during hours such as Hour 5 (Acceptance Rate β‰ˆ 0.26) and Hour 6 (Acceptance Rate β‰ˆ 0.25). In contrast, a more effective sampling procedure was indicated by higher acceptance rates during hours like Hour 13 (Acceptance Rate β‰ˆ 0.34) and Hour 15 (Acceptance Rate β‰ˆ 0.35). Although the intricacy of the underlying temporal connections and the model's ability to adapt to shifting consumption patterns may be reflected in these variances in acceptance rates, this complexity warrants further investigation. 845 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate Credible intervals (CIs) for Ο• provided valuable insights into the reliability of the model's estimates. Narrow intervals, such as those for Hour 6 (πœ™ CI: [0.83, 0.93]) and Hour 24 (πœ™ CI: [0.79, 0.90]), indicated high confidence in the estimates. In contrast, wider intervals, like those for Hour 13 (πœ™ CI: [0.64, 0.78]) and Hour 18 (πœ™ CI: [0.64, 0.78]), suggested greater uncertainty, possibly due to increased variability or the influence of external factors. The MCMC analysis showed that acceptance rates across all hours ranged between 0.235 and 0.346, comfortably within the recommended range of 20–40% for Metropolis-Hastings algorithms. This balance ensured that the sampler was neither overly cautious nor overly aggressive when proposing new states. As a result, the MCMC algorithm efficiently explored the parameter space, striking a good balance between computational speed and thoroughness. The findings shed light on the complex and dynamic nature of electricity consumption patterns. High predictability and stability were evident during periods with low noise, consistent acceptance rates, and strong autoregressive coefficients. Conversely, variability in acceptance rates, larger noise levels, and weaker coefficients highlighted the importance of incorporating additional external factors into the models. These insights are critical for effectively managing periods of high uncertainty, optimizing grid operations, and improving forecasting accuracy. Figure 1. a) Phi mean value from posterior dist. b) Sigma2 mean value from posterior dist. The results revealed how electricity usage changes over the day. During peak hours, there were clear and consistent patterns, reflecting predictable behavior. In contrast, off-peak hours showed more variation, indicating less predictable and more scattered usage. The AR (1) model worked well when autocorrelation was high, but it might need to be enhanced or additional variables, such as weather or day type, added to improve accuracy during periods of increased unpredictability. All things considered, the Bayesian AR (1) Kalman Filter provided grid managers and energy providers with valuable data to enhance operational resilience, control load distribution, and improve demand forecasting, particularly when temporal dependencies were significant. The mean values taken from the posterior distribution over a 24-hour period are displayed in Figures 1. a and 4. b. Before using the posterior distribution in the Kalman Filter state estimate, it was worth investigating its distribution with trace plots as well as density plots. Thus, the trace plot of phi shows the evolution of the parameter over MCMC iterations. 846 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate Figure 2. Traceplot and density plot illustration for phi as well as sigma square values per hour. Figure 2. As shown, they were all well-behaved traces and exhibited random walk patterns, which indicated good mixing and that the sampler should lead to exploring the parameter space adequately. Since they were all stable and showed no trends, this suggested convergence and reliable estimates. Furthermore, the density plot for phi showed the posterior distribution, with a narrower peak indicating more precise estimates and a wider peak reflecting higher uncertainty. A clear peak suggested the most probable value of phi, which was the case for most of them, while its spread shows the uncertainty in the estimate. Similarly, the trace plot for sigmaΒ² showed random fluctuations without trends, indicating good mixing, and had a narrow peak. 4.1. Kalman Filter Analysis of Electricity Consumption: A Detailed Explanation An indispensable tool for determining the actual level of electricity usage is the Kalman Filter, particularly in cases where the data is ambiguous or noisy. By taking into account both past forecasts and observed data, it continuously improves estimations of the underlying state. The performance of the Kalman Filter over a 24-hour period is examined in this investigation by applying it to actual hourly electricity usage data, as seen in Table 2. 847 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate Table 2. Summary output of the Bayesian Kalman filter. Hour Time Convergence Observed Load Prediction Load Kalman Gain Error Covariance Residuals 1 5 1116.99 1010.5456 0.622 2713.5484 106.4444 2 6 1176.63 1049.3009 0.5906 3131.1345 127.3291 3 6 1167.39 1073.4791 0.6255 3850.5173 93.9109 4 5 1164.765 1088.0967 0.6244 4522.8805 76.6683 5 6 1190.49 1096.0235 0.5784 5580.256 94.4665 6 6 1154.7774 1060.2747 0.5602 5547.5257 94.5027 7 6 1179.9774 1084.0228 0.5996 6091.4368 95.9546 8 6 1154.16 1051.1724 0.6016 5422.6017 102.9876 9 6 1159.62 1040.8104 0.6202 4460.057 118.8096 10 5 1150.8 1042.9467 0.6205 4311.2771 107.8533 11 7 1150.17 1004.7106 0.5922 3336.1508 145.4594 12 6 1179.36 1021.9977 0.624 3272.0486 157.3623 13 5 1161.048 973.8374 0.5993 2939.6201 187.2106 14 6 1186.29 996.8078 0.6152 2668.878 189.4822 15 5 1137.528 971.7136 0.6373 2695.3352 165.8144 16 6 1144.71 997.3896 0.6548 2971.2608 147.3204 17 5 1145.34 990.1312 0.6132 2945.9253 155.2088 18 5 1194.606 1023.0315 0.6375 2771.4142 171.5745 19 6 1163.19 1005.9839 0.6232 2896.3575 157.2061 20 5 1179.486 1063.15 0.6386 3140.748 116.336 21 5 1187.466 1073.185 0.6411 3080.769 114.281 22 6 1166.76 1027.1909 0.6013 2972.2881 139.5691 23 5 1147.608 1025.5494 0.5952 3377.6932 122.0586 24 6 1125.18 1017.5682 0.5635 3094.4716 107.6118 The Kalman Filter predicted a marginally lower value of 1010.55 at Hour 1 than the measured load of 1116.99. This initial disparity arose because the filter makes a cautious forecast at first, since it had little prior knowledge. The Kalman Gain of 0.622 indicated cautious confidence in the first observation, while still leaving room for doubt about the data. This initial uncertainty was further highlighted by the substantial error covariance of 2713.55. However, as time progressed, the Kalman Filter gradually refined its understanding of the system, using this initial observation as a starting point to improve its future predictions. As more observations were analyzed, the Kalman Filter adjusted its state prediction, making it increasingly accurate. By Hour 6, this refinement was evident, with the prediction state reaching 1060.27 compared to the observed load of 1154.78, showing a clear improvement in precision. The fact that the Kalman Gain had dropped to 0.5602 suggests that the filter was updating its state more consistently by utilizing both historical data and the most current observation. As the filter improved its understanding of the system, the error covariance also decreased, going from 2713.55 in Hour 1 to 5547.53 in Hour 6. 848 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate Figure 3. Observed Load against State Prediction Values. The Kalman Filter is continuously adjusted throughout the day. At Hour 14, the predicted state was 996.81, the measured load was 1186.29, and the residual between the predicted and observed values was 189.48. By assigning more weight to the most recent observation (as indicated by the Kalman Gain of 0.6152), the filter compensated for the larger residual, which reflected a significant variation in consumption. These residuals decreased as the filter processed more data, indicating an increase in accuracy. The lines were parallel, suggesting a well-fitted estimated model, as shown in Figure 3, which compared the observed dataset to the state estimate from the Bayesian Kalman Filter. 5. Dissection The filter provided the initial observation with a substantial amount of weight at Hour 1, as indicated by the Kalman Gain of 0.622. The Kalman Gain varied from 0.5635 at Hour 24 to 0.6373 at Hour 15 when more data points were added. This range demonstrated how the filter modifies its dependence on fresh observations in response to the system's volatility. The Kalman Gain increased during hours with greater variation, such as Hour 14, giving the current data point more weight. This ensured that the filter would swiftly adjust to major system changes. Over time, the error covariance also evolved, reflecting changes in the level of uncertainty. At Hour 1, the error covariance was 2713.55, indicating significant uncertainty in the initial estimates. However, 849 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate as the filter processed more observations and refined its state estimates, the uncertainty decreased. By Hour 24, the error covariance had dropped to 3094.47, demonstrating that the filter’s predictions had become more reliable and accurate. The dissimilarities observed in the state estimate and the actual load, known as the Kalman Filter residuals, clarified the extent to which the Kalman Filter represented the system dynamics. For instance, in the early hours, say hour 1, the residual for this time period was noted to be 106.44, which indicated a significant difference between the estimated and actual load observed in that hour. However, as expected, the residuals tended to decrease over time. According to this observation, the residual dropped by 107.61 by hour 24, implying that the filter had managed to reduce errors and improve the accuracy of the system condition estimates. It was this property of the Kalman Filter that was one of its most powerful features: the ability to smooth observed data. Fluctuations in electricity usage could be caused by a number of factors, including abrupt increases or decreases in demand. These variances were reduced through the Kalman filter, which provided a much cleaner estimation of actual consumption. For example, in Hour 8, when the measured load spiked to 1154.16, the estimate provided by the filter was 1051.17. This demonstrated how the filter could help control outliers and provide a more reliable picture of the underlying trend. The Kalman Filter estimate of 997.39 during Hour 16, while the observed load was 1144.71, again demonstrated its smoothing capability by absorbing small variations in the observed load and yielding an improved state prediction. With the inclusion of the Kalman Filter in developing the Markov Chain Monte Carlo results, with the use of temporal structure presented in MCMC output for correction of real-time prediction, the integration yielded a better estimation of power consumption. Some important parameters developed from MCMC were πœ™- Phi, showing autoregressive dependence between hourly consumptions, and σ² - sigma squared, depicting uncertainty within the model. These helped the correction procedure of the Kalman Filter. The πœ™ values in the MCMC results show how different the consumption is at one hour from the hour before. For instance, the value πœ™ is 0.8004 for Hour 1, indicating strong temporal correlation, while for Hour 24, it increased to 0.8473, which means it became even more stable. The σ² values were representative of uncertainty; the lower this value, the greater the confidence in the model's predictions. This allowed the Kalman Filter to correct its predictions with greater accuracy, depending on how well the system could be predicted at any given time. These values of πœ™ and 𝜎² were then used by the Kalman Filter to update its prediction of the state. Indeed, for highly uncertain hours σ², the observed data is weighted higher, while during hours of low uncertainty, the filter relies more on its predictions. The adjustments get smoothed out as the πœ™ values increase, giving more confidence to long-term trends. When πœ™ decreases, the filter is more responsive to observed data and changes in response to transient variations rapidly. We created a dynamic model that adjusts in real-time while maintaining a strong understanding of patterns in electricity usage by integrating the MCMC and Kalman Filter. The MCMC provided the Kalman Filter with the context it needed to modify its estimates, resulting in an accurate and responsive model. 6. Conclusion Only by integrating the Kalman Filter and MCMC analysis could a better understanding of the dynamics of electricity use be acquired. Considering some hours had strong and others weaker πœ™ -values showing autoregressive correlations, temporal dependencies in consumption were underlined by means of MCMC results. For example, πœ™ values were small during such hours as Hour 13 (0.7115), which shows less predictability, whereas Hour 8 (0.8406) and Hour 24 (0.8473) had higher πœ™ values, indicating solid correlations between hours. 850 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate These findings from MCMC analysis helped the Kalman Filter because they provided context for how it should adjust its state estimates. In hours whose πœ™ value was low, the filter gave more weight to new data; during hours with a high πœ™ value, it paid more attention to historical observations. This flexibility ensured the Kalman Filter effectively balanced short-term fluctuations against long-term trends. Uncertainty needed to be added to both models. With wider credible intervals and higher error covariances, the σ² values from MCMC point toward times of greater uncertainty. In these times of increased uncertainty, the model is not as confident about projections of the future. This is updated in real-time by the ability of the Kalman Filter to adapt its state predictions based on new observations. Transparency: The authors confirm that the manuscript is an honest, accurate, and transparent account of the study; that no vital features of the study have been omitted; and that any discrepancies from the study as planned have been explained. This study followed all ethical practices during writing. Acknowledgments: We gratefully acknowledge from the Salahaddin University for the support of this work. Copyright: Β© 2025 by the authors. This article is an open-access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). References [1] S. Zhang, N. Zhang, Z. Zhang, and Y. Chen, "Electric power load forecasting method based on a support vector machine optimized by the improved seagull optimization algorithm," Energies, vol. 15, no. 23, p. 9197, 2022. https://doi.org/10.3390/en15239197 [2] R. Chinnaraji and P. Ragupathy, "Accurate electricity consumption prediction using enhanced long short‐term memory," IET Communications, vol. 16, no. 8, pp. 830-844, 2022. https://doi.org/10.1049/cmu2.12384 [3] R. E. Kalman, "A new approach to linear filtering and prediction problems," Journal of Basic Engineering, vol. 82, no. 1, pp. 35–45, 1960. https://doi.org/10.1115/1.3662552 [4] S. Lopez-Restrepo et al., "An efficient ensemble Kalman Filter implementation via shrinkage covariance matrix estimation: Exploiting prior knowledge," Computational Geosciences, vol. 25, no. 3, pp. 985-1003, 2021. https://doi.org/10.1007/s10596-021-10035-4 [5] J. Hui and J. Yuan, "Kalman filter, particle filter, and extended state observer for linear state estimation under perturbation (or noise) of MHTGR," Progress in Nuclear Energy, vol. 148, p. 104231, 2022. https://doi.org/10.1016/j.pnucene.2022.104231 [6] S. G. Penny et al., "Integrating recurrent neural networks with data assimilation for scalable data‐driven state estimation," Journal of Advances in Modeling Earth Systems, vol. 14, no. 3, p. e2021MS002843, 2022. https://doi.org/10.1029/2021MS002843 [7] G. Revach, N. Shlezinger, X. Ni, A. L. Escoriza, R. J. Van Sloun, and Y. C. Eldar, "KalmanNet: Neural network aided Kalman filtering for partially known dynamics," IEEE Transactions on Signal Processing, vol. 70, pp. 1532-1547, 2022. [8] D. Kaplan, "On the quantification of model uncertainty: A Bayesian perspective," Psychometrika, vol. 86, no. 1, pp. 215- 238, 2021. https://doi.org/10.1007/s11336-021-09754-5 [9] P. L. Gentili, "Establishing a new link between fuzzy logic, neuroscience, and quantum mechanics through Bayesian probability: Perspectives in artificial intelligence and unconventional computing," Molecules, vol. 26, no. 19, p. 5987, 2021. https://doi.org/10.3390/molecules26195987 [10] N. A. Mohammed and A. Al-Bazi, "An adaptive backpropagation algorithm for long-term electricity load forecasting," Neural Computing and Applications, vol. 34, no. 1, pp. 477-491, 2022. https://doi.org/10.1007/s00521- 021-06384-x [11] A. Ozcan, C. Catal, and A. Kasif, "Energy load forecasting using a dual-stage attention-based recurrent neural network," Sensors, vol. 21, no. 21, p. 7115, 2021. https://doi.org/10.3390/s21217115 [12] Y. Yang, C. Fan, and H. Xiong, "A novel general-purpose hybrid model for time series forecasting," Applied Intelligence, vol. 52, no. 2, pp. 2212-2223, 2022. https://doi.org/10.1007/s10489-021-02442-y https://creativecommons.org/licenses/by/4.0/ https://doi.org/10.3390/en15239197 https://doi.org/10.1049/cmu2.12384 https://doi.org/10.1115/1.3662552 https://doi.org/10.1007/s10596-021-10035-4 https://doi.org/10.1016/j.pnucene.2022.104231 https://doi.org/10.1029/2021MS002843 https://doi.org/10.1007/s11336-021-09754-5 https://doi.org/10.3390/molecules26195987 https://doi.org/10.1007/s00521-021-06384-x https://doi.org/10.1007/s00521-021-06384-x https://doi.org/10.3390/s21217115 https://doi.org/10.1007/s10489-021-02442-y 851 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate [13] K. Benidis et al., "Deep learning for time series forecasting: Tutorial and literature survey," ACM Computing Surveys, vol. 55, no. 6, pp. 1-36, 2022. https://doi.org/10.1145/3533382 [14] D. Chen, "Uncertain regression model with autoregressive time series errors," Soft Computing, vol. 25, no. 23, pp. 14549-14559, 2021. https://doi.org/10.1007/s00500-021-06362-4 [15] S. Chen, Z. Luo, and T. Hua, "Research on AR‐AKF model denoising of the EMG signal," Computational and Mathematical Methods in Medicine, vol. 2021, no. 1, p. 9409560, 2021. https://doi.org/10.1155/2021/9409560 [16] L. Caglio, A. Sadeqi, H. Stang, and E. Katsanos, "Joint input-state estimation of structures subjected to complex loads via augmented Kalman Filter with physics informed latent force models," Mechanical Systems and Signal Processing, vol. 223, p. 111852, 2025. https://doi.org/10.1016/j.ymssp.2024.111852 [17] Z. Liang, Z. Chengyuan, Z. Zhengang, and Z. Dacheng, "Short-term load forecasting based on kalman filter and nonlinear autoregressive neural network," in 2021 33rd Chinese Control and Decision Conference (CCDC) (pp. 3747- 3751). IEEE, 2021. [18] A. Brusaferri, M. Matteucci, P. Portolani, and A. Vitali, "Bayesian deep learning based method for probabilistic forecast of day-ahead electricity prices," Applied Energy, vol. 250, pp. 1158-1175, 2019. https://doi.org/10.1016/j.apenergy.2019.05.068 [19] X. Liu, H. Xu, D. Zheng, and Y. Quan, "A novel variational Bayesian adaptive Kalman filter with mismatched process noise covariance matrix," IET Radar, Sonar & Navigation, vol. 17, no. 6, pp. 967-977, 2023. https://doi.org/10.1049/rsn2.12391 [20] R. Dehghannasiri, M. S. Esfahani, X. Qian, and E. R. Dougherty, "Optimal Bayesian Kalman filtering with prior update," IEEE Transactions on Signal Processing, vol. 66, no. 8, pp. 1982-1996, 2018. [21] S. Sarkka and A. Nummenmaa, "Recursive noise adaptive Kalman filtering by variational Bayesian approximations," IEEE Transactions on Automatic control, vol. 54, no. 3, pp. 596-600, 2009. [22] P. Lara-BenΓ­tez, M. Carranza-GarcΓ­a, and J. C. Riquelme, "An experimental review on deep learning architectures for time series forecasting," International Journal of Neural Systems, vol. 31, no. 03, p. 2130001, 2021. https://doi.org/10.1142/S0129065721300011 [23] J.-e. Liu and F.-P. An, "Image classification algorithm based on deep learning‐kernel function," Scientific Programming, vol. 2020, no. 1, p. 7607612, 2020. https://doi.org/10.1155/2020/7607612 [24] J. Wang, L. Zhang, and Z. Li, "Interval forecasting system for electricity load based on data pre-processing strategy and multi-objective optimization algorithm," Applied Energy, vol. 305, p. 117911, 2022. https://doi.org/10.1016/j.apenergy.2021.117911 [25] S. Akhtar et al., "Short-term load forecasting models: A review of challenges, progress, and the road ahead," Energies, vol. 16, no. 10, p. 4060, 2023. https://doi.org/10.3390/en16104060 [26] F. He, H. Zhang, Q. Wan, S. Chen, and Y. Yang, "Medium term streamflow prediction based on Bayesian model averaging using multiple machine learning models," Water, vol. 15, no. 8, p. 1548, 2023. https://doi.org/10.3390/w15081548 [27] A. Ashraf and S. S. Haroon, "Short-term load forecasting based on bayesian ridge regression coupled with an optimal feature selection technique," International Journal of Advanced Natural Sciences and Engineering Researches, vol. 7, no. 4, pp. 435–441, 2023. https://doi.org/10.59287/ijanser.787 [28] B. Yan, X. Li, W. Shi, X. Zhang, and A. Malkawi, "Forecasting building energy demand under uncertainty using gaussian process regression: Feature selection, baseline prediction, parametric analysis and a web-based tool," in Building Simulation 2017 (Vol. 15, pp. 545-554). IBPSA, 2017. [29] A. Al Mamun, M. Sohel, N. Mohammad, M. S. H. Sunny, D. R. Dipta, and E. Hossain, "A comprehensive review of the load forecasting techniques using single and hybrid predictive models," IEEE Access, vol. 8, pp. 134911-134939, 2020. [30] B. A. Salami, S. I. Abba, A. A. Adewumi, U. A. Dodo, G. K. Otukogbe, and L. O. Oyedele, "Building energy loads prediction using bayesian-based metaheuristic optimized-explainable tree-based model," Case Studies in Construction Materials, vol. 19, p. e02676, 2023. https://doi.org/10.1016/j.cscm.2023.e02676 [31] M. Torabi, S. Hashemi, M. R. Saybani, S. Shamshirband, and A. Mosavi, "A Hybrid clustering and classification technique for forecasting short‐term energy consumption," Environmental Progress & Sustainable Energy, vol. 38, no. 1, pp. 66-76, 2019. https://doi.org/10.1002/ep.12934 [32] C. Drovandi, R. G. Everitt, A. Golightly, and D. Prangle, "Ensemble MCMC: Accelerating pseudo-marginal MCMC for state space models using the ensemble Kalman filter," Bayesian Analysis, vol. 17, no. 1, pp. 223-260, 2022. https://doi.org/10.1214/20-BA1251 [33] J. Wu, L. Wen, P. L. Green, J. Li, and S. Maskell, "Ensemble Kalman filter based sequential Monte Carlo sampler for sequential Bayesian inference," Statistics and Computing, vol. 32, no. 1, p. 20, 2022. https://doi.org/10.1007/s11222- 021-10075-x [34] M. Zulfiqar, K. A. Gamage, M. Kamran, and M. B. Rasheed, "Hyperparameter optimization of bayesian neural network using bayesian optimization and intelligent feature engineering for load forecasting," Sensors, vol. 22, no. 12, p. 4446, 2022. https://doi.org/10.3390/s22124446 https://doi.org/10.1145/3533382 https://doi.org/10.1007/s00500-021-06362-4 https://doi.org/10.1155/2021/9409560 https://doi.org/10.1016/j.ymssp.2024.111852 https://doi.org/10.1016/j.apenergy.2019.05.068 https://doi.org/10.1049/rsn2.12391 https://doi.org/10.1142/S0129065721300011 https://doi.org/10.1155/2020/7607612 https://doi.org/10.1016/j.apenergy.2021.117911 https://doi.org/10.3390/en16104060 https://doi.org/10.3390/w15081548 https://doi.org/10.59287/ijanser.787 https://doi.org/10.1016/j.cscm.2023.e02676 https://doi.org/10.1002/ep.12934 https://doi.org/10.1214/20-BA1251 https://doi.org/10.1007/s11222-021-10075-x https://doi.org/10.1007/s11222-021-10075-x https://doi.org/10.3390/s22124446 852 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 9, No. 11: 839-852, 2025 DOI: 10.55214/2576-8484.v9i11.11010 Β© 2025 by the authors; licensee Learning Gate [35] J. Kwon and D. Park, "Efficient sensor processing technique using Kalman filter-based velocity prediction in large- scale vehicle IoT application," IEEE Access, vol. 10, pp. 116735-116746, 2022. [36] S. Karthik et al., "Prognostic Kalman filter based Bayesian learning model for data accuracy prediction," Computers, Materials & Continua, vol. 72, no. 1, pp. 243–259, 2022. https://doi.org/10.32604/cmc.2022.023864 [37] Q. Fu, L. Wang, Q. Xie, and Y. Zhou, "An improved adaptive iterative extended kalman filter based on variational bayesian," Applied Sciences, vol. 14, no. 4, p. 1393, 2024. https://doi.org/10.3390/app14041393 [38] S. M. Shin, A. Rasheed, P. Kil-Heum, and K. C. Veluvolu, "Fast and accurate short-term load forecasting with a hybrid model," Electronics, vol. 13, no. 6, p. 1079, 2024. https://doi.org/10.3390/electronics13061079 [39] S. Ali, S. Bogarra, M. N. Riaz, P. P. Phyo, D. Flynn, and A. Taha, "From time-series to hybrid models: Advancements in short-term load forecasting embracing smart grid paradigm," Applied Sciences, vol. 14, no. 11, p. 4442, 2024. https://doi.org/10.3390/app14114442 [40] R. Cottet and M. Smith, "Bayesian modeling and forecasting of intraday electricity load," Journal of the American Statistical Association, vol. 98, no. 464, pp. 839-849, 2003. https://doi.org/10.1198/016214503000000774 [41] S. Zheng, Q. Zhong, L. Peng, and X. Chai, "A simple method of residential electricity load forecasting by improved Bayesian neural networks," Mathematical Problems in Engineering, vol. 2018, no. 1, p. 4276176, 2018. https://doi.org/10.1155/2018/4276176 [42] S. Sharma, A. Majumdar, V. Elvira, and E. Chouzenoux, "Blind Kalman filtering for short-term load forecasting," IEEE Transactions on Power Systems, vol. 35, no. 6, pp. 4916-4919, 2020. https://doi.org/10.1109/TPWRS.2020.3018623 [43] Z. Yang, Z. Xie, and Z. Huang, "Electricity consumption prediction based on autoregressive Kalman filtering," Electrical Engineering, vol. 107, no. 5, pp. 5601-5614, 2025. https://doi.org/10.21203/rs.3.rs-4878573/v1 [44] A. Roy and S. Karmakar, "Time-varying auto-regressive models for count time-series," Electronic Journal of Statistics, vol. 15, no. 1, pp. 2905-2938, 2021. https://doi.org/10.1214/21-EJS1851 [45] H. A. Khidir, Δ°. Etikan, D. H. Kadir, N. H. Mahmood, and R. Sabetvand, "Bayesian machine learning analysis with Markov Chain Monte Carlo techniques for assessing characteristics and risk factors of Covid-19 in Erbil City-Iraq 2020–2021," Alexandria Engineering Journal, vol. 78, pp. 162-174, 2023. https://doi.org/10.1115/1.3662552 [46] K. I. Mawlood and R. O. Yahya, "Using Kalman filter and dynamic linear models for modeling and forecasting electricity load in Erbil city," University Journal of Humanities, vol. 22, no. 4, pp. 347 - 373, 2018. [47] B. Jin, J. Guo, D. He, and W. Guo, "Adaptive Kalman filtering based on optimal autoregressive predictive model," GPS Solutions, vol. 21, no. 2, pp. 307-317, 2017. https://doi.org/10.1007/s10291-016-0561-x https://doi.org/10.32604/cmc.2022.023864 https://doi.org/10.3390/app14041393 https://doi.org/10.3390/electronics13061079 https://doi.org/10.3390/app14114442 https://doi.org/10.1198/016214503000000774 https://doi.org/10.1155/2018/4276176 https://doi.org/10.1109/TPWRS.2020.3018623 https://doi.org/10.21203/rs.3.rs-4878573/v1 https://doi.org/10.1214/21-EJS1851 https://doi.org/10.1115/1.3662552 https://doi.org/10.1007/s10291-016-0561-x