The study sample consisted of 617 participants, the majority of whom were male (78.3%). Most participants were aged between 25 and 59 years, representing 88.6% of the respondents. In terms of marital status, a majority (69.2%) were married. A substantial proportion of participants held a university degree (77%). Income levels varied considerably; however, the largest segment (50.6%) reported incomes closely aligned with their expenditures. In terms of vehicle type, only 1% reported using a motorcycle, while 71.6% used a light vehicle, and 27.4% used a heavy vehicle.
Based on the two target variables of this research, 433 participants (70.2%) reported not having experienced an accident in the past year, while 184 (29.8%) reported having had at least one accident during that time. Among the 184 individuals who had experienced at least one accident, 142 (77.2%) reported an accident that resulted in financial damage, and 42 (22.8%) reported an accident that led to injury or death.
The attribute importance assessment revealed several key findings essential for understanding the factors influencing the occurrence and severity of accidents. Utilizing the random forest algorithm, we prioritized variables based on their contribution to predicting the target outcomes. A bar chart visually represents the importance of each variable, as measured by their respective Gini coefficients (
Figure 1A).
The plot for importance of variables as determined by A, the random forest algorithm; and B, eXtreme Gradient Boosting (XGBoost) model
For the occurrence of accidents, the variables income, drive hours per day, work hours per day, age, non-stop drive, enforce law type, openness, normlessness, sensation seeking, and vehicle safety emerged with higher Gini importance scores. Specifically, the income-to-expenditure ratio (income) was the most significant, bearing the highest Gini Index of 12.6. In the analysis of accident severity, significant predictors included drive hours per day, non-stop drive, work hours per day, age, aggressive violation, income, quality road, enforce law type, fatigue driving, vehicle safety, foreign car or not, and vehicle comfort, with daily driving hours (drive hours per day) exhibiting the highest Gini Index of 3.6.
Complementing the Gini importance analysis, the SHAP evaluation performed through the XGBoost model reinforced the relevance of these variables from an interpretability perspective. The SHAP values showed agreement with the Gini Index results, identifying aggressive violation, work hours per day, openness, cellphone, non-stop drive, enforce law type, foreign car or not, drive hours per day, vehicle safety, age, and vehicle comfort as among the top influences for accident occurrence. For accident severity, key influencing factors identified through SHAP included enforce law type, drive hours per day, foreign car or not, aggressive violation, non-stop drive, vehicle safety, work hours per day, fatigue driving, and age. Graphical representations of the SHAP values (
Figure 1B) illustrate the magnitude of these variables’ impacts on the two target variables.
Among the multitude of rules generated by the C5.0 algorithm, a subset was extracted to elucidate the underlying patterns affecting crash occurrence and severity (
Table 1).
| Occurrence of Accident | Severity of Accident |
|---|
| Rule 1: If; income is less than the cost; drive hours per day is more than 2 h; normlessness = high; sensation seeking = high; openness = low; then yes [error = 29.4%] | Rule 1: If; enforce law type = police and camera; fatigue driving = high; car is not foreign; then wounded or dead [error = 11.1%] |
| Rule 2: If; drive hours per day is more than 4 h; enforce law type = police; normlessness = high; sensation seeking = high; fatigue driving = high; then yes [error = 29.2%] | Rule 2: If; drive hours per day is more than 2 h; safety = low; car is not foreign; then wounded or dead [error = 27.6%] |
| Rule 3: If; drive (hours per day is more than 4 h; normlessness = high; sensation seeking = high; vehicle safety= low; then yes [error = 40%] | Rule 3: If; enforce law type = police; car is not foreign; fatigue driving = low; then damage [error = 11.1%] |
| Rule 4: If; normlessness = low; then no [error = 6.5%] | Rule 4: If; drive hours per day is less than 2 h; safety = high; fatigue driving = low; then damage [error = 18.2 %] |
| Rule 5: If; income is more than cost; drive hours per day is less than 2 h; openness = low; then no [error = 7.7%] | Rule 5: If ; car is foreign; then damage [error = 20.9%] |
| Rule 6: If; income is more than cost; enforce law type = police and camera; then no [error = 8.3%] | - |
| Rule 7: If; income is equal to the cost; enforce law type = police and camera; vehicle safety = high; then no [error = 10.4%] | - |
| Rule 8: If; openness = high vehicle safety = high then no [error = 11.8%] | - |
For instance, one extracted rule reveals that a combination of high normlessness, an income lower than expenditures, and driving more than two hours per day significantly increases the probability of accident occurrence. Notably, when normlessness is low, the likelihood of not having an accident increases to 93.5%. According to the obtained rules, the variables income, drive hours per day, normlessness, sensation seeking, openness, enforce law type, fatigue driving, and vehicle safety played a more significant role in determining accident occurrence. In general, it can be concluded that high normlessness, income less than expenses, driving more than two hours per day, police-based enforce law type, high sensation seeking, low vehicle safety, low openness, and high fatigue driving are associated with a higher likelihood of accidents. Conversely, in the absence of accidents, the contributing factors include low normlessness, income equal to or greater than expenses, driving fewer than two hours per day, enforce law type involving both police and cameras, low sensation seeking, and high vehicle safety. On the other hand, accident severity is primarily influenced by a combination of factors such as enforce law type, fatigue driving, foreign car or not, drive hours per day, and vehicle safety. Accidents with lesser severity are more likely when the car is foreign. In contrast, use of non-foreign vehicles, high fatigue, low vehicle safety, and longer driving hours increase the risk of severe accidents. Overall, it can be concluded that for accidents resulting in property damage only, the contributing factors include having a foreign car, low fatigue, driving less than two hours per day, high vehicle safety, and enforcement primarily by police. In contrast, accidents resulting in injury or fatality are more likely when the car is not foreign, fatigue is high, vehicle safety is low, enforcement is conducted by both police and cameras, and daily driving exceeds two hours.
Based on the results of the C5.0 algorithm, the variables used in the modeling for the accident occurrence variable are income, drive hours per day, normlessness, sensation seeking, openness, enforce law type, fatigue driving, and vehicle safety. Additionally, the variables used to model the severity of accidents are enforce law type, fatigue driving, foreign car or not, drive hours per day, and vehicle safety.
The comparative performance analysis of ML models provides an understanding of their efficacy in predicting accident occurrence and severity. Our investigation assessed several algorithms, including random forest, Naive Bayes, logistic regression, SVM, and decision trees, using metrics of accuracy, precision, recall, F1 score, and AUC-ROC. These performance outcomes are presented in
Table 2, based on the predictive strength of the models applied to 30% of the test data.
| Variables | Accuracy | Recall | Specificity | Sensitivity | Precision | AUC Score | F1 Score |
|---|
| Occurrence of accident | | | | | | | |
| Random forest | 0.772 | 0.455 | 0.907 | 0.455 | 0.676 | 0.681 | 0.543 |
| Decision tree | 0.761 | 0.400 | 0.915 | 0.400 | 0.667 | 0.657 | 0.500 |
| Logistic regression | 0.728 | 0.382 | 0.876 | 0.382 | 0.568 | 0.629 | 0.457 |
| Naive Bayes | 0.728 | 0.636 | 0.767 | 0.636 | 0.538 | 0.702 | 0.583 |
| Severity of accident | | | | | | | |
| Random forest | 0.796 | 0.646 | 0.905 | 0.646 | 0.896 | 0.788 | 0.754 |
| SVM | 0.778 | 0.568 | 0.944 | 0.568 | 0.912 | 0.763 | 0.709 |
| Decision tree | 0.651 | 0.532 | 0.694 | 0.532 | 0.635 | 0.620 | 0.589 |
| Logistic regression | 0.632 | 0.724 | 0.511 | 0.724 | 0.507 | 0.599 | 0.571 |
Abbreviations: AUC, area under the curve; SVM, support vector machine.
Among these, the random forest classifier emerged as the most effective, exhibiting superior predictive accuracy (77.2% for occurrence of accident) and specificity (90.7% for occurrence of accident). The robust nature of random forest—capable of handling a large number of input variables and identifying complex patterns—was evident in its performance. Naive Bayes demonstrated high sensitivity (63.6% for occurrence of accident), effectively minimizing false negatives, which is critical in accident prediction to avoid overlooking high-risk cases. Logistic regression performed commendably with respect to recall (72.4% for severity of accident), ensuring that a significant proportion of actual positives were correctly identified. The SVM and decision trees showed competitive performance; however, they were marginally outperformed by the aforementioned models. The consistency across various metrics underscores the robustness of the selected features and the reliability of our advanced analytic approach in forecasting the occurrence and severity of accidents. The analytical proficiency demonstrated by random forest suggests its preferential utility in developing predictive models within the realm of traffic accident analysis, due to its ability to offer nuanced risk assessments and evidence-based insights for accident prevention initiatives.
In the ML method, determining the direction of the variables can be somewhat complex. However, in the decision tree model, certain rules were extracted that indicate the directional influence of these features. In conclusion, based on the results of the extracted rules, the direction of some features is specified in the text below. Here, reverse means that an increase in the variable reduces the occurrence or severity of accidents, while direct means that an increase in the variable increases the occurrence or severity of accidents.
The random forest analysis and Gini Index revealed the following predictors of accident occurrence: Income (reverse), drive hours per day (direct), work hours per day (direct), age, non-stop drive (direct), enforce law type, openness (reverse), normlessness (direct), sensation seeking (direct), and vehicle safety (reverse). Additionally, the following predictors were identified for accident severity: Drive hours per day (direct), non-stop drive (direct), work hours per day (direct), age, aggressive violation (direct), income (reverse), quality road (reverse), enforce law type, fatigue driving (direct), vehicle safety (reverse), foreign car or not, and vehicle comfort (reverse).
The SHAP analysis highlighted the following predictors of accident occurrence: Aggressive violation (direct), work hours per day (direct), openness (reverse), cellphone, non-stop drive (direct), enforce law type, foreign car or not, drive hours per day (direct), vehicle safety (reverse), age, and vehicle comfort (reverse).
Moreover, the predictors of accident severity identified through SHAP analysis included: Enforce law type, drive hours per day (direct), foreign car or not, aggressive violation (direct), non-stop drive (direct), vehicle safety (reverse), work hours per day (direct), fatigue driving (direct), and age.