# Casualty Analysis of the Drivers in Traffic Accidents in Turkey: A CHAID Decision Tree Model
## 3 Material and Method
### Comparison and Validation of the Classification Model with Selected Attributes  
The developed model which estimates the accident casualties of the drivers produces similar proportional results with regard to three categorical outcomes for each year not fluctuating much from year to year, as illustrated by Figure 4. It should be mentioned that, while decision trees were obtained through training datasets, model performances were evaluated by using test datasets. A 10-fold cross-validation was applied to ensure the reliability of the model. The re-sults of Random Forest and Naive Bayes were illustrated by Figure 5 to illustrate the success of the model compared to other available ones. By selecting 70% of the data as training and 30% as test data, the dataset was divided into two parts to create the decision trees. This distinction was made linearly and, as the accidents in the dataset were recorded and presented according to the date/year on/in which they occurred, the first five years of the available data were taken as education/training, and the last two years were taken as testing data. As the accidents and their results occur at similar rates each year, the predic-tion model is expected to produce accurate results for the future periods to make reliable and reasonable evaluations. Figure 4: The rates of casualties of the drivers in the accidents occurring in 2015–2021. Figure 5: Comparison of the models with regard to accuracy values. At this stage, the validity of the CHAID model was tested by establishing models with Random Forest and Naive Bayes algorithms. Random Forest, a combined classifier algorithm proposed by [PERSON], can perform classification, association, clustering, prediction, and sequential pattern mining operations, and create multiple decision trees [14; 39]. In this sense, a Random Forest algorithm is employed to predict the severity of traffic accidents by producing multiple decision trees. Bayesian Classification, on the other hand, is a process that estimates the probability that a new observation belongs to a predefined category by using a probability model defined according to Bayesian theory [40]. This technique evaluates the prior probability of each category based on a large training dataset defined by a set of variables. It also assumes that the classification can be estimated by calculating the conditional probability density function and the posterior probability [41; 42]. Given an observation with k attributes, \(\mathrm{x_{i}}\) conditioning factor, and \(\mathrm{y_{i}}\) the output class, \(\mathrm{i=1,2,\ldots,k}\), the Naive Bayes classifier calculates the probability \(\mathrm{P(y_{i}/x_{i})}\) for all possible output classes. The prediction is based on selecting the class with the highest posterior probability as:  
\[\mathrm{y_{NB}=argmaxP(y_{i})\prod_{i=1}^{n}P(x_{i}/y_{j})} \tag{3}\]  
The prior probability \(\mathrm{P(y_{i})}\) can be estimated by determining the fraction of observations in the training dataset that belong to the output class \(\mathrm{y_{j}}\). The conditional probability is computed by using:  
\[P\left(\frac{x_{i}}{y_{j}}\right)=\frac{1}{\sqrt{2\pi\delta}}e^{-(x_{i}-\mu)^ {2}/2\delta^{2}} \tag{4}\]  
where \(\mu\) is the mean and \(\delta\) is the standard deviation of \(\mathrm{x_{i}}\)[43]. Once 70% and 30% of the dataset were separated as training and test data, respectively, the number of data predicted as correct and incorrect were determined for CHAID, Random Forest, and Naive Bayes methods through the comparison of the expected and observed results of all accident scenarios in the test data. Following this, the classification accuracies were calculated by employing Equation (5). In the cross-validation process, on the other hand, a total of 10 subgroups were randomly created by taking 10% of the data into consideration at each step. By employing each of these subgroups and the remaining 90% of the data as test and training data, respectively, the accuracy values were calculated for the methods stated. Figure 5 illustrates these values.