Abstract
This study aimed to identify key predictors of immunological failure in elderly patients with HIV receiving antiretroviral therapy (ART) through machine learning approaches. We conducted a retrospective analysis of 490 elderly patients with HIV (including 120 with immunological failure) treated at Guigang People’s Hospital from January 2009 to May 2024, using data extracted from the AIDS Comprehensive Prevention and Control Information System. Employing a two-stage analytical approach, we first applied least absolute shrinkage and selection operator (LASSO) regression to screen 50 potential risk factors, identifying 6 significant predictors. These were subsequently analyzed via logistic regression, revealing six protective factors: moderate disease stage [odds ratio (OR) = 0.401], AIDS stage (OR = 0.130), cotrimoxazole use (OR = 0.495), β2-microglobulin levels (OR = 0.755), platelet count (OR = 0.767), and alanine aminotransferase levels (OR = 0.760). Age was identified as an independent risk factor (OR = 1.275). Finally, the Shapley Additive explanations (SHAP) algorithm was utilized to rank feature importance, providing interpretable insights into predictor contributions. This study used machine learning (LASSO and logistic regression) to pinpoint critical predictors of immunological failure in elderly patients with HIV on ART, aiding early detection of high-risk individuals and informing prevention strategies.
Introduction
With the advancement of antiretroviral therapy (ART), the lifespan of patients with HIV/AIDS has significantly increased. Elderly people living with HIV, defined as individuals aged 50 years and above, have become increasingly prevalent. Recent data indicate that there are over 4 million HIV-infected elderly individuals globally, constituting about 10% of the total HIV-infected population, with this proportion on the rise. 1 These elderly patients represent a crucial demographic in AIDS management due to the unique challenges they face. ART is effective in restoring immune function by inhibiting viral replication 2 ; however, in elderly individuals, physiological decline and immunosenescence reduce the proliferative and differentiative capacities of T/B lymphocytes. This reduction hampers immune restoration and adds complexity to treatment. 3 Consequently, identifying the factors that influence the immunological outcomes of ART in this age group is essential. Doing so can help in screening high-risk individuals, understanding the determinants of poor therapeutic responses, optimizing treatment protocols, and ultimately enhancing the quality of life for elderly people living with HIV. As one of the key regions for HIV/AIDS prevention and control in China, 4 Guangxi has accumulated extensive practical experience and research foundations in the epidemiological characteristics of the virus, population-level intervention strategies, and treatment management. The region’s unique ethnic composition—predominantly Zhuang—and its distinct sociocultural context may influence patients’ treatment adherence and immune responses. Guigang, a city with a high prevalence of HIV infection in Guangxi, has a large proportion of rural and migrant populations, where the transmission of HIV is relatively rapid among middle-aged and elderly individuals in rural areas. 5 Therefore, this study analyzes data from HIV-infected individuals in Guigang, Guangxi, to explore the factors affecting immunological outcomes of ART in older adults. Such investigation is of great significance for identifying high-risk populations, clarifying the determinants of poor treatment response, optimizing treatment strategies, and ultimately improving patients’ quality of life.
Existing research indicates that the immunological outcomes of ART in elderly people living with HIV are influenced by a variety of factors, including lifestyle, psychological status, and medication adherence. 3,6,7 These factors are interconnected, presenting a complex web of relationships that traditional statistical methods struggle to address. Historically, such analyses have employed unifactorial and multifactorial methods to explore the determinants of immunological failure in this population. 8 However, unifactorial analyses fall short in capturing the intricate interactions among multiple variables, while multifactorial analyses may yield inaccurate results due to incomplete consideration of key variables or improper handling of covariates. These methodological shortcomings can significantly impact the selection and modification of antiviral regimens. Inadequate consideration of complex multivariate relationships and interactions may result in imprecise treatment protocols, potentially delaying essential interventions, increasing the risk of immunological failure, and diminishing treatment efficacy.
With advancements in machine learning technology, new methodologies have emerged for identifying the factors influencing immunological failure in elderly people living with HIV. LASSO (least absolute shrinkage and selection operator)-logistic regression, in particular, offers significant advantages over traditional single-factor and multifactorial approaches. This method excels in analyzing the determinants of immunological failure by effectively screening and identifying influencing factors while accounting for the complex relationships and interactions among multiple variables. This capability not only allows for a more comprehensive and in-depth analysis but also minimizes bias that can occur when important variables are overlooked or unnecessary variables are included. Consequently, LASSO-logistic regression provides a more accurate assessment of the risk factors for immunological failure, enhancing the precision of therapeutic interventions in this vulnerable population. 9,10
Therefore, by utilizing machine learning techniques to analyze and identify the factors influencing immunological failure post-ART in elderly people living with HIV, this study aims to facilitate the development of personalized treatment strategies. These strategies enable clinicians to tailor treatment regimens based on specific patient risk factors, enhancing the relevance and efficacy of interventions. Furthermore, by pinpointing key influencing factors, this approach supports informed clinical decision-making, enhances the effectiveness of monitoring, and optimizes interventions. Consequently, these advancements may reduce the incidence and progression of immunological failure, ultimately improving the long-term prognosis and quality of life for these patients.
Methods
Study population
This retrospective study collected clinical follow-up data from elderly people living with HIV attending the care clinic of Guigang People’s Hospital between January 2009 and May 2024.
Inclusion criteria
Age ≥50 years; confirmed HIV-positive status via both primary antibody screening and confirmatory tests; first-time ART recipients, treated for more than 1 year; CD4+ T cell count <350 cells/μL prior to initiating ART.
Exclusion criteria
Patients with coexisting serious chronic conditions, such as malignant tumors, severe liver, or renal insufficiency; cases with missing CD4+ cell counts or more than 50% missing data.
Ethical approval
The study was approved by the Ethics Committee of Guigang People’s Hospital (Approval No. E2024-003-01).
Indicator collection
Data on the study’s participants were comprehensively gathered through the care clinic system for general information and the testing system for laboratory data. In total, 52 variables were initially collected, encompassing a range of demographic, clinical, and laboratory parameters. These included: Demographic Information: Age, gender, marital status, and route of transmission; Clinical Data: Body weight, WHO AIDS/HIV stage (World Health Organization Clinical Staging System for HIV/AIDS), and medication adherence. Medication adherence was assessed at the final follow-up by asking patients how many times they missed their medication in a week, with more than one missed dose indicating poor adherence 11 ; Prophylactic treatment: use of fosinomide for preventing opportunistic infections; Treatment regimen details: inclusion of tenofovir disoproxil fumarate in the regimen; Laboratory tests: baseline and 1-year follow-up counts of CD4+ T lymphocytes, complete blood count (white blood cells, neutrophil count, hemoglobin, platelets), liver function tests (gamma-glutamyl transferase, alkaline phosphatase), and renal function tests (creatinine, urea).
After removal of variables used for calculating outcome indicators, the analysis proceeded with 50 variables. Immunological failure was defined according to international standards 12 as a fall in CD4+ T lymphocyte counts to pretreatment baseline levels or lower, or a consistent count below 100 cells/μL after at least 1 year of continuous treatment. Comparisons of CD4+ counts at 1 year posttreatment to baseline determined whether the outcome was considered an immunological success or failure.
AIDS staging: In this study, patients with AIDS were classified into four progressive clinical stages based on the WHO adult staging system, 13 ranging from Stage 1 (asymptomatic) to Stage 4 (AIDS). A patient is assigned to a specific stage if they present with at least one clinical condition listed for that stage.
Stage 1
Patients with no symptoms or with persistent generalized lymphadenopathy (enlarged lymph nodes in at least two noninguinal sites lasting more than 6 months) are categorized as Stage 1.
Stage 2 (mild symptoms)
Clinical manifestations include unexplained weight loss of less than 10% of total body weight, recurrent upper respiratory tract infections, and a variety of dermatological conditions.
Stage 3 (moderate symptoms)
This stage includes symptoms such as weight loss greater than 10% of total body weight, unexplained chronic diarrhea lasting more than 1 month, pulmonary tuberculosis, and severe bacterial infections. Mucocutaneous lesions may also occur at this stage.
Stage 4 (severe symptoms)
This stage includes all AIDS-defining illnesses. Clinical manifestations can serve as a presumptive clinical diagnosis of AIDS and include HIV wasting syndrome, Pneumocystis pneumonia, recurrent severe or radiologically confirmed bacterial pneumonia, extrapulmonary tuberculosis, HIV encephalopathy, cerebral toxoplasmosis, chronic (lasting more than 1 month) oral or labial herpes simplex infection, esophageal candidiasis, and Kaposi’s sarcoma.
Statistical methods
The analysis of the data was conducted using SPSS version 22.0 and R software version 4.3.2. For descriptive statistics, measurement data that followed a normal distribution were expressed as means and standard deviations. Data not adhering to a normal distribution were described using medians and interquartile ranges. Categorical data were reported as frequencies and percentages. Comparisons between groups for normally distributed data were performed using one-way analysis of variance. For data that were not normally distributed, the Kruskal–Wallis test was utilized. Categorical data comparisons were conducted using the χ2 test.
The analysis of factors influencing immunological failure utilized LASSO-logistic regression. Initially, all variables were included in the LASSO regression to screen for relevant factors. The optimal λ-value for the LASSO regression was determined through 10-fold cross-validation. Subsequently, variables with nonzero coefficients at the optimal λ-value were incorporated into logistic regression for further analysis. The SHAP algorithm was employed to rank the importance of the variables, thereby providing insights into the factors influencing immunological failure in elderly people living with HIV. Statistical significance was set at a two-sided p value of <0.05.
Results
General characteristics of patients
The study included 490 elderly people living with HIV, comprising 348 males and 142 females. The median age of participants was 66 years. Out of these, 370 patients were categorized in the immunological success group, while 120 were in the immunological failure group. Statistically significant differences (p < 0.05) were observed between the two groups in several parameters: age, WHO AIDS/HIV stage, current and past use of Neurontin, platelet count, alanine aminotransferase (ALT) levels, and lymphocyte percentage. No significant differences were found in other assessed indices. These findings are detailed in Table 1.
Patient Baseline Characteristics Table
SMD, standardized mean difference; CV, coefficient of variation; SD, standard deviation; TDF, tenofovir disoproxil fumarate; WHO, World Health Organization.
Screening of potential risk factors for immunological failure in elderly people living with HIV
LASSO regression was employed to identify factors contributing to immunological failure in elderly people living with HIV. Using 10-fold cross-validation, the optimal log-λ value was determined to be −3.194 (Fig. 1A). At this log-λ value, six factors were identified as being associated with immunological failure in this patient group (Fig. 1B).

Analysis of factors affecting immunological failure in elderly people living with HIV
The variables identified through LASSO regression were further analyzed using Logistic regression (Table 2). The analysis revealed that being in WHO AIDS/HIV stages 3 and 4, current cotrimoxazole use, high β2-microglobulin (β2M) levels, high platelet counts, and high ALT levels acted as protective factors against immunological failure. Conversely, older age was identified as an independent risk factor for immunological failure (all p < 0.05). The SHAP algorithm was employed to rank the importance of these variables, with the following order from highest to lowest impact: age, β2M, WHO AIDS/HIV stage, platelets, current use of cotrimoxazole, and ALT (Fig. 2).

SHAP importance plot. CVM, cross-validation mean squared error; LogLambda_1se, logarithm of lambda value within one standard error of the minimum; LogLambda_min, logarithm of the minimum lambda value.
Logistics Regression Results Table
OR, odds ratio; CI, confidence interval.
Discussion
Elderly people living with HIV represent a distinct demographic with an increasing prevalence. Despite the life-extending benefits of ART, these older patients often face unique challenges due to age-related structural deterioration of immune organs and diminished immune response functionality. Consequently, they are at risk of immunological failure during ART, which can hinder effective viral suppression and severely impact their quality of life. This study utilized the LASSO algorithm to extract key features from biomarkers, demographic characteristics, and disease-related factors in elderly people living with HIV. LASSO regression, which applies L1 penalties for variable selection, helps pinpoint critical factors, simplifies the model, and prevents overfitting, thereby enhancing prediction accuracy. Logistic regression was subsequently employed to analyze these factors’ influences, and the SHAP algorithm ranked their importance. The key determinants of immunological failure identified were, in descending order of impact: age, β2M, WHO AIDS stage, platelets, current use of cotrimoxazole, and ALT. Among these, only age was identified as a risk factor for immunological failure; the others served as protective factors.
In this study, the proportion of male participants was relatively high, which reflects the gender-specific characteristics of the HIV epidemic in Guigang, Guangxi. In the current epidemic situation of AIDS in Guigang, males remain the primary population affected by HIV infection, particularly among middle-aged and older adults. 5 Previous studies have shown that gender may influence immunological responses and treatment adherence. Male patients may exhibit differences in immune recovery during treatment; for example, some studies have reported that the rate of CD4+ T cell recovery in male patients during the early stages of ART is relatively slower. Moreover, differences in psychosocial support and health-related behaviors may also impact treatment outcomes. 14 –16
Older HIV-infected individuals face an elevated risk of immunological failure during ART. Our study indicates that increasing age is positively associated with an increased risk of immunological failure, noting a 28% rise in risk for each additional year, aligning with findings from previous studies. 17 The aging process in people living with HIV accelerates the deterioration of the immune system, compounded by HIV-induced lymphohistiopathy and abnormalities in thymic and lymphatic differentiation. 18 Furthermore, immunological failure may be linked to prolonged intervals between HIV diagnosis and the initiation of ART, as well as diminished cognitive and medication management abilities in older patients. 19,20 Consequently, clinical management of elderly people living with HIV should prioritize early initiation of ART, reduction of the time gap between diagnosis and treatment commencement, and customization of treatment plans to enhance therapeutic effectiveness and minimize the risk of immunological failure.
β2M is a small molecule protein, widely found on the cell membrane surface of nucleated cells, and is a component of major histocompatibility complex class I molecules, which are involved in immune monitoring and regulation and play a key role in helping the immune system to recognize and clear viral infections. Maintaining appropriate β2M levels helps to control HIV replication and maintain the dynamic balance of the immune system. 21 Previous studies have shown that older adults typically have higher β2M levels, reflecting the continued activation of their immune system and chronic inflammation, which is also considered a hallmark of “inflammatory aging,” and that this continued immune activation is strongly associated with a variety of age-related diseases (e.g., cardiovascular disease and diabetes). 22,23 In contrast, young people with lower levels of β2M have a more efficiently regulated immune system and can better cope with immune challenges. 24 Our study also confirmed that β2M is a protective factor against antiretroviral immunological failure in older people living with HIV; therefore, future studies should continue to explore the specific mechanisms of β2M and its regulatory strategies in older people living with HIV in order to optimize therapeutic regimens.
WHO AIDS/HIV stage is a classification based on clinical manifestations of the disease and immune function, among others, and patients in WHO clinical stages III and IV at baseline had a significantly higher risk of immunological failure than those in stage I. The risk of immunological failure was significantly higher in patients in stage III than in those in stage IV. This is not entirely consistent with previous findings reported in the literature. 25,26 Definitions of immunological failure have varied in numerous studies, such as thresholds for CD4+ T cell counts and length of observation, 21 and patients in WHO clinical stage IV and with lower CD4+ T cell counts may be treated at the time of ART due to a higher severity of the disease, often with more timely and intensive medical interventions, and their immune systems may have a higher potential for reconstitution. The above differences all contribute to the inconsistency of the results, as CD4+ T cell counts are more likely to recover.
Platelets, small cell fragments in the blood, are primarily involved in clot formation and the regulation of inflammation. Research indicates that an increase in platelet levels is associated with a 23% reduction in the risk of immunological failure, marking them as a protective factor. Platelets possess surface receptors that recognize and bind to HIV viral particles. This capability allows them to capture and neutralize the virus effectively. Particularly in the early stages of viral infection, platelets can sequester the virus, hindering its spread and aiding in the reduction of the viral load within the body. Consequently, platelets play a crucial protective role in combating HIV infection. 27,28
Cotrimoxazole is primarily used in HIV management to inhibit viral replication, slow disease progression, and enhance immune function. Our study indicates that the risk of immunological failure is reduced by 50% in elderly people living with HIV who are administered cotrimoxazole. Given their often-fragile immune systems—compounded by multiple chronic diseases and complex health conditions—elderly patients particularly benefit from cotrimoxazole’s role in preventing and treating opportunistic infections. This is especially critical for patients with CD4+ cell counts below 200. By preventing such infections, cotrimoxazole alleviates the immune system’s burden, helping to stabilize immune status during ART, thereby enhancing treatment efficacy and improving the quality of life for these patients. 29 –32
ALT is an enzyme predominantly found in hepatocytes and is widely used as a marker for liver function, indicating hepatocyte damage and inflammation. Our study found a significant association between ALT levels and the risk of immunological failure in elderly people living with HIV, with moderately elevated ALT levels reducing the risk by approximately 24%. This suggests that ALT may act as a protective factor during ART. Moderately elevated ALT levels may correlate with better immune recovery in people living with HIV on ART, likely because healthy liver function enhances the metabolism and clearance of antiretroviral drugs, thereby reducing drug toxicity and improving therapy efficacy. 33 In addition, other studies have shown that these ALT levels are associated with lower HIV viral loads, further substantiating ALT’s role as an immunological protective factor. 34
This study has several limitations. First, we were unable to comprehensively include all potential factors that may influence immunological failure in HIV-infected individuals receiving ART, such as inflammatory markers (e.g., C-reactive protein and interleukin-6), immune activation markers, and gut microbiota-related indicators. The study population consisted of individuals from Guigang, Guangxi, and thus the findings should be interpreted within the specific sociocultural context of the region. Future research is recommended to conduct in-depth analyses focusing on the Zhuang ethnic group to assess the potential impact of cultural differences on treatment outcomes. In addition, the gender imbalance in our sample may have affected the generalizability of the model results. Future studies should consider gender-stratified analyses or increasing the sample size of female participants to enhance the representativeness of the findings. Therefore, future research should incorporate a broader range of influencing factors, adopt gender-stratified modeling or resampling techniques to balance sex ratios, and carry out multicenter international collaborative studies to validate differences across ethnic groups. Moreover, comparative studies across different age groups should be designed to gain a more comprehensive understanding of, and develop effective strategies to prevent, immunological failure among people living with HIV.
The determinants of ART immunological failure in elderly people living with HIV are numerous and multifaceted. Early screening, accurate diagnosis, and prompt initiation of treatment are critical to reducing the risk of immunological failure. To enhance the prevention and management of immunological outcomes in this population, health care providers should focus on intensified HIV testing among high-risk groups, continuous monitoring of comprehensive health indicators, and timely intervention when abnormalities are detected. Such measures will help optimize treatment strategies and improve the overall management of elderly people living with HIV.
Ethical Approval
The study was approved by the Ethics Committee of Guigang People’s Hospital (Approval No. E2024-003-01). Patient data will not be shared with third parties. In addition, written informed consent was obtained from all participants involved.
Footnotes
Data Availability Statement
All data generated during this study are included in this article. Further enquiries can be directed to the corresponding author.
Authors’ Contributions
L.Y. initiated the project and designed the research framework. X.L., D.W., Z.Z., S.Q., W.Q., and C.W. were responsible for collecting and entering data. R.L. and Y.L. handled data processing and coauthored the article. X.L. and L.Y. participated in the review and revision of the article and supervised all aspects of the work. R.L. and Y.L. contributed equally to this study.
Author Disclosure Statement
The authors declare no potential conflicts of interest with respect to the research, authorship, and/or publication of this article. No competing financial interests exist.
Funding Information
This research was supported by the Guangxi Science and Technology Plan Project, under the category of Science and Technology Innovation Base Construction. The project focuses on the development and application of an integrated clinical and scientific research platform for AIDS prevention and treatment using artificial intelligence in Traditional Chinese Medicine in Guangxi. The project identification number is Guike ZY21195041.
