# Smart Grid Data Management in a Heterogeneous Environment with a Hybrid Load Forecasting Model
## 6 Results and Discussion (Case Study 2)
### Case Study 2: Data Analytics (Load Forecasting)
#### 6.1.1 The Proposed Model
When the series is found to be stationary (by using the auto.arima function), then the \"d\" parameter can be chosen to be zero in the ARIMA model. Figure 14: Daily Baghdad Governorate Load Distribution (KW) for 2019. Figure 15: (**a**) Hourly Baghdad Governorate Load Distribution (MW) in 24-Hour Box-plot; (**b**) Hourly Baghdad Governorate Load Distribution (KW) for 2019. The auto.arima function is valuable for the following reasons: the forecasting process needs a fast and flexible performance process on a daily, weekly, or monthly basis, and it need advance experience by the user to make sure it selects the appropriate value of these parameters. Furthermore, fitting a model normally takes heavy effort; the automated procedure is preferable to manual techniques for determining the proper value of these parameters (p, d, and q), which can result in more reliable forecasting results. The next step is the analysis of the residuals of the ARIMA model by using a test such as ACF, Histogram, and Ljung-Box statistics to see if the residuals are white noise. Figure 18a-c show the analysis of the residuals of Cluster 0. \begin{table}
\begin{tabular}{c c c} \hline \hline  & **(p,d,q)** & **AIC** \\ \hline Cluster 0 & (3,0,4) & 5518.749 \\ \hline Cluster 1 & (1,0,3) & 5252.404 \\ \hline Cluster 2 & (3,0,2) & 8001.193 \\ \hline Cluster 3 & (1,0,4) & 6900.293 \\ \hline Cluster 4 & (2,0,3) & 5301.737 \\ \hline Cluster 5 & (4,0,3) & 10,274.279 \\ \hline Cluster 6 & (3,0,1) & 7033.124 \\ \hline Cluster 7 & (4,0,2) & 5924.249 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Akaike Information Criteria and Best ARIMA (p,d,q) for Each Cluster. Figure 16: Cluster Group Membership based on load values. Figure 17: (**a**) Signal, Trend, and Seasonality Differences of Cluster 0; (**b**) The Autocorrelation (ACF) of Decomposition Signal of Cluster 0; (**c**) The Partial Autocorrelation Function (PACF) of Decomposition Signal of Cluster 0. * Fifth Stage (GBTL Model): the ARIMA model can only predict value based on its previous lags (historic data), while no other assumptions are considered, such as weather conditions or any other external factors. Therefore, external variables might improve the forecast accuracy. Consequently, the residuals error resulting from the previous step will pass to the GBTL model to be trained and predicted with external factors such as Maximum, Minimum, and Average Degree. The Gradient-Boosted Trees model has multiple \(X_{t}^{T}\) features to predict \(X_{t}\). The target variable then adds to the predictor sequentially to ensemble data while following the same sequence to correct the preceding predictors [15]. The GBTL can be represented mathematically, as given in Equation (4). \[X_{t}\ =X_{t}+\ \propto\ *\delta\,\Sigma\,\Big{(}X_{t}^{T}-X_{t}\ \Big{)}^{2}/\delta\ X_{t}\] (4) where: \(X_{t}^{T}\) = the target values, \(X_{t}\) = the prediction values and \(\propto\) = learning rate The gradient-boosting model is supportive in our case, as it is an easy-to-read algorithm and gives efficient interpretations. The GBTL prediction result for the residuals error will be added to the load predicted using ARIMA as given in Equation (5). Figure 19a,b show the actual and the forecasting load of cluster 0. The proposed method tested using the Knime analytic platform using a computer with an Intel CPU Core i7-7500U 2.7 GHz and 16 GB RAM. The execution time of the proposed model was around 30 s. \[F_{t}=Y_{t}+X_{t}\] (5) where: \(F_{t}\) = the overall forecasting results. \(Y_{t}\) = the forecasting result from the ARIMA model. \(X_{t}\) = the forecasting result from the GBTL model. Figure 18: Analysis of The Residuals of Cluster 0. The observations from Figure 19a,b show a perfect match between the actual load and the forecasting load, and this is an indication of the high accuracy of the proposed mode, and that the dependence on external factors such as weather conditions enhance the improvement of the forecasting model invariably.