People living with treated anxiety who eat more calcium, lycopene, folate and vitamin D — and more fruits, dairy products and omega-3-rich seafood — show a lower likelihood of also having rheumatoid arthritis, according to a machine learning analysis of US national survey data published in BMC Public Health. The study, led by Zhenggang Xiong, Wei Yan and Yuzhen Ma, drew on seven cycles of the National Health and Nutrition Examination Survey (NHANES) from 2005 to 2018 to ask a question that has been difficult to pin down: among individuals with anxiety, which whole-food dietary patterns track with rheumatoid arthritis status? The researchers framed the problem as a classification task.
They focused on participants whose anxiety was defined by medication use, meaning the analysis covered people with treated anxiety rather than the general population. Dietary information came from NHANES recall data, complemented by the United States Department of Agriculture's MyPyramid Equivalents Database, which translated the same recall data into food-group equivalents. The authors are explicit that this food-group transformation was a complementary way of representing the NHANES dietary data, not an independent external validation cohort — an important distinction for interpreting how robust the findings are.
Methodologically, the pipeline was deliberately cautious. The team first assessed collinearity among dietary features using correlation coefficients, then used the BORUTA algorithm to select variables, filtering out features that carried no meaningful signal. Because the distribution of rheumatoid arthritis status within the anxiety population was uneven, class imbalance was addressed with the Synthetic Minority Over-sampling Technique (SMOTE), a resampling approach that prevents models from simply defaulting to the majority class.
Six machine learning models were then trained to classify rheumatoid arthritis status based on dietary features alone. Random Forest came out on top, achieving the highest observed AUC-ROC among the six evaluated models across both dietary frameworks — the micronutrient representation and the food-group representation. A temporal holdout sensitivity analysis, in which the model was tested on later NHANES cycles than those used for training, supported the Random Forest model's performance in more recent survey years.
The interpretability layer is where the study's headline associations emerge. The researchers applied SHapley Additive exPlanations (SHAP), a post-hoc explanation method that quantifies each feature's contribution to predictions both globally and at the individual level. SHAP analysis identified calcium, lycopene, folate and vitamin D as prominent negative contributors to RA-positive classification — meaning higher levels of these dietary components pushed predictions away from a rheumatoid arthritis label.
In parallel, the food-group analysis showed that fruits, dairy products and seafood rich in n-3 fatty acids also contributed negatively to RA-positive classification. To complement the global picture, the team used Local Interpretable Model-Agnostic Explanations (LIME), which explains individual predictions rather than average model behavior. LIME analysis supported the interpretability of individual-level predictions, suggesting the model's reasoning could be traced case by case rather than resting on opaque aggregate patterns.
Together, SHAP and LIME offered converging evidence about which dietary features the trained models relied on when separating participants with rheumatoid arthritis from those without it. The authors emphasize that the models discriminated rheumatoid arthritis status among individuals with anxiety using two complementary dietary feature representations, and that dietary features were associated with rheumatoid arthritis status in this population. But they state plainly that these findings require confirmation in prospective cohorts or randomized trials before informing clinical dietary guidelines.
As a cross-sectional analysis, the study captures a snapshot in time and cannot establish whether diet influences rheumatoid arthritis risk, whether the disease or its management alters eating patterns, or whether shared underlying factors shape both. What the study delivers, within those limits, is a rigorously evaluated and interpretable shortlist of whole-food dietary signals — calcium, lycopene, folate, vitamin D, fruits, dairy and omega-3-rich seafood — that distinguished rheumatoid arthritis status among people with treated anxiety in a large national survey. The authors position these associations as hypotheses for the prospective studies that must come next, not as dietary advice.
For now, the work shows how machine learning paired with explanation tools can turn sprawling dietary recall data into concrete, testable patterns at the intersection of mental and autoimmune health.
Subject of Research: Associations between whole-food dietary patterns and rheumatoid arthritis status among individuals with anxiety identified through machine learning analysis of NHANES data
Article Title: 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
Article References: Xiong, Z., Yan, W., & Ma, Y. (2026). 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. BMC Public Health. https://doi.org/10.1186/s12889-026-30040-5
Image Credits: AI Generated
DOI: 10.1186/s12889-026-30040-5
Keywords: rheumatoid arthritis, anxiety, dietary patterns, machine learning, NHANES, random forest, SHAP, vitamin D, calcium, omega-3 fatty acids, cross-sectional study, nutrition
Cite Scienmag News
Teresa Odom. (October 23, 2026). Machine Learning Links Calcium-Rich and Fruit-Forward Diets to Lower Rheumatoid Arthritis Odds in People With Anxiety. Scienmag. https://scienmag.com/machine-learning-links-calcium-rich-and-fruit-forward-diets-to-lower-rheumatoid-arthritis-odds-in-people-with-anxiety/
Teresa Odom. "Machine Learning Links Calcium-Rich and Fruit-Forward Diets to Lower Rheumatoid Arthritis Odds in People With Anxiety." Scienmag, 23 October 2026, https://scienmag.com/machine-learning-links-calcium-rich-and-fruit-forward-diets-to-lower-rheumatoid-arthritis-odds-in-people-with-anxiety/. Accessed 23 October 2026.
Teresa Odom. "Machine Learning Links Calcium-Rich and Fruit-Forward Diets to Lower Rheumatoid Arthritis Odds in People With Anxiety." Scienmag. October 23, 2026. https://scienmag.com/machine-learning-links-calcium-rich-and-fruit-forward-diets-to-lower-rheumatoid-arthritis-odds-in-people-with-anxiety/

