Introduction

Men who have sex with men (MSM) defines as men who engage in sexual activities with other males, regardless of their sexual orientation—whether gay, bisexual, or heterosexual1. MSM face a significantly higher risk of HIV infection than the general population. Global data show the proportion of new HIV cases among MSM increased from 11% in 2010 to 20% in 20222. and UNAIDS data indicate MSM are 23 times more likely to be infected with HIV1,3. Beyond physical health risks, MSM often experience a higher prevalence of mental health issues, particularly depression4,5. A 2021 survey in western China found a depression prevalence of 38.0% in this group6. The mental health of MSM is influenced by a complex social and psychological environment, including factors such as social support, self-esteem, and depression, which collectively shape their psychological resilience and affect their ability to cope with stress and health challenges7. Additionally, MSM encounter due to their sexual behavior, which can impact their mental well-being and create barriers to accessing essential HIV testing and treatment services8.

Psychological resilience defines as an individual’s ability to adapt effectively to adversity, trauma, threat, or other significant life stressors9. It is one of the most important indicators of mental health and an essential intrinsic protective factor in maintaining the typical development of an individual’s socially adaptive functioning10. Psychological resilience is influenced by both internal and external factors. Internal factors, such as an individual’s emotions, personality traits, and coping strategies, play a significant role in shaping their resilience. External factors, including family relationships, social environment, biological factors, educational background, and social support, also contribute to an individual’s level of resilience. These factors interact in complex ways to determine a person’s overall resilience11.

Depression is a common but serious mood disorder that can cause severe symptoms and affect how one felt, thought, and handled daily activities, such as sleeping, eating, and working. An individual who is depressed might experience insomnia, hopelessness about the future, dysphoria so painful that it hurt, impaired ability to concentrate, lack of joy and pleasure, and feelings of guilt and worthlessness. These symptoms could further result in the wish to die12. Depressive symptoms are a common psychiatric disorder among MSM with HIV-positive status13. These mental health problems may influence their sexual behavioural patterns, increase the risk of high-risk sexual behaviour and reduce the effectiveness of HIV interventions14. It is therefore important to consider mental health problems in the MSM population and their association with high-risk sexual behaviour in order to develop effective comprehensive interventions.

Social support refers to the psychological and material comfort that an individual receives through connections with others, groups, and the broader community. It was essential for maintaining both mental and physical well-being and could manifest in various forms, such as advice, guidance, understanding, or practical help. Social support had been characterized as the resources and assistance that an individual could access through social networks and relationships. It included emotional, instrumental, informational, and companionship supports. These forms of support collectively contributed to an individual’s overall resilience and well-being15,16.

Self-esteem refers to an individual’s subjective evaluation of their own worth and capabilities. It typically encompasses cognitive and emotional responses to aspects such as one’s appearance, abilities, achievements, and social status. Self-esteem reflects a person’s overall attitude toward themselves and is a core component of self-concept. Individuals with high self-esteem usually held positive views of themselves, feeling confident and valuable. In contrast, those with low self-esteem might have negative self-perceptions, feeling insecure and lacking in worth17.

Many researchers have studied the psychological resilience and its influencing factors in the MSM population using non-machine learning methods like traditional statistics, qualitative research, and mixed methods6,10,18,19. Sun et al.10 used SEM to explore how psychological resilience mediates the link between social support and anxiety/depression in Chinese HIV-positive individuals, including MSM. Chung et al.18 applied correlation and regression analyses to investigate the relationships among psychological resilience, self-esteem, and depressive symptoms. Armstrong et al.19. employed longitudinal data analysis to track long-term depression patterns in MSM. Pan et al.6 conducted descriptive and regression analyses to evaluate anxiety, depression, and their influencing factors in MSM, revealing several mental health-related factors such as social support and self-esteem. These studies exemplify the use of traditional and qualitative methods in analyzing MSM’s mental health and psychological resilience. Unlike traditional statistical methods, machine learning excels at handling complex data patterns, nonlinear relationships, and high-dimensional data, which pose challenges for traditional methods. When analyzing psychological resilience and its influencing factors in the MSM population, machine learning can more precisely identify complex interactions among multiple factors.

The use of machine learning techniques has become increasingly common in clinical practice20,21,22,23,24. These techniques have been used in a number of areas, including the development of decision tree algorithms for the diagnosis of cancer and Alzheimer’s disease20. the prediction of diabetes21the prediction of mortality rates in patients with coronavirus disease 2019 (COVID-19)22. and the evaluation of the cost-effectiveness of yellow fever vaccines23. Logistic regression has also been widely used to determine the prevalence and correlates of anxiety and depression24, to predict lung metastases in patients with colorectal cancer25, and to determine the prevalence and clinical correlates of post-stroke behavioural disorder syndrome26. Given that decision trees are prone to overfitting and have limitations in feature selection, while logistic regression demands high linear independence among features and may have limited accuracy in probability output, combining these two methods can effectively address their respective shortcomings27. While a combination of the two methods has been used to predict mild cognitive impairment in the elderly and to predict acute respiratory failure in patients with pancreatitis28,29, the combination of the two methods to assess psychological resilience and factors influencing it in the MSM population has not yet been reported, despite extensive searches of several databases, including Pubmed. In light of the above considerations, the present study used the Chi-square Automatic Interaction Detector (CHAID) decision tree algorithm in conjunction with multivariable ordinal logistic regression to assess the psychological resilience status of the MSM population and identify the associated influencing factors. This will serve as a basis for improving the psychological resilience of the MSM population, addressing the mental health concerns of the MSM population, and developing HIV prevention and intervention strategies.

Subjects and methods

We conducted a cross-sectional network survey conducted in the first half of 2024. We made full use of the Internet-based comprehensive service platform for the MSM population for HIV prevention and control (Sunshine Measure) to distribute questionnaires we designed to respondents through social platforms such as WeChat groups and QQ groups within the MSM community. This approach ensured broader reach and more precise targeting of respondents, thus facilitating the acquisition of a sufficient MSM sample. We ensured that that the completion and return of questionnaires were anonymous to protect individual privacy. In this study, we enrolled a convenience sample of MSM as participants. We recruited participants online mainly from Zhejiang Province, China, with a few from other provinces, based on their IP addresses. We collected the questionnaire via the Golden Data website (www.jinshuju.com), which operated exclusively within the Enterprise WeChat environment. This approach was taken to ensure the privacy of the data collected. Additionally, We implemented an incentive policy to boost participation among the MSM population and encourage respondents to complete the questionnaire in a timely manner. Upon completion of the survey, we rewarded each participant with a 10 RMB gift, such as phone recharge voucher. We allowed each IP address to be completed only once and not repeated. Prior to participation, we obtained informed consent was from respondents, who were informed of their right to refuse the survey at any time. For this survey, six trained professional MSM workers were employed to collect the questionnaires and to carry out quality control of the data in the questionnaire.

The inclusion criteria for participants in this study were as follows: (1) identifying as MSM, including gay men, bisexual men, heterosexual men and transgender men; (2) being aged 18 years or older; (3) having the ability to read and complete the questionnaire; (4) being able to use a mobile phone correctly; (5) informed consent for this study and voluntarily participating. Exclusion criteria were as follows: Any entries that were incomplete, contained logical inconsistencies, or were completed in an unrealistically short time (e.g., less than 30 s) were excluded from the analysis.

The questionnaire was designed by the researchers themselves. This questionnaire was specifically designed for the MSM population and utilized a closed-ended format. The survey commenced with an introduction that emphasized its purpose and importance. Respondents were reassured of complete anonymity and robust privacy protection measures. Only after granting informed consent could participants proceed to complete the questionnaire. The questionnaire consisted of three main sections: basic socio-demographic information about the respondents, HIV-related information and psychological scales. The first section included items on basic demographic information such as age, occupation, marital status, education, personal income, religious beliefs, employment status, place of residence and so on. The second section focused on HIV-related information, including HIV test status, syphilis test status, hepatitis C test status, anti-HIV drug use status, history of sex with men, history of sex with women, and HIV disclosure status. The third section contained the psychological scales, including the Social Support Scale, the Self-Esteem Scale, the Patient Health Questionnaire (PHQ-9) scale, and the Psychological Resilience Scale.

The Psychological Resilience Scale-25 consisted of 25 items presented on a 5-point Likert scale30. The total score was 100. A score of ≤ 60 indicated poor psychological resilience, 61–69 indicated moderate psychological resilience, 70–79 indicated good psychological resilience and ≥ 80 indicated excellent psychological resilience.The PHQ-9 scale consisted of nine items. Each item was given a score of 0, 1, 2 or 3, and the total score was obtained by summing the scores of the nine items, with a total score of 2731. A score of 0–4 indicated no depressive symptoms, a score of 5–9 indicated mild depressive symptoms, a score of 10–14 indicated moderate depressive symptoms, and a score of 15–21 indicated severe depressive symptoms. In this study, a score of ≥ 10 was used as the threshold for the presence of depressive symptoms. The Social Support Scale consisted of 12 items and was scored on a seven-point scale32. The total score was obtained by summing the scores of the 12 items, with a total score of 84. According to the classification system, scores of 12–36 indicated low support status, 37–60 indicated medium support status, and 61–84 indicated high support status. The Self-Esteem Scale consisted of 10 items, each of which was scored on a four-point scale, resulting in a total score of 4033. A score of ≤ 25 indicated low self-esteem, 26–32 indicated moderate self-esteem, and a score of ≥ 33 indicated high self-esteem. The four scales had been extensively used among a wide range of populations, including MSM population, and have consistently shown strong reliability and validity30,31,32,33.

Statistical methods

We conducted the statistical analysis using the SPSS 26.0 software. We expressed count data as the number of participants (percentage), and employed the chi-squared test to compare the groups. We used multivariable ordinal logistic regression to analyse the factors associated with psychological resilience in the MSM population sample. We included the variables that were significant in the bivariate analyses in the multivariable ordinal logistic regression analyses. Differences were considered statistically significant at P < 0.05.

A decision tree algorithm was a method of data analysis that used a tree-like structure to represent decisions and their associated outcomes. We used CHAID decision tree model to analyse the factors influencing psychological resilience in the MSM population sample, with psychological resilience as the dependent variable and the variables that were significant in the bivariate analyses as the independent variables. We set the parameters of the CHAID decision tree model as follows: the significance level of split nodes and merged categories of the tree was set at 0.05. The decision tree had three layers, with a minimum of 50 cases in the parent nodes and 30 in the child nodes. If the sample size of a node did not meet the minimum requirement, the node was designated as an end node and no further splitting was performed22.

Ethical review

The Medical Ethics Committee of our hospital (Grant No. 2023014) granted ethical approval for this study. We conducted research in line with the Declaration of Helsinki and Good Clinical Practice. Prior to commencement, we obtained informed consent from each participant. In the event that informed consent was not obtained from the respondents, We did not permit them to participate in the study.

Results

Demographic characteristics of the MSM population sample

We collected data from a total of 1113 participants of MSM data, but excluded 43 participants due to incomplete data or logical errors. We included a total of 1070 participants in the analysis of this study. Of these, 579 participants (54.11%) were aged 20–29 years, 183 participants (17.10%) were married, 170 participants (15.89%) were professional personnel and 443 participants (41.40%) had a university degree or higher; 400 participants (37.38%) had a monthly income of ≥ 6,000 RMB, while 709 participants (66.26%) lived in rural areas. The majority of participants were employed (763, 71.31%) and 256 participants (23.93%) identified as Buddhist. The number of individuals tested for HIV, syphilis and hepatitis C was 939 (87.76%), 834 (77.94%) and 803 (75.05%), respectively. Of the total participants, 664 (62.06%) reported sexual intercourse with men in the previous six months, while 129 (12.06%) reported sexual intercourse with women in the same period. Among the 1070 respondents, 910 (85.05%) were from Zhejiang Province, and 160 (14.95%) were from the other 19 provinces. See Table 1.

Table 1 Psychological resilience and chi-square or Fisher’s exact test in the MSM population by subgroup.

Chi-squared or Fisher’s exact test of psychological resilience by subgroup

We conducted a chi-squared or Fisher’s exact test of psychological resilience by subgroup. The results demonstrated that education (P = 0.001), disclosure of test results (P < 0.018), place of residence (P < 0.025), self-esteem (P < 0.0001), depression (P < 0.001) and social support (P < 0.001) were associated with psychological resilience in the MSM population sample. See Table 1. Other variables were not found to be associated with psychological resilience in the MSM population (all P > 0.05).

Multivariable ordinal logistic regression analysis

We employed a multivariable ordinal logistic regression model to examine the influence of several independent variables on psychological resilience. These variables included social support, self-esteem, depressive symptoms, and educational background. Psychological resilience was categorized into four ordered levels: low, medium, high, and extremely high, with the extremely high-resilience group serving as the reference category. Our analysis revealed that a number of these independent variables significantly affected psychological resilience. Specifically, individuals with a high school education demonstrated significantly lower psychological resilience compared to those with a university education or above (β =−0.508, P = 0.020, Exp(B) = 0.602). When compared to the high-social-support group, both the low-social-support group (β =−1.666, P = 0.000, Exp(B) = 0.189) and the medium-social-support group (β =−0.967, P = 0.000, Exp(B) = 0.380) exhibited significantly lower psychological resilience. Furthermore, individuals without depressive symptoms showed significantly higher psychological resilience than those with such symptoms (β = 0.608, P = 0.002, Exp(B) = 1.836). Additionally, both the low-self-esteem group (β =−2.564, P = 0.000, Exp(B) = 0.077) and the medium-self-esteem group (β =−1.902, P = 0.000, Exp(B) = 0.149) had significantly lower psychological resilience compared to the high-self-esteem group. See Table 2 for further details.

Table 2 Logistic regression of factors influencing psychological resilience in the MSM population.

CHAID decision tree model analysis

The results of the CHAID decision tree indicated that in the MSM group, the rates of low, medium, high, and extremely high psychological resilience were 70.0%, 11.7%, 10.4%, and 8.5%, respectively, This indicates a high incidence of low psychological resilience. Self-esteem, depression and social support were closely associated with low psychological resilience in the MSM population sample. In the decision tree, self-esteem was the primary influencing factor. The poor resilience rates were 87.0%, 69.3% and 17.1% for the MSM population sample with low self-esteem, moderate self-esteem and high self-esteem, respectively. The second layer of the decision tree identified depression and social support as secondary influencing factors. Among MSM with low self-esteem, those with depression had a 92.5% rate of low psychological resilience, compared to 80.5% for those without depression. Also, among MSM with low self-esteem, those with low to moderate social support had a 76.5% rate of medium psychological resilience, versus 48% for those with high social support. See Fig. 1.

Fig. 1
figure 1

CHAID decision tree model of factors that may be associated with psychological resilience in the study population of MSM.

Discussions

The primary objective of this study was to evaluate the psychological resilience of the MSM population and identify the key factors that influence it. The MSM population is particularly vulnerable to mental health issues such as depression2,3. Therefore, understanding the determinants of psychological resilience is essential for developing targeted interventions. Numerous traditional statistical methods have been employed to investigate the psychological resilience and its influencing factors in the MSM population6,10,18,19. However, as data on psychological resilience in the MSM population often exhibits complexity, including nonlinear relationships and high-dimensionality, these traditional methods are less effective. In contrast, machine learning methods can efficiently manage such data34. This study employed both the CHAID decision tree algorithm and logistic regression, leveraging their combined strengths to provide a comprehensive analysis of how social support, self-esteem, depression, and education impact psychological resilience in this population. The findings aim to inform policy-making and guide the implementation of effective mental health and HIV prevention strategies for MSM.

In the present study, among the 1,070 participants from the MSM population sample, 749 individuals with low psychological resilience (scoring ≤ 60 points) were identified, accounting for 70.0% of the MSM sample. This suggests that the psychological resilience of this population is relatively low. It is recommended that a variety of strategies and measures be used to increase the psychological resilience of this population in the future. These strategies and measures include: (1) psychological education and awareness enhancement: Conduct mental health education activities through online and offline mental health lectures, workshops, and training courses to improve the understanding of psychological resilience among the MSM population35. Meanwhile, provide mental health information resources, develop mental health handbooks and online resources specifically for the MSM population to help them understand how to cope with stress and enhance psychological resilience; (2) strengthen social support networks: Establish community support groups, organize and support mutual aid groups within the MSM community to provide a safe environment where members can share experiences and support each other. In addition, enhance cooperation with mental health institutions to provide professional psychological counseling services for the MSM population; (3) skill training: Conduct stress management training to help the MSM population learn effective coping skills, such as meditation, deep breathing, and mindfulness exercises36. Furthermore, social skills training can be provided to help the MSM population build a broader social network and strengthen their social support system; (4) policy and environmental interventions: Advocate for inclusive policies and encourage policymakers to develop and implement policies that reduce discrimination and prejudice against the MSM population;37 improve the community environment through community activities and projects to enhance the living environment of the MSM population and reduce social pressure.

Our findings underscore that depression, social support, self-esteem, and educational background are closely linked to low psychological resilience in this population. It has been shown that there is a significant negative correlation between psychological resilience and depression14,18,25. The prevalence of depression in the MSM population is higher than in the general population38. The prevalence of depression in the present study was 28.9%, which is similar to the 26.2% reported by Wang in the MSM population39. Individuals with depressive disorders typically have reduced levels of psychological resilience, suggesting that they have a reduced ability to cope with stressors and are more vulnerable to the onset of depressive episodes. Furthermore, psychological resilience has a partial mediating effect on the relationship between positive coping and depressive mood40. This suggests that psychological resilience not only influences depressive mood directly, but also indirectly by influencing coping styles. Consequently, enhancing psychological resilience is an effective approach to improving depressed mood in depressed patients. This can be achieved by strengthening social support, promoting self-esteem and developing positive coping strategies.

In the MSM population, the relationship between social support and psychological resilience showed a significant positive correlation41. with lower levels of social support reducing the level of psychological resilience in the MSM, which in turn affected their psychological mood. Hussain et al.42 reported that the majority of the MSM in Pakistan lacked family support, either emotional or financial. Specifically, 76% of MSM received no financial support from their families. In addition, 29.45% of MSM did not receive family support after disclosing their sexual orientation. Liu et al.41. showed that 34.50% of the MSM had low social support, whereas the prevalence of low social support in the MSM population sample of the present study was 12.90%, which is lower than the findings of both Liu et al.41. and Hussain et al.42. Social support can be conceptualised as a social network comprising three dimensions: family support, friend support and other forms of support (e.g. social relationships with neighbours, leaders, etc.)43. A significant positive correlation was found between all dimensions of social support and psychological resilience. It is therefore recommended that additional social support channels be made available to MSM, especially those who are HIV-positive, in order to increase their psychological resilience and reduce the prevalence of depression10.

There is a significant positive correlation between self-esteem and psychological resilience in the MSM population. Self-esteem can be defined as an individual’s assessment of their own worth and abilities. It plays an important protective role in the face of adversity. Individuals with high self-esteem tend to be more psychologically resilient and better able to cope with challenges and stress. This is particularly important for the MSM population, especially those who are HIV positive or depressed. Akhtar and Bilour44 conducted a study on the mental health status of the MSM population in Pakistan. They found that 29% of the MSM population had low levels of psychological resilience, while 74% had low to moderate levels of self-esteem. Notably, there was a significant positive correlation between their psychological resilience and self-esteem, and MSM living with a mentor had significantly higher levels of psychological resilience and self-esteem than those living alone or with friends. The present study showed that the prevalence of low self-esteem in the MSM population sample was 34.49%, which is slightly higher than that reported by Akhtar and colleagues44. A Classification Tree Analysis (CTA) showed that self-esteem was the most significant predictor of psychological resilience45, a finding consistent with the results of the present study. Consequently, it is imperative to implement strategies that promote psychological resilience in the MSM population in order to improve their mental health18.

Numerous studies have demonstrated a significant positive correlation between educational attainment and psychological resilience in the MSM population44,46,47. As an individual’s level of education increases, so does their psychological resilience, enabling highly educated individuals to cope with stress and adversity. Akhtar and Bilour44 have shown that educational attainment is significantly and positively associated with psychological resilience. Our study’s multivariable ordinal logistic regression results have also showed that education is significantly associated with psychological resilience after controlling for other variables, aligning with the findings of Akhtar and Bilour44. These findings have been confirmed in other populations as well46,47. This study underscores the importance of education in enhancing psychological resilience.

Logistic regression is a statistical method rooted in probability theory. It predicts the likelihood of a specific outcome by using a linear combination of independent variables to estimate the log-odds of the dependent variable48. The model is built on the assumption that there is a linear relationship between the log-odds of the dependent variable and the independent variables. Logistic regression’s coefficients directly indicate the extent of each independent variable’s influence on the dependent variable, making it particularly suitable for situations demanding clear explanations. In contrast, the CHAID decision tree is an algorithm that relies on chi-square test. It recursively partitions the data into a hierarchical structure to highlight differences among categorical variables49. The CHAID decision tree’s structure is visually intuitive and easy to grasp. It presents the data partitioning process and decision rules in a tree diagram, allowing researchers to readily understand the interplay between different factors. The CHAID decision tree excels at capturing non-linear relationships and interaction effects. For instance, it can discern the more pronounced negative impact of depression on psychological resilience when self-esteem is low, thanks to its hierarchical structure. In our study, both logistic regression and the CHAID decision tree pinpointed depression, social support, and self-esteem as pivotal factors shaping psychological resilience in the MSM community. However, logistic regression additionally revealed that education level significantly influences psychological resilience, a finding not identified by the CHAID decision tree. This discrepancy may be attributed to the logistic regression model’s ability to quantify linear relationships through estimated coefficients, whereas the CHAID decision tree is more adept at capturing non-linear relationships and interaction effects. Additionally, differences in variable selection and model interpretability may also contribute to these divergent results51. The integration of these two methods facilitates a comprehensive and nuanced analysis of psychological resilience and its determinants. This dual-method approach not only broadens the scope of understanding but also mitigates the risks associated with relying solely on one method, thereby safeguarding against the omission of critical insights52. Furthermore, it enhances the depth of inquiry into the underlying mechanisms that shape psychological resilience.

Logistic regression has been used in a number of studies examining psychological resilience in diverse populations53,54. Similarly, the CHAID decision tree algorithm has been used in studies of psychological resilience in college students and older adults55,56. Some researchers have integrated decision trees with logistic regression to predict diseases and associated factors57,58,59,60, such as non-suicidal self-injury in adolescents57, the association between anthropometric measures and total cholesterol in a large population58, HIV infection in the MSM population59, and suicidal ideation in psychiatric patients60. The combination of these two methods has not been used in studies of psychological resilience and its determinants in the MSM population, according to a search of several databases, including PubMed. In our study, a CHAID decision tree combined with logistic regression are used to assess the factors influencing psychological resilience in the MSM population sample. The results of both methods indicated that depression, social support and self-esteem are significantly correlated with psychological resilience. The results of the two machine learning models show high consistency and good performance.

The generalizability of our findings should be approached with caution. The sample, drawn from specific online platforms and social media groups, may not fully represent the entire MSM population due to differences in regional characteristics, socioeconomic status, culture, and HIV prevalence. Additionally, the study’s main focus on Zhejiang, China, could limit the broader applicability of the results. Given these limitations, caution is advised when extending these conclusions to other regions or countries. MSM in different regions may vary significantly in social support, self-esteem, depression, and education levels, all of which in turn affect psychological resilience. Moreover, reliance on self-reported data may introduce bias, which could affect the accuracy and generalizability of the results. To address these limitations, further longitudinal studies are essential to explore the causal relationships between the identified factors and psychological resilience in the MSM population. Additionally, it is recommended to conduct intervention studies to evaluate the effectiveness of educational programs and social support initiatives in enhancing psychological resilience.

Study limitations

The following limitations are inherent to this study: (1) The presence of depressive symptoms, self-esteem, social support and HIV status in our study was determined through self-report by the study participants, which may have introduced information bias, including recall bias, subjectivity bias, and reporting bias, among others, For example, given that the content of this survey is based on self-reports, reporting bias may occur. Participants may report having stronger social support, higher self-esteem, and so on; (2) As this study was a cross-sectional network survey, causal inferences cannot be made based on the results obtained; (3) Due to the need to protect the privacy of the study participants and maintain the confidentiality of the data, some potentially influential factors, such as social discrimination, mental health history, and the details of the social support network (including family, friends, and community support), were not included in this study; and (4) The respondents were required to recall their sexual behaviour over the past six months, which may be subject to recall bias.

Conclusions

In summary, this survey assessed the general demographic characteristics, HIV-related information and psychological status of a convenience sample of MSM population in Zhejiang and the other 17 provinces, China, during the first half of 2024. It used both CHAID decision tree modelling and multivariable ordinal logistic regression to determine the factors influencing psychological resilience in the MSM population. In this study, among the 1070 MSM participants, the prevalence rates were as follows: depression at 28.9%, HIV at 3.4%, low social support at 12.90%, low self-esteem at 34.49%. The CHAID decision tree algorithm coupled with the multivariable ordinal logistic regression model in our study showed that the factors influencing psychological resilience in the MSM population sample were depression, social support, self-esteem and educational attainment. The results of this study can provide a scientific basis for government and relevant agencies to inform decision-making and the implementation of appropriate interventions for the MSM population, with the aim of enhancing their psychological resilience, promoting their physical and mental health, and reducing the incidence and prevalence of sexually transmitted diseases such as AIDS.