Using Machine Learning to Investigate Predictors of Fasting Blood Glucose: Insights into Circadian Timing and Age Interactions
Organizations: School of Computing and Information Science, Anglia Ruskin University East Road, Cambridge CB1 1PT, U.K.
Abstract
Impaired glucose regulation is a major contributor to metabolic dysfunction and type 2 diabetes. This study developed an interpretable machine-learning framework to predict log-transformed fasting blood glucose using metabolic, hormonal, lifestyle, demographic, nutritional, and circadian variables from the National Health and Nutrition Examination Survey 2017--2020 pre-pandemic dataset. After merging multiple NHANES sub-datasets, data processing used a leakage-resistant pipeline in which imputation, scaling, and one-hot encoding were performed only after dataset splitting and within training folds. Elastic Net, LASSO, and XGBoost models were evaluated using 94 candidate predictors and engineered circadian interaction terms. Performance was assessed using mean absolute error, root mean squared error, coefficient of determination, calibration, and Shapley Additive Explanations. The final interaction-augmented XGBoost model achieved strong performance on the independent test set, with a mean absolute error of 0.0804, a root mean squared error of 0.1148, and a coefficient of determination of 0.7761, using 10 predictors. Glycohemoglobin was the dominant predictor, followed by insulin, diabetes diagnosis, gamma-glutamyl transferase, age, race, and gender. Among the engineered interaction terms, sleep midpoint multiplied by age was consistently retained in repeated random-split analyses, although its contribution remained modest relative to dominant glycaemic predictors. These findings support further investigation of circadian-age interactions in metabolic health.
Figures & tables
| Category | Variables |
| Metabolic biomarkers | Body mass index (BMI), waist circumference, high-density lipoprotein cholesterol (HDL), low-density lipoprotein cholesterol (LDL), glycohemoglobin (HbA1c; denoted as GHB in model variables), high-sensitivity C-reactive protein (CRP), alanine aminotransferase (ALT), aspartate aminotransferase (AST), gamma-glutamyl transferase (GGT), uric acid, triglycerides, estimated glomerular filtration rate (eGFR), insulin, total bilirubin, systolic blood pressure, diastolic blood pressure, fasting glucose, blood urea nitrogen (BUN), lactate dehydrogenase (LDH), globulin, total protein, total cholesterol, and creatinine |
| Circadian-related variables | Bedtime, sleep health index, social jetlag hours, sleep apnoea risk, sleep midpoint (weekdays and weekends), sleep schedule category, circadian disruption indicators, and sleep duration variability |
| Lifestyle and medical history | Physical activity levels (work-related and recreational), family history of diabetes or cancer, smoking status (smoked at least 100 cigarettes in lifetime), sedentary time, lifestyle scores and categories derived from vigorous and moderate work/recreational activity and walking or bicycling, and doctor-diagnosed diabetes |
| Hormonal profiles | Sex hormone-binding globulin (SHBG), estradiol, androstenedione, luteinizing hormone (LH), and follicle-stimulating hormone (FSH) |
| Nutritional intake | Macronutrients (energy, carbohydrates, fat, fibre, and protein), micronutrients (vitamins and minerals), caffeine, alcohol, and dietary pattern indicators (e.g., sugar-free, low-carbohydrate, and high-protein diets) |
| Control variables | Gender, age, race, and family income-to-poverty ratio |
| Model | MAE | RMSE | (Dev) | (Test) | CV | Features |
| Model 1. Elastic Net (Full) | 0.0881 | 0.1228 | 0.6793 | 0.7441 | 91 | |
| Model 1b. LASSO (Full) | 0.0914 | 0.1273 | 0.6554 | 0.7251 | 91 | |
| Model 2. XGBoost (Full) | 0.0795 | 0.1134 | 0.7863 | 0.7817 | 91 | |
| Model 3. XGBoost (Selected) | 0.0813 | 0.1173 | 0.7667 | 0.7666 | 12 | |
| Model 4. XGBoost (+ Interactions) | 0.0805 | 0.1152 | 0.7867 | 0.7749 | 95 | |
| Model 5. XGBoost (+ Interactions, Selected) | 0.0805 | 0.1164 | 0.7604 | 0.7701 | 12 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Sample construction step | N |
| Participants in the biomarker merge base with fasting glucose and insulin data available for merging | 5,090 |
| Excluded: rows with more than 50% missingness across the merged biomarker dataset | 145 |
| Remaining biomarker dataset after row-level missingness filtering | 4,945 |
| Participants in the sleep questionnaire dataset before filtering | 10,195 |
| Excluded: missing critical sleep variables required to derive circadian measures | 222 |
| Remaining sleep dataset after critical-variable filtering | 9,973 |
| Model | Hyperparameter search space |
| Model 1: Elastic Net (Full) | ; |
| Model 1b: LASSO (Full) | |
| Models 2–5b: XGBoost | ; ; ; ; ; ; ; ; |
| Model | Optimal settings |
| Model 1: Elastic Net (Full) | ; |
| Model 1b: LASSO (Full) | |
| Model 2: XGBoost (Full) | ; ; ; ; ; ; ; ; |
| Model 3: XGBoost (Selected) | ; ; ; ; ; ; ; ; |
| Model 4: XGBoost (+ Interactions) | ; ; ; ; ; ; ; ; |
| Model 5: XGBoost (+ Interactions, Selected) | ; ; ; ; ; ; ; ; |
| Model | Test | MAE | RMSE | Tuned CV |
| Model 4: XGBoost (+ Interactions) | ||||
| Model 5: XGBoost (+ Interactions, Selected) | ||||
| Model 5b: XGBoost (+ Interactions, Selected, Pruned) |
| Feature | Importance (mean) | Importance (SD) |
| GHB | 1.0973 | 0.0252 |
| Insulin (log) | 0.0186 | 0.0018 |
| Diabetes | 0.0155 | 0.0021 |
| GGT (log) | 0.0121 | 0.0035 |
| Age | 0.0117 | 0.0025 |
| Race | 0.0097 | 0.0022 |
| Feature | Count | Frequency | Importance mean SD |
| GHB | 10 | 1.0 | |
| Insulin (log) | 10 | 1.0 | |
| Diabetes | 10 | 1.0 | |
| Age | 10 | 1.0 | |
| GGT (log) | 10 | 1.0 | |
| Race | 10 | 1.0 |
| Model / comparison | Test | MAE | RMSE | Tuned CV |
| Model 5b | ||||
| Model 5b (ablated) | ||||
| Delta (Model 5b minus ablated) |
| Model | Test | MAE | RMSE | Tuned CV |
| Restricted Model 4 | ||||
| Restricted Model 5 | ||||
| Restricted Model 5b |
| Feature | Count | Frequency |
| Age | 10 | 1.0 |
| ACR (log) | 10 | 1.0 |
| GGT (log) | 10 | 1.0 |
| Triglycerides (log) | 10 | 1.0 |
| HDL | 10 | 1.0 |
| SHBG (log) | 10 | 1.0 |