Predicting Road Traffic Accident Severity in Surrey, 2021
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:
- Correlation: Highly collinear variables were reduced to a single representative. For example, OS grid reference and latitude/longitude duplicate the information already in local authority district — only the district variable was retained.
- Relevance: Variables with no plausible causal pathway to accident severity (e.g. road number identifiers) were excluded.
- Redundancy: Where variables captured the same underlying dimension at different granularities (e.g. time and time category; date and month), the more analytically useful form was retained and its duplicate dropped.
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:
- Data: Dataset definition and partitioning into train/validate/test
- Data Exploration: Summary statistics and variable distributions, used to validate the variable selection decisions
- Filtering: Excludes observations more than 3 standard deviations from the mean for interval variables; removes rare-percentile observations in categorical variables — handles the outliers identified in EDA
- Imputation: Missing values imputed using the decision tree method
- Variable Selection: Fast supervised selection retains only variables with sufficient explanatory power for the target
- Model nodes: Bayesian Network, Decision Tree, and Logistic Regression run in parallel on the processed data
Model results
| Model | Cumulative lift (top 10%) | KS cutoff | Sensitivity | False positive rate |
|---|---|---|---|---|
| Bayesian Network | 3.04 (validate) | 0.16 | 70.7% | 10.5% |
| Decision Tree | 3.05 (validate) | 0.34 | 59.3% | 14.0% |
| Logistic Regression | 2.21 (validate) | 0.10 | 89.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.