Roughly one in ten American adults lives with diabetes, and a large share of them are undiagnosed. This project asks a
narrow, tractable version of that problem: given routine clinical measurements, how accurately can we flag someone as
high-risk — and which measurements are actually doing the work?
97%Test-set accuracy
0.99ROC-AUC
9,538Patient records
4Final predictors
Data and preprocessing
The dataset holds 9,538 medical records with demographic, lifestyle and biometric fields. It arrived unusually clean —
no missing values and no outliers worth removing — so preprocessing focused on the relationships between variables
rather than repair work.
Checked multicollinearity with Variance Inflation Factor, which flagged fasting glucose and HbA1c
as strongly correlated. Glucose was dropped: HbA1c carries a longer-horizon signal and is the more clinically stable
of the two.
Standardized numeric predictors and encoded categorical fields with the Tidyverse.
Feature selection
Ran stepwise regression to narrow the predictor set.
Settled on four variables: age, BMI, HbA1c, and family history.
Confirmed with ANOVA that the reduced model performed comparably to the full model — the extra
predictors were not earning their complexity.
Modeling and evaluation
Fit logistic regression as the primary classifier on a 70/30 train-test split.
Confusion matrix on held-out data: 97% accuracy, with high recall on positive cases — the metric
that matters most for a screening tool, where a missed case costs more than a false alarm.
5-fold cross-validation returned RMSE 0.146, R² 0.906 and MAE 0.04, indicating the fit was stable
rather than a lucky split.
The ROC curve yielded an AUC of 0.99.
What the model says
HbA1c, BMI and age are the dominant predictors, with family history acting as a modifier rather
than a driver on its own.
Examining family history across age bands showed the effect concentrating in older cohorts.
The BMI × HbA1c interaction is where risk compounds: elevated metabolic indicators together shift diagnosis
likelihood far more than either does alone.
Practically, this argues for monitoring metabolic health early rather than screening on age alone.
Limitations
The dataset carries no diet, exercise, or socioeconomic variables — all of which are known confounders.
Measurement practices vary across clinical sites, which introduces noise the model can't see.
97% accuracy on a clean secondary dataset is not 97% accuracy in a clinic. This is a modeling exercise, not a
diagnostic tool.
Next steps I'd take: gender-specific risk profiles, BMI × gender interactions, and validation on an external
cohort.