# Probabilistic Forecasting of Electricity Demand Incorporating Mobility Data
## 2 Materials and Methods
### Feature Selection  
To improve the forecasting accuracy, a correlation analysis is performed to determine which features are most strongly related to electricity demand. Due to the influence of numerous factors, such as temperature, day of the week, and volatility of renewable sources, it is difficult and complex to establish the true impact of the pandemic on electricity demand. Studies have found that temperature significantly affects energy use compared to other parameters [17].  
Feature selection reduces change sensitivity and overfitting in the proposed model. Therefore, this study uses the correlation coefficient between temperature indicators and electricity demand to determine whether incorporating mobility data have the same or greater importance in highlighting their qualities. There are different methods for choosing features, such as Pearson and Spearman correlations. This study adopts Spearman's rank correlation coefficient to test the electricity demand-mobility correlation since it is a non-parametric test and defines the strength and direction of the monotonic relationship between two variables [63]. The Spearman's rank correlation coefficient statistic can be defined as follows:  
\[s=\frac{\sum_{i=1}^{n}(R_{i}-\overline{R})(S_{i}-\overline{S})}{\sqrt{\sum_{i=1 }^{n}\bigl{(}R_{i}-\overline{R}\bigr{)}^{2}\sum_{i=1}^{n}\bigl{(}S_{i}- \overline{S}\bigr{)}^{2}}}=1-6\sum_{i=1}^{n}\frac{d_{i}^{2}}{n(n^{2}-1)} \tag{22}\]  
where \(R_{i}\) and \(S_{i}\) are the \(i_{th}\) rank of the first and second data inputs, respectively, and \(d_{i}^{2}=\left(R_{i}-S_{i}\right)^{2}\) represents the distance between two data inputs.  
The S value of Spearman correlation coefficients of different features during the pandemic period (February-March 2020-2022) is shown in Table 2 and Figure 3, which reveal that temperature and non-renewable sources of energy have a strong correlation with the electricity demand. Selected features for this study are temperature, renewable and non-renewable energy, and workplace and residential mobility data.  
\begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline  & **Weather** & **Energy Source** & & & & **Mobility Feature** & & \\ \hline
**Spearman** & & & & & & & & & \\
**Coefficient** & **Temperature** & **Renewable** & **Non-Renewable** & **Workplace** & **Residential** & **Retail \& **Recretion** & **Grocery \&** & **Transit** \\
**S** & & & & & & & & & & \\ \hline
2020 & 0.956 & 0.077 & 0.681 & 0.427 & -0.436 & -0.419 & -0.483 & -0.303 & 0.3116 \\ \hline
2021 & 0.810 & 0.023 & 0.577 & -0.063 & 0.225 & -0.394 & -0.236 & -0.252 & -0.119 \\ \hline
2022 & 0.828 & 0.261 & 0.606 & -0.399 & 0.447 & -0.488 & 0.116 & -0.363 & -0.047 \\ \hline \hline \end{tabular}
\end{table}
Table 2: The Spearman Correlation Coefficient (S) results from electricity demand and mobility indicators, temperature, and energy sources.  
In addition, all of the 6 mobility indicators have a stronger correlation with electricity demand. This indicates that mobility indicators can reflect electricity demand during an anomalous situation such as a pandemic. The \(S\) value of the workplace was high just before the start of the pandemic, and it became negative during the lockdown period of 2021-2022 and vice versa in the case of other mobility indicators, especially the residential feature, which showed a negative value just before the pandemic and became positive during the year 2021-2022. It shows that staying longer at home for a longer length of time reduces electricity demand, which corresponds to the actual scenario throughout the pandemic. Hence, incorporating mobility features in electricity demand forecasting could increase model performance.