Baseline characteristics and exploratory data analysis
This study included 514 patients who had non-sedated CMR. Of these, 309 patients (60.1%) had motion artifacts due to anxiety. Demographic variables such as gender, education level and SpO2 were not statistically different between the two groups, and therefore provided a similar baseline for subsequent analyses, as detailed in Table 1. To assess potential multicollinearity prior to extensive comparative analysis, a correlation matrix of the included clinical features was created (Figure 1A). Physiological relationships were found as expected, such as a negative correlation between HRV and resting heart rate, but no extreme collinearity was detected, indicating that severe linear multicollinearity was absent and the candidate features provided non-redundant linear information suitable for downstream multivariate modeling. Group comparisons revealed significant differences in core psychological and physiological measures. Patients in the artifact group presented with a higher state anxiety (STAI score) level compared to the non-artifact group (Figure 1B). Objective physiological parameters were also significantly altered, with the artifact group showing reduced heart rate variability (Figure 1C) and reduced maximum breath-hold duration (Figure 1D). Regarding previous MRI experience (Figure 1E), the univariate analysis showed a marginal P-value of 0.086; however, there was a trend toward a higher proportion of patients lacking previous MRI experience in the artifact group. Finally, exploratory analysis revealed that the probability of artifact occurrence exhibited a positive trend with increasing estimated scan duration (Figure 1F).
Machine learning model construction and performance evaluation
The exact sample sizes and the respective number of positive artifact cases for both the training (n = 360) and testing (n = 154) datasets are detailed in Supplementary Table 1, confirming that the native class distribution was evenly preserved across splits. Several machine learning algorithms were trained to predict anxiety-induced motion artifacts, building on the differences in baseline and non-linear trends found in exploratory data analysis. On the independent testing set (n = 154), the XGBoost model achieved an AUC of 0.875 (95% CI: 0.820–0.930), outperforming random forest (AUC = 0.822, 95% CI: 0.758–0.886), SVM (AUC = 0.805, 95% CI: 0.738–0.872), and logistic regression (AUC = 0.779, 95% CI: 0.708–0.850) (Figure 2A). Furthermore, on the precision-recall curve (Figure 2B), XGBoost achieved the highest AUPRC of 0.914, compared to 0.864 for random forest, 0.859 for SVM, and 0.833 for logistic regression. Comprehensive evaluation across multiple classification metrics on the test set (n = 154) demonstrated that XGBoost consistently achieved the highest overall performance: accuracy was 0.818 (95% CI: 0.758–0.878) for XGBoost, 0.768 (95% CI: 0.701–0.835) for random forest, 0.742 (95% CI: 0.672–0.812) for SVM, and 0.695 (95% CI: 0.623–0.767) for logistic regression. Sensitivity was 0.747 for XGBoost, 0.688 for random forest, 0.656 for SVM, and 0.593 for logistic regression. Specificity was 0.921 for XGBoost, 0.889 for random forest, 0.873 for SVM, and 0.841 for logistic regression. Positive predictive value (PPV/Precision) was 0.932 for XGBoost, 0.901 for random forest, 0.882 for SVM, and 0.844 for logistic regression. Negative predictive value (NPV) was 0.716 for XGBoost, 0.653 for random forest, 0.632 for SVM, and 0.589 for logistic regression. F1-score was 0.830 for XGBoost, 0.780 for random forest, 0.752 for SVM, and 0.697 for logistic regression (Figure 2C; Supplementary Table 2). Complete pairwise DeLong tests across all six model pairs revealed: XGBoost versus logistic regression (p = 0.041), XGBoost versus SVM (p = 0.089), XGBoost versus random forest (p = 0.162), random forest versus logistic regression (p = 0.312), SVM versus logistic regression (p = 0.540), and random forest versus SVM (p = 0.684) (Supplementary Table 3). This classification performance could be further highlighted by the confusion matrix for the optimal XGBoost model (Figure 2D). The model also had a high accuracy for predicting true positives and true negatives, but it is pointed out that 23 cases were predicted as negative but were actually artifacts. It could be due to erratic and abrupt patient motion or to transient discomfort during the lengthy scan and is intrinsically hard to capture completely with pre-scan baseline indicators.
The reliability of the predicted probabilities was tested with a calibration curve (Figure 2E). Often the curve followed the diagonal line of reference and the Hosmer-Lemeshow test showed a non-significant p-value of 0.163, suggesting no significant deviation from a perfect fit. Minor variations in the curve may be attributable to the natural variation in actual clinical situations. Lastly, DCA (Figure 2F) was used to assess clinical utility of the model. The XGBoost model exhibited a greater net clinical benefit over a wide spectrum of threshold probabilities than did the logistic regression model as well as the default strategies of treating all or no patients. This implies that it could be useful as an assistive device to inform targeted nursing interventions.
Global interpretability and non-linear associations via SHAP analysis
Once the predictive ability of the XGBoost model was validated, SHAP analysis was performed to understand the features that the model relied upon to make its predictions. It should be emphasized that the values for SHAP correspond to statistical relationships and the influence of features on the model output, but do not indicate causal relationships. Figure 3A is a SHAP summary plot showing the directional impact of the clinical variables on model predictions. For example, higher STAI scores and longer scan durations (shown as red dots) tend to be related to a higher probability of artifacts (indicated by positive SHAP values). In contrast, higher maximum breath-hold durations are concentrated on the negative side of the SHAP axis, indicating a negative attribution value associated with a reduced predicted probability of artifacts within the model structure. Consistently, the feature importance ranking (Figure 3B) indicated the STAI score, maximum breath-hold duration, estimated scan duration, and HRV as key features for predicting motion artifacts, aligning with the earlier noted baseline differences. In order to better understand the complex relationships obtained by the non-linear algorithm, SHAP dependence plots were created. The STAI-State score and predicted artifact probability demonstrated an empirical non-linear trajectory (Figure 3C). Mathematical evaluation of the LOESS curve's first and second derivatives, combined with tree split frequency analysis, identified an inflection zone around an STAI-State score of 45 (where SHAP values shifted from negative to sharply positive). However, this threshold should be interpreted as an empirical transition zone with inherent individual variation rather than a deterministic biological boundary. This pattern indicates a model-learned non-linear transition point, suggesting that while the algorithm attributes minimal incremental risk across lower anxiety scores, scores exceeding approximately 45 receive markedly higher positive SHAP attributions toward artifact prediction. To examine the dose-response relationship between acute anxiety levels and motion artifact incidence, patients were stratified across four established STAI-State clinical score bands: mild anxiety (<35, n = 165), moderate anxiety (35–44, n = 144), clinically significant elevated anxiety (45–54, n = 125), and severe anxiety (≥55, n = 80). The observed artifact occurrence rates exhibited a pronounced graded escalation: 21.2% (35/165) in the <35 group, 45.8% (66/144) in the 35–44 group, 82.4% (103/125) in the 45–54 group, and 94.6% (76/80) in the ≥55 group (trend p < 0.001). This graded relationship corroborates the non-linear risk escalation identified by post-hoc SHAP analysis around the score of 45, which aligns with published clinical thresholds designating clinically actionable situational anxiety.
As far as physiological parameters concerned, the shorter the maximum breath holding time, the more likely to be an artifact, and vice versa, the longer the breath holding time, the less the chance that the data were an artifact (Figure 3D). Likewise, reduced HRV was associated with positive SHAP values, further indicating that reduced autonomic regulation may be associated with increased risk (Figure 3E). A slight upward inflection at the extreme high values in the data distribution is noted in the LOESS smoothing curves in Figure 3D and Figure 3E. The latter is most likely a mathematical effect of the smoothing algorithm fitting the sparse, isolated data points at the ends, and not a change in actual physiology of risk. Lastly, there was a steady positive correlation between the estimated scan duration and the SHAP value (Figure 3F), suggesting that prolonged scan time serves as an important positive contributor to the model's prediction of motion artifacts.
Feature interactions and individualized risk trajectories
In addition to assessing the unique effects of clinical variables, SHAP interaction plots provided insights into how the XGBoost model captures interactions between variables which may be complex and multi-dimensional. There was an interaction between STAI score and previous MRI experience as shown in Figure 4A. Interestingly, patients with high STAI score (STAI score > 45) had obviously higher SHAP values than patients who had already had an MRI. This pattern indicates a model-learned interaction where prior exposure to the imaging environment is associated with an attenuation of the high positive SHAP attribution typically assigned to elevated situational anxiety within the algorithm.
Likewise, a possible synergy between the physiological capacity and physical attributes was found. At a shorter maximum breath-hold duration, the patients with larger abdominal girths tended to have higher SHAP values as shown in Figure 4B. This indicates that the algorithm assigns compounded positive attribution toward artifact prediction when limited breath-holding capacity coincides with increased abdominal dimensions. Another correlation was observed between autonomic regulation and psychological stress; among people with low HRV, high STAI scores were linked to even higher SHAP values, demonstrating a synergistic model attribution where the co-occurrence of reduced autonomic tone and high anxiety produces the highest positive contribution to predicted artifact probability within the model (Figure 4C). Further, longer estimated scan times yielded a more pronounced escalation in model-predicted risk among patients with a history of claustrophobia: at scan durations exceeding 50 min, the mean positive SHAP attribution reached +0.62 in claustrophobic patients compared to +0.28 in non-claustrophobic patients, indicating a distinct vulnerability within this subgroup during prolonged imaging (Figure 4D).
ICE curves were created to represent the trajectories of predicted probabilities, in order to translate these model-level insights into patient-specific risk assessment. Figure 4E illustrates the distribution of the predicted probability of the presence of motion artifacts for each patient in relation to his or her STAI score. The overall trend was that the mean predicted probability remained relatively stable across the lower score spectrum (hovering between 40.2% and 58.1% across STAI-State scores of 20 to 44), but escalated sharply from 58.1% to a plateau of 98.4% (individual range: 95.1%–99.8%) as scores surpassed the empirical inflection point of 45. The step-wise appearance of these trajectories is a mathematical property of tree-based machine learning algorithms that subdivide data at a finite number of split points, and does not necessarily indicate abrupt changes in biological state. The underlying gray lines representing the individual patients' baseline risk level also show the heterogeneity of the cohort in the vertical direction. The predicted probability decreased in a step-wise fashion as breath-hold duration increased, illustrating the model-predicted probability reduction associated with longer breath-hold duration across individual patient trajectories (Figure 4F).
Clinical application and risk stratification
SHAP waterfall plots were created for illustrative examples to showcase the practical use of the XGBoost model in clinical assessment of individuals. Figure 5A shows an “artifact probability” of 99.1% in a high-risk patient. In this particular case, the most important factors that increased the risk of a high score were a high STAI score and a brief breath-hold time. In contrast, Figure 5B shows that the low-risk profile has a projected event risk of 6.5% and is primarily due to good baseline characteristics. The important thing to note is that the x axis of these waterfall plots is the log-odds impact and not the absolute probability. This is a mathematical requirement to ensure additivity of the individual SHAP values and the final predicted probability is the transformed sum of the impacts.
The probability density distribution at the cohort level (Figure 5C) demonstrated distinct (although not absolute) separation in the scores predicted by the models for patients with and without the actual artifacts (p < 0.001). The reason for these overlaps may be due to the natural variation and noise of clinical practice. From these predicted probabilities, the cohort was divided into low, moderate and high clinical risk groups (Figure 5D). Artifact occurrence rates were actually in the correct order, with the high risk group having 93.6%. A small number of false positives (the remaining 6.4%) indicates that the model has some level of generalization, and is not overfitting the training data significantly.
A clinical impact curve was analyzed to further assess the practical implications of implementing this model (Figure 5E). For each level of risk, the predicted number of high-risk patients requiring intervention closely tracked the actual number of artifact cases: at the 40% risk threshold, 638 per 1,000 patients were predicted as high-risk compared to 586 true positive artifact cases, reflecting a modest false-positive margin of 5.2% (52/1,000). At the 50% threshold, 545 per 1,000 patients were predicted as high-risk versus 512 true positive cases (false-positive margin of 3.3%), demonstrating that algorithmic risk alerts maintain high specificity and minimize unwarranted preemptive nursing interventions across clinically relevant decision thresholds. Finally, based on the F1-score (Figure 5F), an optimization analysis found that 42% was the optimal intervention threshold to give the maximum F1-score of 0.940. This threshold could be one indicator that the nursing personnel may wish to consider when deciding how to allocate intervention resources and when a motion artifact needs to be avoided.
DATA AVAILABILITY:
The deidentified clinical dataset and the source data underlying the figures presented in this study have been permanently deposited in the Zenodo repository and are publicly available at https://doi.org/10.5281/zenodo.21980716.

Figure 1: Data exploration and distribution of clinical characteristics. (A) Correlation matrix of the included clinical features. Colors indicate the correlation coefficients. (B) Distribution of STAI score in patients with and without motion artifacts. (C) Distribution of heart rate variability (HRV) in patients with and without motion artifacts. (D) Distribution of maximum breath-hold duration in patients with and without motion artifacts. (E) Proportion of patients with and without previous MRI experience in the two groups. (F) Trend of artifact probability across different estimated scan durations. Error bars represent standard errors. Please click here to view a larger version of this figure.

Figure 2: Performance evaluation of the machine learning models. (A) Receiver operating characteristic (ROC) curves of the evaluated models. The p-value from the DeLong test comparing XGBoost and logistic regression is shown. (B) Precision-recall curves of the evaluated models. (C) Comparison of key performance metrics between logistic regression and XGBoost. (D) Confusion matrix of the XGBoost model for predicting motion artifacts. (E) Calibration curve of the XGBoost model showing agreement between predicted probabilities and observed proportions. (F) DCA showing the net benefit of the models across a range of threshold probabilities. Abbreviations: AUC = area under the receiver operating characteristic curve; AUPRC = area under the precision-recall curve; FPR = false-positive rate; HR = heart rate; NPV = negative predictive value; PPV = positive predictive value; ROC = receiver operating characteristic; SVM = support vector machine; TPR = true-positive rate; XGBoost = eXtreme Gradient Boosting. Please click here to view a larger version of this figure.

Figure 3: Global interpretability of the XGBoost model using SHAP analysis. (A) SHAP summary plot showing the distribution and direction of SHAP values for each feature. Colors indicate feature values, ranging from low (blue) to high (red). (B) Feature importance ranked according to the mean absolute SHAP value. (C) SHAP dependence plot for STAI score. (D) SHAP dependence plot for maximum breath-hold duration. (E) SHAP dependence plot for HRV. (F) SHAP dependence plot for estimated scan duration. Red lines represent LOESS smoothing curves illustrating potential nonlinear relationships between the features and model output. Abbreviations: HRV = heart rate variability; LOESS = locally estimated scatterplot smoothing; MRI = magnetic resonance imaging; SBP = systolic blood pressure; SHAP = SHapley Additive exPlanations; SpO2 = peripheral oxygen saturation; STAI = State-Trait Anxiety Inventory; XGBoost = eXtreme Gradient Boosting. Please click here to view a larger version of this figure.

Figure 4: Feature interaction analysis and individual risk trajectories. (A) SHAP interaction plot showing the combined effects of STAI score and previous MRI experience on model output. (B) SHAP interaction plot showing the combined effects of maximum breath-hold duration and abdominal girth on model output. (C) SHAP interaction plot showing the combined effects of HRV and STAI score on model output. (D) SHAP interaction plot showing the combined effects of estimated scan duration and history of claustrophobia on model output. (E) ICE curves showing predicted probability trajectories for individual patients across varying STAI scores. (F) ICE curves showing predicted probability trajectories for individual patients across varying maximum breath-hold durations. Thick red lines represent the average trends. Abbreviations: HRV = heart rate variability; MRI = magnetic resonance imaging; SHAP = SHapley Additive exPlanations; STAI = State-Trait Anxiety Inventory. Please click here to view a larger version of this figure.

Figure 5: Clinical application and risk stratification based on the XGBoost model. (A) SHAP waterfall plot for a representative high-risk patient, showing the positive (red) and negative (blue) contributions of individual features to the prediction. (B) SHAP waterfall plot for a representative low-risk patient, showing the positive (red) and negative (blue) contributions of individual features to the prediction. (C) Probability density distributions of predicted artifact probabilities according to actual outcome. (D) Actual artifact occurrence rates across clinical risk categories (low, moderate, and high risk). (E) Clinical impact curve comparing the predicted number of high-risk patients with the actual number of artifact cases per 1,000 patients across different risk thresholds. (F) Optimization of the clinical intervention threshold, with the red point indicating the threshold that maximizes the F1-score. Abbreviations: HR = heart rate; HRV = heart rate variability; SBP = systolic blood pressure; SHAP = SHapley Additive exPlanations; STAI = State-Trait Anxiety Inventory; XGBoost = eXtreme Gradient Boosting. Please click here to view a larger version of this figure.
Supplementary Figure 1: Comprehensive workflow of the study. The diagram summarizes the overall study workflow, including patient selection, data collection, machine learning model development and evaluation, model interpretation, and clinical risk stratification. Please click here to download this file.
Table 1: Baseline clinical characteristics of the study population categorized by the occurrence of motion artifacts. Data are presented as mean (standard deviation) for normally distributed continuous variables, median [interquartile range] for nonnormally distributed continuous variables, and number (%) for categorical variables. The total sample size was N = 514 (no artifact, n = 205; artifact, n = 309). p-values were calculated using Student’s t-test for normally distributed continuous variables, the Mann–Whitney U test for nonnormally distributed continuous variables, and the chi-square test or Fisher’s exact test for categorical variables, as appropriate. Abbreviations: HR = heart rate; HRV = heart rate variability; IQR = interquartile range; MRI = magnetic resonance imaging; SBP = systolic blood pressure; SD = standard deviation; SpO2 = peripheral oxygen saturation; STAI = State-Trait Anxiety Inventory. Please click here to download this Table.
Supplementary Table 1: Sample size distribution and class balance across the overall cohort, training set, and testing set. Data are presented as number (%). The dataset was partitioned using stratified random sampling based on motion artifact status with a fixed random seed (set.seed(123)). The p-value was calculated using Pearson’s chi-square test with Yates’ continuity correction to compare the proportion of motion artifact cases between the training and testing sets. Please click here to download this file.
Supplementary Table 2: Predictive performance of the evaluated machine learning models on the independent testing dataset. Performance metrics were calculated on the independent testing dataset (n = 154; 91 motion artifact cases and 63 non-artifact cases) using decision thresholds derived from the training set. The 95% confidence intervals (CIs) for AUC were calculated using 2,000 stratified bootstrap replicates, and 95% CIs for accuracy were calculated using the exact binomial (Clopper–Pearson) method. p-values were calculated using the DeLong test comparing each model with XGBoost. Abbreviations: AUC = area under the receiver operating characteristic curve; AUPRC = area under the precision-recall curve; CI = confidence interval; NPV = negative predictive value; PPV = positive predictive value; ROC = receiver operating characteristic; SVM = support vector machine; XGBoost = eXtreme Gradient Boosting. Please click here to download this file.
Supplementary Table 3: Pairwise statistical comparison of model discrimination using the DeLong test. Values represent p-values from pairwise DeLong tests comparing the receiver operating characteristic curves of XGBoost, random forest, support vector machine, and logistic regression. Abbreviations: ROC = receiver operating characteristic; XGBoost = eXtreme Gradient Boosting Please click here to download this file.