Chronic abdominal pain with no identifiable organic cause is one of the most common reasons children and adolescents end up in a pediatric gastroenterology clinic. Under the Rome IV framework, these conditions are classified as functional abdominal pain disorders, a family that includes functional dyspepsia, irritable bowel syndrome, abdominal migraine, and functional abdominal pain not otherwise specified. They are no longer viewed as isolated gastrointestinal complaints but as disorders of gut-brain interaction, in which pain burden, sleep quality, somatic symptom amplification, school functioning, and the family psychological context all shape how the illness presents. Anxiety is particularly relevant here: it can intensify pain perception, drive health care seeking, impair daily functioning, and help symptoms persist, while the pain itself can feed anticipatory worry, avoidance, and school absence. Yet anxiety is easily missed when the presenting complaint is a stomachache, especially in settings where mental health assessment is not routinely embedded in gastroenterology care.
A research team at the Department of Pediatric Gastroenterology of The Second Affiliated Hospital and Yuying Children’s Hospital of Wenzhou Medical University set out to close this gap with a clinically usable risk-stratification tool. In an observational predictive modeling study published in Frontiers in Psychiatry, Weiwei Wu, Quanquan Ye, Xiaochun Lin, Sisi Li, Shishi Wang, and Xiaoyan Liu developed and internally validated a stacking machine learning model designed to flag comorbid anxiety disorder in children and adolescents with functional abdominal pain disorders. The work was approved by the hospital’s Ethics Committee, which waived informed consent because of the retrospective design and the use of de-identified, routinely collected data, and the study was conducted in accordance with the Declaration of Helsinki.
The study population consisted of 629 eligible patients aged 7 to 18 years who fulfilled Rome IV diagnostic criteria for functional abdominal pain disorders and were evaluated between December 2021 and December 2025. Patients with evidence of organic gastrointestinal, inflammatory, metabolic, infectious, or structural causes of abdominal pain were excluded, as were those lacking standardized anxiety assessment, those who had received psychological or psychiatric treatment before the abdominal pain assessment, and those with substantial missingness in key predictor data. Among the 629 included patients, 210, or 33.4 percent, had comorbid anxiety disorder. The cohort was randomly divided at a 7:3 ratio, using stratified sampling by anxiety status, into a training cohort of 440 patients, including 147 with anxiety disorder, and an internal validation cohort of 189 patients, including 63 with anxiety disorder. This stratified allocation preserved a comparable event proportion across both datasets, and baseline characteristics were largely balanced, with most standardized mean differences small, although abdominal pain intensity showed a slightly higher difference of 0.11.
The outcome was defined rigorously. Anxiety symptoms were first screened using the Chinese version of the Screen for Child Anxiety Related Emotional Disorders, a 41-item self-report instrument scored from 0 to 82, with a total score of 25 or higher considered a positive screen. The final diagnosis of comorbid anxiety disorder, however, was determined by trained child psychiatrists or clinical psychologists according to DSM-5 criteria, covering generalized anxiety disorder, separation anxiety disorder, social anxiety disorder, panic disorder, specific phobia, and other clinically defined anxiety disorders. Crucially, SCARED total and subscale scores, clinician diagnostic conclusions, psychiatric interview results, and post-diagnostic treatment variables were excluded from all candidate predictors, so the model estimated anxiety probability from routinely obtainable information rather than reproducing the diagnostic instrument itself. The anxiety assessment was completed before any model development, and the clinicians responsible for diagnosis were not involved in model building.
Candidate predictors spanned six domains collected before outcome classification. Demographic variables included age, sex, body mass index, residence, and only-child status. Pain-related variables included symptom duration, pain frequency, pain intensity on a numerical rating scale, morning pain, night-time awakening due to pain, pain temporally associated with stressful events, Functional Disability Inventory score, school absence measured as days missed in the preceding month, previous emergency visits, previous gastrointestinal medication use, and disorder subtype. Somatic comorbidities such as constipation, diarrhea, nausea, bloating, headache, and allergic disease were recorded, along with a separately coded binary measure of school avoidance reflecting refusal behaviors rather than missed days. Child psychosocial measures included the Sleep Disturbance Scale for Children, the Children’s Somatic Symptoms Inventory-24, pain catastrophizing, depressive symptoms, peer relationship difficulties, and recent academic stress. Family-level variables included parental anxiety symptoms on the Generalized Anxiety Disorder-7 scale, parental depressive symptoms, marital conflict, single-parent and left-behind child status, overprotective parenting, and family history of recurrent abdominal pain or psychiatric disorders.
Descriptive multivariable logistic regression outlined the clinical risk profile before modeling. Older age showed a modest association with anxiety, with an adjusted odds ratio of 1.07 per one-year increase. Longer symptom duration and higher pain frequency, both transformed using log2(1 + x), carried adjusted odds ratios of 1.31 and 1.36, respectively. Night-time awakening due to pain was associated with an odds ratio of 1.55, while pain temporally associated with stressful events showed an odds ratio of 1.86. Each 5-point increase in SDSC score carried an odds ratio of 1.18, each 5-point increase in CSI-24 score an odds ratio of 1.26, each 5-point increase in parental GAD-7 score an odds ratio of 1.46, and school absence after transformation an odds ratio of 1.28. These regression analyses were treated as descriptive and were not used for predictor screening in the machine learning pipeline.
The modeling pipeline itself incorporated extensive safeguards against information leakage. The split was performed before any model-development procedure, and the validation cohort was reserved exclusively for final evaluation, never used for feature selection, hyperparameter tuning, calibration, threshold selection, learner specification, or meta-learner training. Missing data were minimal, with 248 of 27,676 candidate-predictor observations, or 0.90 percent, missing before imputation and a maximum variable-specific missingness of 3.2 percent; imputation parameters were estimated only from training data and applied unchanged to held-out folds and the validation cohort. Feature selection used least absolute shrinkage and selection operator logistic regression, repeated within each cross-validation fold, retaining predictors with non-zero coefficients at the penalty parameter selected by cross-validation within that fold. Four prespecified base learners were then developed: an explainable boosting machine to capture non-linear additive effects while preserving interpretability, a calibrated support vector machine as a margin-based classifier, a random forest as a bagging-based tree ensemble, and CatBoost as a regularized gradient boosting model suited to tabular clinical data.
The stacking ensemble was built from out-of-fold predicted probabilities. For each training patient, the meta-features consisted only of predicted probabilities generated when that patient belonged to the held-out fold, preventing the meta-learner from training on overly optimistic in-sample predictions. These four probability streams fed an L2-penalized logistic regression meta-learner that produced the final estimated probability of comorbid anxiety disorder. All four base learners received positive penalized coefficients, with CatBoost contributing the largest weight, followed by the explainable boosting machine, random forest, and support vector machine. Pairwise diversity analyses confirmed that the learners provided complementary rather than identical outputs, with probability correlations ranging from 0.55 to 0.68, prediction disagreement from 0.24 to 0.33, and double-fault rates from 0.103 to 0.150. Classification thresholds were fixed in the training cohort using the Youden index and applied unchanged to the validation cohort.
In out-of-fold training estimates, the stacking model achieved an AUC of 0.831 and a Brier score of 0.151. In the validation cohort, it showed the highest numerical performance among all candidate models, with an AUC of 0.846, a 95 percent confidence interval of 0.789 to 0.894, accuracy of 0.788, sensitivity of 0.762, specificity of 0.802, positive predictive value of 0.658, negative predictive value of 0.871, F1 score of 0.706, and Brier score of 0.146, the lowest among the evaluated models. Pairwise DeLong tests showed the stacking model significantly outperformed the explainable boosting machine and the support vector machine, with a borderline significant advantage over random forest, but only a modest and non-significant improvement over CatBoost, the best single learner. Decision curve analysis suggested higher net benefit than treat-all and treat-none strategies across clinically relevant thresholds, and calibration showed overall agreement between predicted and observed risks, with mild fluctuation in the validation curve.
SHAP analysis applied to the complete stacking pipeline revealed the drivers of the model’s output, with values expressed on the log-odds scale. School absence showed the highest mean absolute SHAP value, followed by parental GAD-7 score and CSI-24 score, indicating that school impairment, parental anxiety symptoms, and child somatic symptom burden were the leading contributors. Pain-stress association, symptom duration, pain frequency, SDSC score, age, and night-time awakening rounded out the top contributors, and higher levels of these variables generally shifted predictions toward higher anxiety probability. Predictor correlations were weak to moderate, with none exceeding 0.60, the strongest being school absence with CSI-24 score at 0.55. The authors caution that the model was internally validated only, that the observational design precludes causal interpretation, and that the slightly higher validation AUC may reflect sampling variability from the moderate validation sample and a single random split. External validation across independent centers, standardized diagnostic procedures, and prospective impact studies assessing whether model-guided risk stratification improves referral decisions and outcomes are required before clinical implementation. The model is intended to support, not replace, clinical assessment by identifying patients who may warrant more detailed psychological evaluation.
Subject of Research: Machine learning for identifying comorbid anxiety disorder in pediatric functional abdominal pain disorders
Article Title: A stacking machine learning model for identifying comorbid anxiety disorder in children and adolescents with functional abdominal pain disorders
Article References: Wu, W., Ye, Q., Lin, X., Li, S., Wang, S., & Liu, X. (2026). A stacking machine learning model for identifying comorbid anxiety disorder in children and adolescents with functional abdominal pain disorders. Frontiers in Psychiatry, 17, Article 1904174. https://doi.org/10.3389/fpsyt.2026.1904174
Image Credits: AI Generated
DOI: 10.3389/fpsyt.2026.1904174
Keywords: machine learning, anxiety disorder, children and adolescents, functional abdominal pain disorders, stacking ensemble, LASSO, SHAP, Rome IV, pediatric gastroenterology, predictive modeling, stacking, machine
Cite Scienmag News
Glenn Wilkins. (October 23, 2026). Machine learning flags hidden anxiety in children with chronic abdominal pain. Scienmag. https://scienmag.com/machine-learning-flags-hidden-anxiety-in-children-with-chronic-abdominal-pain/
Glenn Wilkins. "Machine learning flags hidden anxiety in children with chronic abdominal pain." Scienmag, 23 October 2026, https://scienmag.com/machine-learning-flags-hidden-anxiety-in-children-with-chronic-abdominal-pain/. Accessed 23 October 2026.
Glenn Wilkins. "Machine learning flags hidden anxiety in children with chronic abdominal pain." Scienmag. October 23, 2026. https://scienmag.com/machine-learning-flags-hidden-anxiety-in-children-with-chronic-abdominal-pain/

