# Probabilistic Forecasting of Electricity Demand Incorporating Mobility Data
## 2 Materials and Methods
### Probability Density Prediction Based on Kernel Density Estimation  
The kernel density estimator estimates a smooth density from data samples by assigning each sample point a density function [51]. All of these contributions are added together to determine the distribution. The normal distribution has been widely employed to estimate the density function in research. However, it only works effectively for data that follows a bell-shaped distribution. This method utilizes the kernel density estimate (KDE) method, a non-parametric representation of the probability density function, to avoid making assumptions about the distribution of the data. Unlike interval estimation, KDE is based on the observed data to construct the underlying PDF without distributional assumptions for the shape of the density, allowing the estimated density to be, for example, multi-modal, fat-tailed, or skewed. The selection of the kernel function and the determination of bandwidth are crucial to KDE [37]. Applying KDE to the predicted distribution from GPR gives a smooth curve estimation of the underlying PDF. It is helpful for creating a more accessible and understandable representation of the distribution, including by plotting a histogram with a fitted density curve [8]. The KDE smooths the distribution and estimates the PDF continuously, eliminating the separate-out impact of the histogram bins [51].  
If sequence \(Y\) consists of \(n\times 1\) dimensional observations, the drawing sample is \(Y=[y_{1},y_{2},\ldots,y_{n}]\), and then they can be organized into a histogram's bins. Depending on the distance between the sample drawings, the histogram contains a variety of bins with higher heights than others. For instance, if the values of two drawings are similar and the size is small, these drawings will be placed in the same bin. Therefore, the kernel density estimator attempts to average away the effect of each data point \(y_{i},\)\((where\)\(i=[1\ldots n])\) in a non-smooth histogram by providing each point a kernel function with a specific width. The KDE method estimates the actual probability density function \(f\) through the following function:  
\[\hat{f}_{n}(y)=\frac{1}{n\hbar}\ \sum_{i=1}^{n}k\left(\frac{y-y_{i}}{h}\right) \tag{13}\]  
where \(h\) is bandwidth, \(k(.)\) is the kernel function, which is a symmetric function that is integrated into one and has a mean of zero. These kernel functions usually represent some kind of similarity between two points in a space [34]. Several kernel density functions can estimate PDF, such as uniform, triangular, triweight, Epanechnikov, Gaussian, etc.,empirically; however, it makes little difference which one is used [52]. To implement the KDE in this study, a Gaussian kernel is utilized. It substitutes each sample point with a Gaussian-shaped kernel and adds these Gaussians to estimate the density.  
\[k\,\left(\frac{y-y_{i}}{h}\right)=\left(\frac{1}{\sqrt{2\pi}}\right)\exp\left( \frac{\left(y-y_{i}\right)^{2}}{2h^{2}}\right) \tag{14}\]  
The smoothing parameter \(h\) > 0 is the bandwidth, which modifies the distribution's overall appearance. The use of Gaussian KDE has certain benefits over other bandwidth selection methods since it can automatically determine the bandwidth using a rule of thumb [53; 54].