## 4 Data Collection and Preparation
### Dealing with the Data Imbalance Problem  
To overcome the problem of low frequency of fatal crashes, for the modeling purposes they were combined in a single class with injury crashes. However, even after combining the injury and fatal crashes, it was found that non-injury crash class accounted for 79% of the cases (8016 non-injury or PDO crashes out of the total of 10,155 crashes in the dataset). This may present a problem in model training: the traditional accuracy maximizer techniques may not perform adequately with the training dataset containing skewed distribution of classes, as they generally tend to perform better in favor of the majority class. In such situations it is advantageous to apply certain data transformations that result in a more balanced training dataset.  
This study applied relatively novel Random Oversampling Examples (ROSE) method to resample and balance the initial training dataset. The ROSE method employs a random bootstrapping technique introduced by [PERSON] and [PERSON] [28], which can alleviate the data imbalance issue in binary classification problems. The method combines random oversampling and random undersampling by generating new artificial instances of data examples in the original classes using a smoothed bootstrapped approach [29].  
Consider a training set of size \(n\), consisting of a binary response variable \(y\), with class labels \(Y_{j}\) and a set of input data for each class, \(x_{ij},\ i=1,\ldots,\ n_{j}\), where \(n_{j}<n\) is the number of cases in class \(j\). For each \(x\) belonging to the class \(Y_{j}\), ROSE generates samples from a multivariate kernel density estimate of \(f(x\mid y=Y_{j})\) as follows:  
\[\hat{f}(x\mid y=Y_{j})=\sum_{i=1}^{n_{j}}p_{i}Pr\left(x\mid x_{ij}\right)=\sum _{i=1}^{n_{j}}\frac{1}{n_{j}}\ K_{H_{j}}\left(x-x_{ij}\right) \tag{11}\]  
where \(K_{H_{j}}\) denotes an estimated kernel function, and it's smoothing matrix \(H_{j}\) is defines as:  
\[H_{j}=diag\Big{(}h_{1}^{(j)},\ \ldots,\ h_{d}^{(j)}\Big{)} \tag{12}\]  
where \(d\) denotes the number of explanatory variables and  
\[h_{q}^{(j)}=\left(\frac{4}{(d+2)n}\right)^{1/(d+4)}\hat{\sigma}_{q}^{(j)},\ q=1,\ \ldots,\ d \tag{13}\]  
where \(\hat{\sigma}_{q}^{(j)}\) is the estimated standard deviation of the \(q\)-th variable. According to [PERSON] and [PERSON] [30], the smoothing matrix minimizes the Asymptotic Mean Integrated Squared Error, assuming that the true conditional densities of the data follow Normal distribution. The practical implementation of ROSE encompasses the following steps:  
1. select \(y^{*}=Y_{j}\) with probability \(\pi_{j}\);
2. select \(x\) such that \(y_{k}=y^{*},\ k=1,\ \ldots,\ n\) with probability \(\frac{1}{n_{j}}\);
3. sample \(x^{*}\) from the estimated kernel function.  
Repeating steps 1 to 3 yields a newly generated training set of size \(m\), with the probability of each class being \(\pi_{j}\). [PERSON] and [PERSON] [28] showed that ROSE outperformed other well-known oversampling methods, such as synthetic minority oversampling technique (SMOTE), measured by higher values of the AUC in models implementing logistic regression and classification trees. This was the main motivation for implementing ROSE method, given the similar class of models employed in his study.