← Back to Projects
Academic Project

Predicting Road Traffic Accident Severity in Surrey, 2021

NLP Data Mining Text Analytics SAS Viya

Road accident datasets present a characteristic and difficult challenge for predictive modelling: the outcome of greatest policy interest — fatal accidents — is also the rarest. In 2,400 recorded accidents in Surrey in 2021, only 24 were fatal, producing a severe class imbalance that causes standard classifiers to default to predicting the majority class. This project builds a prediction pipeline in SAS Viya that explicitly addresses this imbalance and evaluates three model families on their ability to identify high-severity accidents in held-out data.

Data and target variable

The dataset contains 2,400 road accident records from Surrey, 2021, with accident severity as the target variable (three levels: slight, serious, fatal). The severe class imbalance — 24 fatal cases out of 2,400 total — required data balancing before modelling could proceed reliably.

Exploratory data analysis identified several data quality issues. Outlier values in number of vehicles and number of casualties were retained as plausible (multi-vehicle incidents do occur). An outlier value of 12 in the police officer attendance variable (did_poli_offi_att) was flagged as an incorrect entry since the variable can only take values 1–3; this was handled during the balancing and filtering pipeline. The junction detail variable contains a legitimate value of 9 representing "other" per the data guide and was retained.

Data balancing

Proprietary SAS bootstrapping code ("Balancing before cleaning") was applied to create a balanced working dataset. One-third of records from each severity level were bootstrapped and combined. This ensures that the models are exposed to adequate examples of serious and fatal accidents during training rather than learning to predict the slight-injury majority. Missing values in the severity variable were excluded during the balancing step. One missing value remained in latitude, longitude, and day of week after balancing; latitude and longitude were dropped (location is already captured by local authority district), and the single day-of-week missing case was filtered in the pipeline.

Variable selection

Variables were selected for the modelling pipeline based on three criteria:

The final variable set included: month, police officer attendance, day of week, first road class, junction detail, light conditions, number of casualties, number of vehicles, road type, speed limit, time category, urban/rural area, local authority district, and weather conditions.

SAS Viya pipeline

The modelling pipeline in SAS Viya Build Model consisted of seven sequential nodes:

Model results

ModelCumulative lift (top 10%)KS cutoffSensitivityFalse positive rate
Bayesian Network3.04 (validate)0.1670.7%10.5%
Decision Tree3.05 (validate)0.3459.3%14.0%
Logistic Regression2.21 (validate)0.1089.7%35.7%

Cumulative lift measures how much more effectively the model identifies high-severity accidents in the top decile than random selection would. A lift of 3.04 means the Bayesian Network finds three times as many serious accidents in the top 10% of its ranked predictions as would be found by randomly inspecting 10% of records.

The Bayesian Network and Decision Tree achieve similar lift values at the top decile, but the Bayesian Network has stronger discriminatory power at the KS cutoff — it achieves 70.7% sensitivity at a false positive rate of only 10.5%, compared with the Decision Tree's 59.3% sensitivity at 14.0% false positive rate. The Logistic Regression achieves the highest sensitivity (89.7%) but at a much higher false positive rate (35.7%), making it less suitable for targeted intervention scenarios where resource constraints limit how many predicted high-risk cases can be acted on.

The Bayesian Network's advantage reflects its ability to capture conditional dependencies between variables (for example, the interaction between time of day, road type, and speed limit) rather than treating predictors as independent contributors to the outcome.