# Spatial Performance Indicators for Traffic Flow Prediction
## 3 Materials and Methods
### Spatial KPIs
#### 3.1.1 Spatial Autocorrelation (Global Moran's I)  
Global Moran's I [16] is a measure of spatial autocorrelation that evaluates the relationship between feature values at different locations, considering their spatial proximity and covariance. Global Moran's I provides a single summary measure of spatial autocorrelation for an entire network, allowing researchers to quantify the overall degree of spatial dependence [22]. Despite its simplicity, Global Moran's I has several applications in traffic management systems such as describing the urban traffic state spatial pattern [23], investigating the impacts of the built environment on traffic states [24], and analyzing road traffic crashes by severity [25]. The metric determines whether the feature values exhibit a positive or negative correlation across spatial distances. Global Moran's I is calculated using Equation (1). \[I=\left[\frac{n}{\Sigma_{i}^{n}(x_{i}-\bar{x})^{2}}\right]\left[\frac{\Sigma_{ i}^{n}\Sigma_{j}^{n}\,w_{i,j}(x_{i}-\bar{x})\left(x_{j}-\bar{x}\right)}{ \Sigma_{i}^{n}\Sigma_{j}^{n}\,w_{i,j}}\right] \tag{1}\]  
Equation (1) for calculating Global Moran's I involves several variables: \(n\) represents the total number of features, \(x_{i}\) corresponds to the feature values at a specific location \(i\), \(\bar{x}\) represents the average value of all features in the network, and \(w_{i,j}\) denotes the element \(i,j\) in the adjacency matrix of a graph network. The resulting values of Global Moran's I range from +1 to \(-1\), where a value of +1 indicates maximum positive spatial autocorrelation, 0 indicates a random spatial pattern with no significant spatial autocorrelation, and \(-1\) indicates maximum negative spatial autocorrelation. Spatial autocorrelation refers to the degree to which neighboring locations have similar tendencies. Positive spatial autocorrelation means that neighboring nodes have tendencies to spatially cluster, whereas negative spatial autocorrelation means that neighboring nodes tend to be dispersed. [PERSON]'s I can also be calculated as a statistical measure to examine the spatial distribution of values in a network. This involves testing the null hypothesis, which states that the spatial arrangement of these values is a result of random spatial processes. \[\mathrm{E}[I] =-1/(n-1) \tag{2}\] \[\mathrm{V}[I] =\mathrm{E}[I^{2}]-\mathrm{E}[I]^{2}\] (3) \[z_{I} =\frac{I-\mathrm{E}[I]}{\sqrt{\mathrm{V}[I]}}\] (4) \[p_{I} =1-\mathrm{CDF}(z_{I}) \tag{5}\]  
In the above equation, \(E[I]\) represents the expectation of \(I\), \(V[I]\) represents the variance of \(I\), and \(\mathrm{CDF}(z_{I})\) represents the cumulative distribution function of \(z_{I}\)-score. The resulting \(p_{I}\)-value and \(z_{I}\)-score were used to evaluate spatial autocorrelation. If the \(p_{I}\)-value of Global Moran's I is deemed statistically significant, this allows us to reject the null hypothesis. Consequently, a positive \(z_{I}\)-score suggests positive spatial autocorrelations in networks, with higher values representing higher correlations (and the opposite holds true). In this study, we considered Global Moran's I to evaluate the spatial autocorrelation of the traffic flow prediction error of a spatiotemporal traffic prediction method. We argue that different traffic prediction methods have different levels of spatial information utilization, resulting in different levels of spatial autocorrelation. In traffic flow prediction, the spatial autocorrelation of the prediction errors provides important information that can enhance traffic management systems. The spatial distribution of prediction errors in traffic networks is nonrandom because of the complex interdependencies between nodes and the inherent spatial structure of the traffic prediction method. The variety of input data and algorithm in traffic prediction methods results in different levels of spatial autocorrelation.