A statistical analysis of Thames Valley Police stop-and-search data (2020–2022, ~40,000 records), investigating two questions using logistic regression: what factors predict the probability that a stop-and-search involves a woman, and what factors predict the probability of arrest. Particular focus is given to differences by ethnicity, age, and search purpose.
Data preparation
- Extracted hour-of-day and month from raw timestamp data, grouping into meaningful categories (time-of-day bands, seasons) to reduce model complexity
- Constructed a binary arrest indicator from the raw outcome variable
- Collapsed sparse or non-significant factor levels (e.g. rare legislation types) into broader categories, guided by significance testing and model diagnostics
Modelling
- Question 1 (sex prediction): Logistic regression using stepwise AIC for initial variable selection, followed by ridge and elastic net regression (tuning α from 0 to 0.5) to guard against overfitting, with model accuracy evaluated via ROC curve and AUC
- Question 2 (arrest prediction): Logistic regression using stepwise BIC, cross-checked against LASSO variable selection, with a direct comparison table assessing consistency between the two approaches
- All results reported as odds ratios with 95% confidence intervals, interpreted relative to reference categories (most common category in each variable)
- Ethnicity was the most significant factor in both models. Stop-and-searches were disproportionately concentrated on White individuals (in the sex model, White individuals had substantially higher odds of being female relative to other ethnicities); in the arrest model, Black individuals had 22% higher odds of arrest than White individuals, and Asian individuals 16% lower odds, holding all else constant
- Age showed a clear positive association with arrest: individuals over 34 had 51% higher odds of arrest than 18–24 year olds
- Drugs was the dominant search purpose by volume but had a comparatively low arrest rate, suggesting many drug-related searches were more speculative than searches for theft or weapons
- Model performance for the sex-prediction task was modest (AUC = 0.648), reflecting the inherent difficulty of predicting sex from these variables alone
R, logistic regression (glm), stepwise selection (AIC/BIC), ridge and elastic net regression
(glmnet), ROC/AUC evaluation, odds ratio and confidence interval reporting
Data is limited to a single police force (Thames Valley) and may not generalise to other regions; officer-recorded ethnicity introduces potential measurement error; area-level context (deprivation, demographics) was unavailable and likely explains some residual variation.
Assignment.Rmd— full analysis codeAssignment.pdf— rendered report with full write-up, tables, and figuresST404Assignment3.html— rendered HTML version of the analysisStopSearchThamesV.Rdata— dataset used for the analysis