Machine learning–driven identification of whole-food dietary patterns associated with anxiety and rheumatoid arthritis comorbidity patterns: evidence from the NHANES and the USDA MyPyramid Equivalents database
Abstract
The prevalence of rheumatoid arthritis among individuals with anxiety has been increasing over time. Although common foods contain diverse dietary components, the associations of dietary micronutrients and food-group patterns with rheumatoid arthritis status among individuals with anxiety remain insufficiently understood. This cross-sectional study utilized data from seven cycles (2005–2018) of the National Health and Nutrition Examination Survey (NHANES), along with the MyPyramid Equivalents Database from the United States Department of Agriculture for complementary dietary classification analysis. The MyPyramid analysis represented a complementary food-group transformation of NHANES dietary recall data rather than an independent external validation cohort. Feature collinearity was evaluated using correlation coefficients, and variable selection was performed using the BORUTA algorithm. Class imbalance was addressed using the Synthetic Minority Over-sampling Technique (SMOTE). Six machine learning models were developed to classify rheumatoid arthritis status among participants with medication-defined treated anxiety based on dietary features. SHapley Additive exPlanations (SHAP) and Local Interpretable Model-Agnostic Explanations (LIME) were applied to examine the associations between dietary trace elements, daily dietary intake, and rheumatoid arthritis status among individuals with anxiety. A temporal holdout sensitivity analysis was conducted to assess model performance in later NHANES cycles. Random Forest achieved the highest observed AUC-ROC across both dietary frameworks. The temporal holdout sensitivity analysis supported the performance of the Random Forest model in later NHANES cycles. To interpret the selected Random Forest model, SHAP was used as a post-hoc explanation method to quantify feature contributions at both global and individual levels. SHAP analysis identified calcium, lycopene, folate, and vitamin D as prominent negative contributors to RA-positive classification. Fruits, dairy products, and seafood rich in n-3 fatty acids also showed negative contributions to RA-positive classification. LIME analysis further supported the interpretability of individual-level predictions. Machine learning models using two complementary dietary feature representations derived from NHANES discriminated rheumatoid arthritis status among individuals with anxiety, with Random Forest showing the highest observed AUC-ROC among the evaluated models. Dietary features were associated with rheumatoid arthritis status in this population. These findings require confirmation in prospective cohorts or randomized trials before informing clinical dietary guidelines.