Machine learning-based identification of medication adherence predictors in two Spanish primary care cohorts
摘要
Non-adherence to medication represents an important global challenge that compromises patient outcomes and increases healthcare costs, particularly in Spain due to the high prevalence of chronic conditions. Therefore, identifying the key factors influencing adherence is a valuable approach for developing targeted interventions. This study analysed two large real-world primary care databases from Madrid and Catalonia using four feature selection methods and three machine learning classifiers, together with threshold optimisation, calibration analysis, bootstrap confidence intervals, and importance analyses. Recursive Feature Elimination with Cross-Validation (RFECV), a cross-validated procedure that iteratively removes less informative variables) combined with Extreme Gradient Boosting (XGBoost), a tree-based algorithm that combines multiple decision trees, achieved the best performance in both cohorts. Overall, 48 structural factors were identified, 19 in Madrid and 29 in Catalonia, with consistent validation and test performance (AUROC 0.6953/0.6952 and 0.7775/0.7788, respectively). In Madrid, the number of medications and chronic disease burden were the most relevant factors, whereas in Catalonia smoking-related factors, rural or urban context, and prescription-timing factors were important. These findings support the value of using artificial intelligence to identify patterns and develop patient-centred adherence strategies in clinical practice. Although such data-driven AI models can reveal useful patterns, their interpretation should remain grounded in comprehensive adherence frameworks and and the results should be interpreted considering the heterogeneity between the databases, indirect adherence measures, and the absence of richer social determinants or external validation. Future research should therefore address these limitations to strengthen the generalisability of the findings.