AUTHOR=Xia Fang , Li Qingwen , Luo Xin , Wu Jinyi TITLE=Machine learning model for depression based on heavy metals among aging people: A study with National Health and Nutrition Examination Survey 2017–2018 JOURNAL=Frontiers in Public Health VOLUME=Volume 10 - 2022 YEAR=2022 URL=https://www.frontiersin.org/journals/public-health/articles/10.3389/fpubh.2022.939758 DOI=10.3389/fpubh.2022.939758 ISSN=2296-2565 ABSTRACT=Objective To explore the association between depression and blood metal elements, we conducted this machine learning model fitting research. Methods Datasets from the National Health and Nutrition Examination Survey (NHANES) in 2017-2018 were downloaded and 3247 aging samples with 10 different metals were included. Eight machine learning algorithms were compared for analyzing metal and depression. Poisson regression and XGBoost model were conducted to find the risk factors and prediction for depression. Results A total of 344 individuals in 3247 participants were diagnosed as depression. In the Poisson model, we found cadmium (coefficient=0.22, P=0.00000941), ethyl mercury (coefficient=3.43, P=0.003216) and mercury (coefficient=-0.15, P=0.001524) were related with depression. Eight machine learning algorithms including XGBoost (eXtreme Gradient Boosting), Random Forest (RF), Support vector machine(SVM), Decision Tree(DT), Boosted Tree(BT), Multivariate Adaptive Regression Splines(MARS), K-nearest neighbors (KNN) and artificial neural network (ANN) were compared for the evaluation of depression. XGBoost model was the best algorithm, the accuracy was 0.89 with 95%CI (0.87, 0.92) and Kappa value was 0.006. Area under the curve (AUC) was 0.88. After that, an online XGBoost application for depression prediction was developed. Conclusion Blood heavy metals, especially cadmium, ethyl mercury and mercury were significant associated with depression and the prediction of depression was imperative.